Ignore:
Timestamp:
2019-05-17T10:26:39+12:00 (5 years ago)
Author:
kjdon
Message:

looking up default param values when start a new session to see if any have been set by Recept or MR. to set, add <format><paramDefault name='x' value='v'/> into interfaceConfig or siteConfig

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/LibraryServlet.java

    r33083 r33090  
    8989     * the cgi stuff - the Receptionist can add new args to this
    9090     *
    91      * its used by the servlet to determine what args to save
     91     * its used by the servlet to determine what args to save,
     92     * and to set default values
    9293     */
    93     protected GSParams params = null;
     94    protected GSParams gs_params = null;
    9495
    9596    /**
     
    222223        if (params_name == null)
    223224        {
    224             this.params = new GSParams();
     225            this.gs_params = new GSParams();
    225226        }
    226227        else
     
    228229            try
    229230            {
    230                 this.params = (GSParams) Class.forName("org.greenstone.gsdl3.util." + params_name).newInstance();
     231                this.gs_params = (GSParams) Class.forName("org.greenstone.gsdl3.util." + params_name).newInstance();
    231232            }
    232233            catch (Exception e)
     
    234235                System.err.println("LibraryServlet configure exception when trying to use a new params thing " + params_name + ": " + e.getMessage());
    235236                e.printStackTrace();
    236                 this.params = new GSParams();
     237                this.gs_params = new GSParams();
    237238            }
    238239        }
     
    263264            message_router.setSiteName(site_name);
    264265            message_router.setLibraryName(library_name);
    265             message_router.setParams(this.params);
     266            message_router.setParams(this.gs_params);
    266267            message_router.configure();
    267268            this.recept.setMessageRouter(message_router);
     
    298299
    299300        // pass params to the receptionist
    300         this.recept.setParams(this.params);
     301        this.recept.setParams(this.gs_params);
    301302        this.recept.configure();
    302303
     
    649650                session_ids_table.put(sid, session_cache);
    650651                session.setAttribute(GSXML.USER_SESSION_CACHE_ATT, session_cache);
    651                 //logger.info("new session id");
     652
     653                // here we add in default params?
     654                ArrayList<String> defp = this.gs_params.getParamsWithDefaults();
     655                Iterator i = this.gs_params.getParamsWithDefaults().iterator();
     656                while (i.hasNext()) {
     657                    String p = (String)i.next();
     658                    String v = this.gs_params.getParamDefault(p);
     659                    if (!p.equals(GSParams.ACTION) && !p.equals(GSParams.SUBACTION) && !p.equals(GSParams.LANGUAGE) && !p.equals(GSParams.OUTPUT)) {
     660                    table.put(p,v);
     661                    }
     662                }
     663               
    652664            }
    653665        }
     
    693705                    }
    694706                    // either add it to the param list straight away, or save it to the session and add it later
    695                     if (this.params.shouldSave(name) && table != null)
     707                    if (this.gs_params.shouldSave(name) && table != null)
    696708                    {
    697709                        table.put(name, value);
     
    702714                        param.setAttribute(GSXML.NAME_ATT, name);
    703715                        param.setAttribute(GSXML.VALUE_ATT, GSXML.xmlSafe(value));
    704                         if (this.params.isSensitive(name)) {
     716                        if (this.gs_params.isSensitive(name)) {
    705717                          param.setAttribute(GSXML.SENSITIVE_ATT, "true");
    706718                        }
Note: See TracChangeset for help on using the changeset viewer.