Ignore:
Timestamp:
2018-09-13T14:18:16+12:00 (6 years ago)
Author:
kjdon
Message:

replacing hard coded param names with static string variables. set up save params for those params we need to save to the session.

File:
1 edited

Legend:

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

    r30834 r32453  
    2121// greenstone classes
    2222import java.lang.reflect.Method;
     23import java.util.ArrayList;
    2324import java.util.HashMap;
    2425
     
    3031import org.greenstone.gsdl3.util.Dictionary;
    3132import org.greenstone.gsdl3.util.GSFile;
     33import org.greenstone.gsdl3.util.GSParams;
    3234import org.greenstone.gsdl3.util.GSPath;
    3335import org.greenstone.gsdl3.util.GSXML;
     
    9597    protected HashMap<String, Node> format_info_map = null;
    9698
     99  /** the list of cgi params that this services are looking for, that need saving in the session */
     100  protected ArrayList<String> save_params = null;
     101  protected ArrayList<String> sensitive_params = null;
    97102    protected Element _globalFormat = null;
    98103
     
    159164    }
    160165
     166  public boolean addServiceParameters(GSParams params) {
     167
     168    if (params == null) {
     169      logger.error("params is null!!!");
     170      return false;
     171    }
     172   
     173    for (int i=0; i<save_params.size(); i++) {
     174      logger.error("adding save param "+save_params.get(i));
     175      params.addServiceParameter(save_params.get(i), "", true, false);
     176    }
     177    for (int i=0; i<sensitive_params.size(); i++) {
     178      params.addServiceParameter(sensitive_params.get(i), "",   false, true);
     179    }
     180    return true;
     181
     182  }
    161183    /** the no-args constructor */
    162184    public ServiceRack()
     
    166188        this.short_service_info = this.desc_doc.createElement(GSXML.SERVICE_ELEM + GSXML.LIST_MODIFIER);
    167189        this.format_info_map = new HashMap<String, Node>();
     190        this.save_params = new ArrayList<String>();
     191        this.sensitive_params = new ArrayList<String>();
    168192    }
    169193
Note: See TracChangeset for help on using the changeset viewer.