Changes between Initial Version and Version 1 of FileDownloadUpload


Ignore:
Timestamp:
02/19/06 17:34:03 (8 years ago)
Author:
mmc
Comment:

initial page

Legend:

Unmodified
Added
Removed
Modified
  • FileDownloadUpload

    v1 v1  
     1== File Download/Upload == 
     2 
     3When a Rappture application is deployed on the nanoHUB, it runs in an unusual mode. 
     4It runs within a VNC session on hardware at Purdue.  While this is good from the 
     5standpoint of accessing CPU resources at Purdue, it is a barrier to accessing 
     6your data. 
     7 
     8Suppose you are running a tool through the Web browser, and you want to load a 
     9data file from your desktop.  If the Rappture application pops open a file browser, 
     10it will display the contents of your file share on the nanoHUB--not on your 
     11desktop. In fact, Rappture can't (directly) access the files on your desktop. 
     12To do so, it would have to reach back across the Web and ask you nicely for 
     13permission. 
     14 
     15To work around this, while at the same time providing the best user experience 
     16possible, the nanoHUB deploys a "helper" applet called '''{{{filexfer}}}''' into the 
     17Web browser containing the VNC session.  This applet connects back to the Rappture 
     18application and waits for commands. 
     19 
     20Whenever you click on the ''Download...'' button within a Rappture application, 
     21Rappture sends a download prompt to the {{{filexfer}}} applet, which then pops 
     22up a Web page that requests the data from the Rappture application. 
     23 
     24Whenever you select ''Upload...'' from an input control, Rappture sends an upload 
     25prompt to the {{{filexfer}}} applet, which then loads an HTML form that assists 
     26in the upload process.  When you press the button on the form, the uploaded data 
     27is posted back to the Rappture application, which loads your file 
     28into the application. 
     29 
     30In order for this to work properly, you must have an environment variable named 
     31{{{SESSION}}} set to your middleware session number.  Rappture uses the session 
     32number to look for a file containing settings that control download/upload 
     33operations.  Here's an example of that file: 
     34 
     35{{{ 
     36file:  ~/data/sessions/$SESSION/resources 
     37--- 
     38filexfer_port 8123 
     39filexfer_cookie xyzpqd123 
     40filexfer_sitelogo { 
     41  <h1><a href="http://www.nanohub.org/" title="nanoHUB home page"><span>nanoHUB.org: online simulations and more</span></a></h1> 
     42} 
     43filexfer_stylesheet http://www.nanohub.org/templates/rappture/upload.css 
     44}}} 
     45 
     46The '''{{{filexfer_port}}}''' line specifies the port number for the server controlling 
     47the {{{filexfer}}} applet. 
     48 
     49The '''{{{filexfer_cookie}}}''' is a magic cookie also sent to the applet, which helps 
     50secure the communication between the applet and the controlling server.  If the 
     51cookie doesn't match, the server rejects the applet's attempt to connect. 
     52 
     53The '''{{{filexfer_sitelogo}}}''' is an optional bit of HTML that is integrated into 
     54the top of the upload form.  It can be used to add a customized logo to the 
     55form, so the user knows where this strange "upload" window is coming from. 
     56 
     57The '''{{{filexfer_stylesheet}}}''' is an optional URL specifying the css style sheet 
     58used for the upload form.  If specified, the style sheet is used to customize 
     59the look of the form so that it bears some resemblance to the hub site that sent it. 
     60 
     61=== Debugging === 
     62 
     63You can debug the download/upload mechanism on your desktop, without 
     64having to run the application through the nanoHUB.  To do this, set the following 
     65environment variables: 
     66{{{ 
     67setenv SESSION 7 
     68setenv FILEXFER_DEBUG 1 
     69}}} 
     70You can set the {{{SESSION}}} variable to any value.  As long as it's set, 
     71Rappture will look for a {{{resources}}} file, such as the one shown above. 
     72In this case, you would store the resources file at the path {{{~/data/sessions/7/resources}}}. 
     73 
     74Next, start up a Rappture application: 
     75{{{ 
     76rappture 
     77}}} 
     78 
     79Then, load a web page containing the {{{filexfer}}} applet.  You can do this 
     80by talking directly to the Rappture application on your local machine.  Open 
     81a Web page with the name "debug" on the port number specified in the {{{resources}}} 
     82file: 
     83 
     84{{{ 
     85http://localhost:8123/debug 
     86}}} 
     87 
     88Note that in a real (nanoHUB) Web page, you wouldn't normally see the {{{filexfer}}} applet. 
     89But on this special debug page, you can see the applet and monitor its communication 
     90with the controlling server.  If everything is working properly, it should say 
     91"Connected." 
     92 
     93Now, click on ''Upload...'' or ''Download...'' in the Rappture interface. 
     94Rappture will send a message to the applet, which will pop up a Web page 
     95in response to your action.