Changeset 3682
- Timestamp:
- 2003-01-17T10:45:27+13:00 (21 years ago)
- Location:
- trunk/gsdl3/src/java/org/greenstone/gsdl3/action
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/AppletAction.java
r3645 r3682 29 29 Element request = (Element)GSXML.getChildByTagName(message, GSXML.REQUEST_ELEM); 30 30 31 // subaction is display (d) or request (r)32 String request_type = request.getAttribute(GSXML.SUBACTION_ATT);33 if (!request_type.equals("d")&&!request_type.equals("r")) {34 System.err.println("AppletAction Error: the sa arg should be either d or r, instead it was "+request_type+"!");35 return null;36 }37 31 38 32 // get the collection and service param … … 40 34 HashMap params = GSXML.extractParams(cgi_param_list); 41 35 36 // request_type is display (d) or request (r) 37 String request_type = (String)params.get(GSCGI.REQUEST_TYPE_ARG); 38 if (!request_type.equals("d")&&!request_type.equals("r")) { 39 System.err.println("AppletAction Error: the rt arg should be either d or r, instead it was "+request_type+"!"); 40 return null; 41 } 42 42 43 String collection = (String)params.get(GSCGI.COLLECTION_ARG); 43 44 String service_name=(String)params.get(GSCGI.SERVICE_ARG); 44 service_name+= "Applet";45 45 46 46 String to=null; -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/BrowseAction.java
r3645 r3682 14 14 public class BrowseAction extends Action { 15 15 16 public static final String CLASSIFIER_ARG = "cl"; 17 18 /* add the action specific args to the cgi param list 19 */ 20 public void addCGIParams() { 21 cgi_.addStaticParam(CLASSIFIER_ARG); 22 } 23 24 /** process the request */ 16 25 public Element process (Element message) { 17 26 … … 28 37 29 38 30 // the browse type is the subaction 31 String browse_type = request.getAttribute(GSXML.SUBACTION_ATT);39 // the browse type is the subaction - ignore for now 40 //String browse_type = request.getAttribute(GSXML.SUBACTION_ATT); 32 41 33 if (browse_type.equals("Classifier")) {34 35 }36 return unknownBrowse(page, request, browse_type);42 //if (browse_type.equals("classifier")) { 43 return classifierBrowse(page, request); 44 //} 45 //return unknownBrowse(page, request, browse_type); 37 46 38 47 … … 54 63 HashMap params = GSXML.extractParams(cgi_paramList); 55 64 65 String service_name = (String)params.get(GSCGI.SERVICE_ARG); 56 66 String collection = (String)params.get(GSCGI.COLLECTION_ARG); 57 67 if (collection == null || collection.equals("")) { … … 71 81 72 82 String to = collection; 73 to = GSPath.appendLink(to, "ClassifierBrowse");83 to = GSPath.appendLink(to, service_name); 74 84 mr_info_request.setAttribute(GSXML.TO_ATT, to); 75 85 … … 88 98 89 99 // if there is a cl field in the cgi params, get the classifier info 90 String node = (String)params.get( "cl");100 String node = (String)params.get(CLASSIFIER_ARG); 91 101 92 102 if (node!=null && !node.equals("")) { … … 121 131 122 132 Element response = (Element)GSXML.getChildByTagName(mr_query_response, GSXML.RESPONSE_ELEM); 123 Node new_style = GSXML.getChildByTagName(response, "stylesheet");133 Node new_style = GSXML.getChildByTagName(response, GSXML.STYLESHEET_ELEM); 124 134 if (new_style !=null) { 125 135 GSXSLT.mergeStylesheets(style_doc, (Element)new_style); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/ProcessAction.java
r3645 r3682 16 16 public class ProcessAction extends Action { 17 17 18 public static final String PROCESS_ONLY_ARG="p";19 20 /** add the action specific args to the GSCGI object */21 protected void addCGIParams() {22 cgi_.addStaticParam(PROCESS_ONLY_ARG);23 24 }25 18 /** process a request */ 26 19 public Element process (Element message) { … … 28 21 // assume only one request 29 22 Element request = (Element)GSXML.getChildByTagName(message, GSXML.REQUEST_ELEM); 30 String subaction = request.getAttribute(GSXML.SUBACTION_ATT); 23 24 // we ignore the subaction for now - all types are processed by the same method 25 //String subaction = request.getAttribute(GSXML.SUBACTION_ATT); 31 26 // get the param list 32 27 Element cgi_param_list = (Element)GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); … … 34 29 String service_name = (String) params.get(GSCGI.SERVICE_ARG); 35 30 String cluster_name = (String) params.get(GSCGI.CLUSTER_ARG); 36 String process_p = (String)params.get(PROCESS_ONLY_ARG);37 boolean process_only = false;38 if ( process_p!=null) {39 process_only = (((String)params.get(PROCESS_ONLY_ARG)).equals("1")?true:false);31 String request_only_p = (String)params.get(GSCGI.REQUEST_ONLY_ARG); 32 boolean request_only = false; 33 if (request_only_p!=null) { 34 request_only = (request_only_p.equals("1")?true:false); 40 35 } 36 String request_type = (String) params.get(GSCGI.REQUEST_TYPE_ARG); 41 37 // the return page 42 38 Element page = doc_.createElement(GSXML.PAGE_ELEM); 43 39 page.setAttribute(GSXML.LANG_ATT, request.getAttribute(GSXML.LANG_ATT)); 44 40 45 // what is carried out depends on the subaction46 // if sa=d, then a describe request is done,47 // is sa=r, a request and then a describe request is done48 // if sa=s, a status request is done.41 // what is carried out depends on the request_type 42 // if rt=d, then a describe request is done, 43 // is rt=r, a request and then a describe request is done 44 // if rt=s, a status request is done. 49 45 50 // if p=1, then this calls for a process only page - we do the request51 // ( sashould be r or s) and just give the response straight back46 // if ro=1, then this calls for a process only page - we do the request 47 // (rt should be r or s) and just give the response straight back 52 48 // without any page processing 53 49 … … 55 51 String stylesheet = GSFile.stylesheetFile(config_, "process.xsl"); 56 52 57 if (! process_only) {53 if (!request_only) { 58 54 // check that the stylesheet is present 59 55 if (stylesheet==null) { 60 System.err.println("ProcessAction Error: buildstylesheet not found!");56 System.err.println("ProcessAction Error: process stylesheet not found!"); 61 57 return null; 62 58 } … … 67 63 to = GSPath.appendLink(to, service_name); 68 64 69 if (! subaction.equals("d")) {70 // if sa=s or sa=r, do the request65 if (!request_type.equals("d")) { 66 // if rt=s or rt=r, do the request 71 67 72 68 Element mr_query_message = doc_.createElement(GSXML.MESSAGE_ELEM); … … 74 70 mr_query_message.appendChild(mr_query_request); 75 71 76 if ( subaction.equals("s")) { // status72 if (request_type.equals("s")) { // status 77 73 mr_query_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_STATUS); 78 74 } else { … … 89 85 Element result_response = (Element)GSXML.getChildByTagName(mr_query_response, GSXML.RESPONSE_ELEM); 90 86 91 if ( process_only) {87 if (request_only) { 92 88 // just send the reponse as is 93 89 return result_response; … … 147 143 page.appendChild(cgi_request); 148 144 149 System.out.println("process action, page=");150 System.out.println(converter_.getString(page));151 145 // now process the page and return the result 152 146 Document style_doc = converter_.getDOM(new File(stylesheet)); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/QueryAction.java
r3645 r3682 33 33 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.CONFIGURATION_ELEM), true)); 34 34 35 // query type is the subaction 36 String query_type = request.getAttribute(GSXML.SUBACTION_ATT) + "Query"; 37 38 // for now assume all queries can be handled by basic query 39 return basicQuery(page, request, query_type); 40 35 // if want to have a different type of query here, check the subaction att of request 36 37 // for now assume all queries can be handled by basic query 38 return basicQuery(page, request); 39 41 40 } 42 41 … … 45 44 * params to the service, then gets the titles for any results 46 45 */ 47 protected Element basicQuery(Element page, Element request , String service_name) {46 protected Element basicQuery(Element page, Element request) { 48 47 49 48 // check that the stylesheet is present - cant output the page without one. … … 58 57 59 58 HashMap params = GSXML.extractParams(cgi_param_list); 60 59 60 String request_type = (String)params.get(GSCGI.REQUEST_TYPE_ARG); 61 String service_name = (String)params.get(GSCGI.SERVICE_ARG); 61 62 String collection = (String)params.get(GSCGI.COLLECTION_ARG); 62 63 if (collection == null || collection.equals("")) { … … 122 123 page.appendChild(description); 123 124 124 // now we always do the query - we have no way of knowing whether 125 // a query was specified or not cos we cant assume that q is the 126 // query string - maybe we could check that any required params have 127 // a value?? 128 125 // just a display request 126 if (request_type.equals("d")) { 127 // output the page 128 // process using the stylesheet 129 Document style_doc = converter_.getDOM(new File(stylesheet)); 130 GSXSLT.absoluteIncludePaths(style_doc, config_); 131 return (Element)transformer_.transform(style_doc, page); 132 } 133 134 // do the query 129 135 Element mr_query_message = doc_.createElement(GSXML.MESSAGE_ELEM); 130 136 Element mr_query_request = doc_.createElement(GSXML.REQUEST_ELEM);
Note:
See TracChangeset
for help on using the changeset viewer.