Request Controller |
Content |
|
||
|
Overview |
When you log into a LabVantage Web Application or attempt to access a LabVantage web page, you must pass through the Request Controller servlet. The Request Controller:
The Request Controller exposes the following LabVantage functionality:
• |
LabVantage Custom Tags. |
||||||
• | PageTagInfo class, which allows values of the following properties to
be passed to a page:
LabVantage Custom Tags automatically execute methods in the PageTagInfo class. For information concerning these methods, see the Javadoc for the sapphire.* Packages. |
||||||
• | Instances of JSTL objects that support JSTL tags. The JSTL Objects section of the topic Web Page Designer describes how JSTL objects work with LabVantage pages. |
Calling the Request Controller |
Principle |
You can call the Request Controller only after logging into the LabVantage Web Application you are developing. You can login as either the sysadmin LabVantage Named User, or as the owner of the LabVantage tablespace. After logging in, you load pages into the browser by issuing commands to the Request Controller through the URL. During page development, the general format of a page request through the URL is:
http://<hostname>:<port>/<root>/rc?command=[value]&[value]=[target]
where
<hostname> is the name of your development machine.
<port> is the port number at which the Application Server listens for http requests (typically 8080).
<root> is the root folder of the Web Application.
rc is the Request Controller variable assigned to the Web Application. We recommend that you do not change this variable.
[value] is the value of the command parameter.
[target] is the designator for the page you want to load.
Example using testpage.jsp in the root folder of the mydir Web Application:
http://hostname:8080/mydir/rc?command=file&file=testpage.jsp
The calls you issue depend on the kind of page you want to load. For example, the URL
http://hostname:8080/mydir/rc?command=page&page=MyPage
calls a web page that is registered with LabVantage (MyPage is the identifier of the WebPage SDI).
The variable rc is assigned to the Request Controller. Its parameters tell it what to do. In the first example above, the command parameter with a value of file (command=file) tells the Request Controller that you want a JSP file. The file parameter with a value of testpage.jsp (file=testpage.jsp) tells the Request Controller which file you want. In the second example, command=file&page=MyPage tell the Request Controller you want a web page that is registered with LabVantage.
When you register a JSP with LabVantage, you use the Web Page Designer to associate a custom JSP with a WebPage SDI. LabVantage automatically registers "data-driven" pages you make with the Web Page Designer.
When you request a registered JSP (number 1 below), the Request Controller calls the WebPage SDI (2). LabVantage sends the WebPage information to the JSP engine (3), which uses this information to locate and load the page (4).
Syntax |
Recall that the value of the command parameter tells the Request Controller what you want to do. The following table describes command parameter values and the parameter-value pairs associated with each. The examples call the Request Controller in a URL and assume the default requestcontrollername value rc.
Possible Values of the command Parameter | |||||||||||||
Value | Description | ||||||||||||
file | Purpose
Requests a JSP file. Associated Parameter-Value Pairs
Example The parameter-value pairs rc?command=file&file=mydir/testpage.jsp request the file testpage.jsp, which is in the folder mydir. |
||||||||||||
page | Purpose
Requests a JSP that is registered with LabVantage. Associated Parameter-Value Pairs
Example The parameter-value pairs rc?command=page&page=MyPage request the JSP associated with the WebPage SDI MyPage. |
||||||||||||
login | Purpose
Logs a LabVantage Full Named User into the Web Application. Associated Parameter-Value Pairs Example The parameter-value pairs rc?command=login&username=JDrake&password=JD log user JDrake into the Web Application, connect to the sapphire database, and load the registered SiteMap JSP after login. |
||||||||||||
logoff | Purpose
Logs a LabVantage Full Named User off of the Web Application. Associated Parameter-Value Pairs
Example The parameter-value pairs rc?command=logoff&url=logon.jsp logs the user off of the Web Application and loads logon.jsp after logoff. |
||||||||||||
bulletin | Purpose
Requests a JSP that is assosciated with a Bulletin SDI. Associated Parameter-Value Pairs
Example The parameter-value pairs rc?command=bulletin&bulletin=B0000001 request the JSP associated with Bulletin SDIId B0000001. |
||||||||||||
history | Purpose
Requests a JSP from the "Recent Items" list. Associated Parameter-Value Pairs
Example The parameter-value pairs rc?command=history&history=3 request the fourth JSP that has been loaded since login. |
||||||||||||
wizard | Purpose
Calls a custom wizard you have made. Associated Parameter-Value Pairs
Example The parameter-value pairs rc?command=wizard&wizard=mystuff/newpage.xml calls the wizard defined by newpage.xml. For more details concerning custom wizards, see Creating Custom Wizards in the Advanced Operations section of the Web Page Designer. |
||||||||||||
action | Purpose
Executes a LabVantage Action and loads a JSP after the Action executes. You can call Actions by ActionId or class.
Associated Parameter-Value Pairs
Example Assume the current page in the Web Application is security/userlist.jsp. Buttons on this page let you list, add, and delete Users. A button to delete a User could issue the following call to the Request Controller: rc?command=action&actionid=DeleteSDI&sdcid=User&keyid1=' + keyid1 + '&nextpage=rc?command=file&file=security/userlist.jsp executes the DeleteSDI Action. The property sdc is set to User, the property keyid1 is set to the SDI key of the User to be deleted (retrieved by a getSelected() method). After deleting this User, the same JSP reloads. The result is a User has been deleted, and the page has been updated.
Example To call a class, use the following syntax, replacing com.labvantage.sapphire.actions.ClassName with your package and class: rc?command=action&actionclass=com.labvantage.sapphire.actions.ClassName Because there is no ActionId, the method processAction( sapphire.xml.PropertyList) should be overridden. This is supported through ActionProcessor.processActionClass( String class, HashMap props) and ActionBlock.setActionClass(String name, String class, HashMap props). ActionIds and classes can occupy the same block. |
||||||||||||
viewattachment |
Purpose Retrieves an attachment associated with an SDI. Associated Parameter-Value Pairs
Example This call retrieves an attachment (BLOB or file reference) containing attachment number 1 associated with Sample S01: rc?command=viewattachment&sdcid=Sample&keyid1=S01&keyid2=(null)&keyid3=(null)&attachmentnum=1 For more information concerning attachments, see Attachment Page Type in the topic Web Page Designer. |
||||||||||||
attachment | See the Request Controller Command for the AttachmentManager Page Type. |
Request Parameters |
Definition |
Request Parameters pass specific instructions to values (they are attributes of a value). For example, the following call requests the JSP associated with the WebPage SDI MyPage. This is the same example as page above; however, this time three Samples are passed into MyPage:
rc?command=page&page=MyPage&sdcid=Sample&keyid1=S01;S02;S03
where | page is the command parameter | |
MyPage is the value of the command parameter | ||
sdcid andkeyid1 are Request Parameters. |
Note that for multiple values of a Request Parameter, you must use a semicolon to separate each.
The following example shows how to declare a variable as the value of a Request Parameter in the code of a JSP:
String sdcid = pageinfo.getProperty("sdcid");
String keyid1 = pageinfo.getProperty("keyid1");
String keyid2 = pageinfo.getProperty("keyid2");
String keyid3 = pageinfo.getProperty("keyid3");
For information concerning the pageinfo instance, see:
Javadoc for the sapphire.* Packages
Page Tags in the LabVantage Custom Tag Reference
About JavaScript Characters |
Request Parameters must not contain invalid JavaScript characters (such as !@#$%^&*()-~,'<.>/?). They generate client-side syntax errors.