Changeset 4986 for trunk/gsdl3
- Timestamp:
- 2003-07-21T09:32:15+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/LibraryServlet.java
r4690 r4986 27 27 28 28 /** the receptionist to send messages to */ 29 protected WebReceptionist recept=null;29 protected Receptionist recept=null; 30 30 /** the default language - is specified by setting a servlet param, 31 31 * otherwise DEFAULT_LANG is used*/ … … 40 40 /** the cgi stuff - the Receptionist can add new args to this 41 41 * its used by the servlet to determine what args to save */ 42 protected GSCGI cgi = null; 42 //protected GSCGI cgi = null; 43 protected GSParams params = null; 43 44 /** initialise the servlet 44 45 */ … … 77 78 // new message router - create it and pass reference to recept. 78 79 // the servlet wont use this directly 79 String mr_name = (String)config.getInitParameter("messagerouter ");80 String mr_name = (String)config.getInitParameter("messagerouter_class"); 80 81 MessageRouter message_router = null; 81 82 if (mr_name == null) { // just use the normal MR … … 96 97 97 98 // the receptionist -the servlet will talk to this 98 String recept_name = (String)config.getInitParameter("receptionist ");99 String recept_name = (String)config.getInitParameter("receptionist_class"); 99 100 if (recept_name == null) { 100 101 this.recept = new DefaultReceptionist(); 101 102 } else { 102 103 try { 103 this.recept = ( WebReceptionist)Class.forName("org.greenstone.gsdl3.core."+recept_name).newInstance();104 this.recept = (Receptionist)Class.forName("org.greenstone.gsdl3.core."+recept_name).newInstance(); 104 105 } catch (Exception e) { // cant use this new one, so use normal one 105 106 System.out.println("LibraryServlet configure exception when trying to use a new Receptionist "+recept_name+": "+e.getMessage()); … … 110 111 this.recept.setConfigParams(config_params); 111 112 this.recept.setMessageRouter(message_router); 112 this.recept.configure(); 113 // the cgi arg thingy 114 115 String cgi_name = (String)config.getInitParameter("cgiargs"); 116 if (cgi_name == null) { 117 this.cgi = new GSCGI(); 113 // the params arg thingy 114 115 String params_name = (String)config.getInitParameter("params_class"); 116 if (params_name == null) { 117 this.params = new GSParams(); 118 118 } else { 119 119 try { 120 this. cgi = (GSCGI)Class.forName("org.greenstone.gsdl3.util."+cgi_name).newInstance();120 this.params = (GSParams)Class.forName("org.greenstone.gsdl3.util."+params_name).newInstance(); 121 121 } catch (Exception e) { 122 System.out.println("LibraryServlet configure exception when trying to use a new cgi thing "+cgi_name+": "+e.getMessage());122 System.out.println("LibraryServlet configure exception when trying to use a new params thing "+params_name+": "+e.getMessage()); 123 123 e.printStackTrace(); 124 this. cgi = new GSCGI();124 this.params = new GSParams(); 125 125 } 126 126 } 127 127 // pass it to the receptionist 128 this.recept.setCGI(this.cgi); 128 this.recept.setParams(this.params); 129 this.recept.configure(); 130 129 131 } 130 132 … … 147 149 PrintWriter out = response.getWriter(); 148 150 149 String lang = request.getParameter(GS CGI.LANGUAGE_ARG);151 String lang = request.getParameter(GSParams.LANGUAGE); 150 152 if (lang==null || lang.equals("")) { 151 153 // try the session cached lang 152 lang = (String)session.getAttribute(GS CGI.LANGUAGE_ARG);154 lang = (String)session.getAttribute(GSParams.LANGUAGE); 153 155 if (lang==null || lang.equals("")) { 154 156 // still not set, use the default … … 158 160 159 161 // set the lang in the session 160 session.setAttribute(GS CGI.LANGUAGE_ARG, lang);161 162 String output = request.getParameter(GS CGI.OUTPUT_ARG);162 session.setAttribute(GSParams.LANGUAGE, lang); 163 164 String output = request.getParameter(GSParams.OUTPUT); 163 165 if (output==null || output.equals("")) { 164 166 output = "html"; // uses html by default … … 172 174 173 175 174 String action = request.getParameter(GS CGI.ACTION_ARG);175 String subaction = request.getParameter(GS CGI.SUBACTION_ARG);176 String action = request.getParameter(GSParams.ACTION); 177 String subaction = request.getParameter(GSParams.SUBACTION); 176 178 if (action==null || action.equals("")) { 177 179 // should we do all the following stuff if using default page? … … 197 199 while(params.hasMoreElements()) { 198 200 String name = (String)params.nextElement(); 199 if (!name.equals(GS CGI.ACTION_ARG) && !name.equals(GSCGI.SUBACTION_ARG) && !name.equals(GSCGI.LANGUAGE_ARG) && !name.equals(GSCGI.OUTPUT_ARG)) {// we have already dealt with these201 if (!name.equals(GSParams.ACTION) && !name.equals(GSParams.SUBACTION) && !name.equals(GSParams.LANGUAGE) && !name.equals(GSParams.OUTPUT)) {// we have already dealt with these 200 202 String value=""; 201 203 String [] values = request.getParameterValues(name); … … 207 209 } 208 210 // either add it to the param list straight away, or save it to the session and add it later 209 if (this. cgi.shouldSave(name)) {211 if (this.params.shouldSave(name)) { 210 212 session.setAttribute(name, value); 211 213 } else { … … 223 225 String name = (String)params.nextElement(); 224 226 225 if ( !name.equals(GS CGI.LANGUAGE_ARG) ) { // lang is stored but we dont want it in the param list cos its already in the request227 if ( !name.equals(GSParams.LANGUAGE) ) { // lang is stored but we dont want it in the param list cos its already in the request 226 228 227 229 Element param = this.doc.createElement(GSXML.PARAM_ELEM);
Note:
See TracChangeset
for help on using the changeset viewer.