source: trunk/gsdl3/src/java/org/greenstone/gsdl3/core/WebReceptionist.java@ 4692

Last change on this file since 4692 was 4258, checked in by kjdon, 21 years ago

simplified actions, the receptionist does a lot more of teh work now. actions have no knowledge of transformations, whether they are in a cgi context, and only get the info that they need - eg the collection info which is needed by the xslt is now gathered by the receptionist. there are several types of receptionists now: Receptionist is a very basic one, which just puts the request and response into a page and returns that. TransformingReceptionist keeps a list of xslt needed for each action, and transforms the result before sending it back. WebReceptionist has cgi args info, and adds shortnames to params, and turns shortnames back to long names when the requests come in. it also adds config and display info to teh page before transforming it. DefaultReceptionist is the greenstone default - its a web receptionist that adds in some extra info to teh page - collection description. NZDLReceptionist is the one for NZDL. it inherits from DefaultREceptionist and adds some more info to the page - needed for the navigation bar.

  • Property svn:keywords set to Author Date Id Revision
File size: 1.8 KB
Line 
1package org.greenstone.gsdl3.core;
2
3import org.greenstone.gsdl3.util.*;
4import org.greenstone.gsdl3.action.*;
5// XML classes
6import org.w3c.dom.Node;
7import org.w3c.dom.NodeList;
8import org.w3c.dom.Document;
9import org.w3c.dom.Element;
10
11// other java classes
12import java.io.File;
13import java.util.HashMap;
14import java.util.Enumeration;
15
16/** core class for web interface generation. Receives requests consisting
17 * of an xml representation of cgi args, and returns the page of data - in
18 * html by default. The requests are processed by the appropriate action class
19 *
20 * @see Action
21 */
22public class WebReceptionist extends TransformingReceptionist {
23
24 /** the set up variables */
25
26 /** the cgi args converter */
27 protected GSCGI cgi = null;
28
29 public void setCGI(GSCGI cgi) {
30 this.cgi=cgi;
31 }
32
33 protected void preProcessRequest(Element request) {
34 // convert cgi short names to long names in the param list
35 Element param_list = (Element)GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
36 if (param_list!=null) {
37 if (!this.cgi.paramListToLongNames(param_list)) {
38 System.err.println("Receptionist Error: couldn't convert short names to long names in the param list!");
39
40 }
41 }
42 }
43
44 // need to modify some param lists
45 protected Element transformPage(Element page) {
46
47 Element page_response = (Element)GSXML.getChildByTagName(page, GSXML.PAGE_RESPONSE_ELEM);
48 // look for a service description
49 Element service = (Element)GSXML.getChildByTagName(page_response, GSXML.SERVICE_ELEM);
50 if (service != null) {
51 // look for a param-list
52 Element param_list = (Element)GSXML.getChildByTagName(service, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
53 if (param_list != null) {
54
55 // add in cgi short names
56 this.cgi.paramListAddShortNames(param_list);
57 }
58 }
59 return super.transformPage(page);
60 }
61
62}
Note: See TracBrowser for help on using the repository browser.