Context Navigation

When a Rappture application is deployed on the nanoHUB, it runs in an unusual mode.
It runs within a VNC session on hardware at Purdue. While this is good from the
standpoint of accessing CPU resources at Purdue, it is a barrier to accessing
your data.

Suppose you are running a tool through the Web browser, and you want to load a
data file from your desktop. If the Rappture application pops open a file browser,
it will display the contents of your file share on the nanoHUB--not on your
desktop. In fact, Rappture can't (directly) access the files on your desktop.
To do so, it would have to reach back across the Web and ask you nicely for
permission.

To work around this, while at the same time providing the best user experience
possible, the nanoHUB deploys a "helper" applet called filexfer into the
Web browser containing the VNC session. This applet connects back to the Rappture
application and waits for commands.

Whenever you click on the Download... button within a Rappture application,
Rappture sends a download prompt to the filexfer applet, which then pops
up a Web page that requests the data from the Rappture application.

Whenever you select Upload... from an input control, Rappture sends an upload
prompt to the filexfer applet, which then loads an HTML form that assists
in the upload process. When you press the button on the form, the uploaded data
is posted back to the Rappture application, which loads your file
into the application.

In order for this to work properly, you must have an environment variable named
SESSION set to your middleware session number. Rappture uses the session
number to look for a file containing settings that control download/upload
operations. Here's an example of that file:

The filexfer_port line specifies the port number for the server controlling
the filexfer applet.

The filexfer_cookie is a magic cookie also sent to the applet, which helps
secure the communication between the applet and the controlling server. If the
cookie doesn't match, the server rejects the applet's attempt to connect.

The filexfer_sitelogo is an optional bit of HTML that is integrated into
the top of the upload form. It can be used to add a customized logo to the
form, so the user knows where this strange "upload" window is coming from.

The filexfer_stylesheet is an optional URL specifying the css style sheet
used for the upload form. If specified, the style sheet is used to customize
the look of the form so that it bears some resemblance to the hub site that sent it.

Debugging

You can debug the download/upload mechanism on your desktop, without
having to run the application through the nanoHUB. To do this, set the following
environment variables:

setenv SESSION 7
setenv FILEXFER_DEBUG 1

You can set the SESSION variable to any value. As long as it's set,
Rappture will look for a resources file, such as the one shown above.
In this case, you would store the resources file at the path ~/data/sessions/7/resources.

Next, start up a Rappture application:

rappture

Then, load a web page containing the filexfer applet. You can do this
by talking directly to the Rappture application on your local machine. Open
a Web page with the name "debug" on the port number specified in the resources
file:

http://localhost:8123/debug

Note that in a real (nanoHUB) Web page, you wouldn't normally see the filexfer applet.
But on this special debug page, you can see the applet and monitor its communication
with the controlling server. If everything is working properly, it should say
"Connected."

Now, click on Upload... or Download... in the Rappture interface.
Rappture will send a message to the applet, which will pop up a Web page
in response to your action.