01 CWebProxy Tutorial

Introduction

This document is the start of a tutorial on using CWebProxy. It will be developed further, along with some actual applications you can use as examples, during the winter of 2002/2003. See the channel documentation for a detailed description of the channel. The latest version of these documents can be found at the CWebProxy home page.
Examples

The following examples require particular technologies to work, as indicated. Except for the first example you will need to publish the channel with the parameters indicated. A channel timeout of around 5000 is usually appropriate, depending on the server response. You will need to deploy the application in your environment and adjust URLs accordingly. URLs starting with "docs/examples" here can be found in the tutorial examples directory.

Example 1: Tomcat Numguess

Required technology:

  • Tomcat servlet container running the /examples context

CWebProxy configuration:

You must indicate that the channel has help, info, and edit buttons when publishing.

The first place to look is the uPortal distribution. The unmodified Tomcat numguess.jsp and servlet examples are set up as example channels. They can be seen in the CWebProxy Examples tab of the demo user, and are available for subscription via Preferences. See the webpages/media/org/jasig/portal/channels/webproxy/examples directory directory in the uPortal distribution for the info, help, and edit files. Notice that the URLs can be relative to channel-specific directories for stylesheets and media. This channel uses static files for help, each calling the channel with the cw_reset=return attribute to return to normal function. However, these functions can be implemented using any URLs. There is a similar example CWebProxy channel in the uPortal distribution which connects to the Tomcat servlet examples.

Example 2: Static Page Loop

Required technology:

  • any web server

CWebProxy configuration:

  • cw_xml=examples/loop1.html
  • cw_passThrough=marked
  • cw_defaultCacheMode=all
  • cw_tidy=on

This is a set of simple HTML pages. The idea here is that you don't always need complex dynamic functions to create a channel. Some things can be done very simply with a few static HTML pages that refer mainly to each other. Judicious use of CWebProxy's pass-through and caching features can let you do a lot with a little... For example, a closed loop of cached static XHTML pages would not require the tidy option, and pass-through could be set to all, thus requiring very little overhead. In this case, we have pass through set to "marked", and have designed the two pages to look very similar, thus simulating dynamic function. One link on the second page is not marked as in-channel, and will leave the portal framework.

Example 3: IPerson-passing Example with Help

Required technology:

  • Apache web server supporting php
  • uPortal PersonDirs configuration that populates the eduPerson attributes indicated

CWebProxy configuration:

  • cw_xml=examples/demo.php
  • cw_passThrough=all
  • cw_person=cn,l,uid,eduPersonPrimaryAffiliation
  • cw_personAllow=cn,l,uid,eduPersonPrimaryAffiliation
  • cw_cacheDefaultMode=all
  • cw_help=examples/demo.php?help=true

This is a simple PHP dynamic front end which receives and prints some basic IPerson information and points the user to a static page based on their primary affiliation. It also demonstrates the use of the help button. In this case, the same application handles the help function.

Example 4: (theoretical example so far...)

A theoretical example expanding on the ideas in Example 3. Imagine an application that consists of a tree of web pages. The first page is a static XHTML page containing a few links. Some of these should remain in the channel, others should leave the portal framework. This page should use cw_passThrough="marked". Since it is the initial page of the application, we would indicate this in the static data defining the channel. Links that need to stay in the channel should have "?cw_inChannelLink=1" appended to them. (We will assume the use of the XHTML stylesheets provided with CWebProxy.)

Let's look at possibilities for some of these marked links. Perhaps one points to a set of specially designed static pages that avoid outside links. They are all designed to fit in the channel. We can set cw_passThrough="all" to make writing the pages easier. So when linking to this page from the top-level page, we'd have something like:

    <a href="second.html?cw_inChannelLink=1&cw_passThrough=all"> 

Another second-level page might actually be an application implemented by a CGI or via JSP, PHP, or whatever. Let's assume that this one generates HTML (as opposed to XHTML), and also generates a few links to outside web pages, which we don't want to incorporate into the portal. The link to this this application should set the pass-through type to "application". It should also set cw_tidy="on" to convert the HTML to XHTML.

Akcnowledgement

This manual page seeded from MUN content authored by Andrew Draskóy, last modified circa January 6, 2003.