Changeset 4242


Ignore:
Timestamp:
2003-05-08T12:11:52+12:00 (21 years ago)
Author:
kjdon
Message:

cgi args now have save data - whether or not they should be saved between pages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GSCGI.java

    r4104 r4242  
    22
    33import java.util.HashMap;
     4import java.util.HashSet;
    45import org.w3c.dom.Element;
    56import org.w3c.dom.NodeList;
     
    1516    public static final String REQUEST_TYPE_ARG = "rt"; // whether the request is just to display the service form, or to actually do a request to teh service
    1617    public static final String REQUEST_ONLY_ARG = "ro"; // if == 1 do the request and pass back the xml - no page formatting
     18    public static final String RESPONSE_ONLY_ARG = "ro"; // if == 1 do the request and pass back the response xml - no page formatting
    1719    public static final String OUTPUT_ARG = "o"; // if processing is to be done, what type of output - html/xml/other??
    1820    public static final String SERVICE_ARG = "s"; // the name of the service
     
    2426    public static final String PROCESS_ID_ARG = "pid"; // if a request wasn't completed, this identifies the request - used when asking for a status update
    2527   
     28    public static final String SIBLING_ARG = "sib"; // this should not be in here
    2629    // internal configure args
    2730    public static final String STATUS_SUBSET_ARG = "ss";
    2831    public static final String STATUS_MODULE_NAME_ARG = "sn";
    2932    public static final String STATUS_MODULE_TYPE_ARG = "st";
     33
     34    public static final String HITS_PER_PAGE_ARG = "hp";
     35    public static final String HITS_NUMBER_ARG = "hn";
    3036    /** long to short mapping */
    3137    protected HashMap long_map_=null;
    3238    /** short to long mapping */
    3339    protected HashMap short_map_=null;
     40    /** map for save data */
     41    protected HashSet save_set_ = null;
    3442   
    3543    /** initialises the maps with known parameters */
     
    3745    long_map_ = new HashMap();
    3846    short_map_ = new HashMap();
     47    save_set_ = new HashSet();
    3948
    4049    // initialize with the ones we know about
    41     addStaticParam(ACTION_ARG);
    42     addStaticParam(SUBACTION_ARG);
    43     addStaticParam(REQUEST_TYPE_ARG);
    44     addStaticParam(REQUEST_ONLY_ARG);
    45     addStaticParam(CLUSTER_ARG);
    46     addStaticParam(COLLECTION_ARG);
    47     addStaticParam(LANGUAGE_ARG);
    48     addStaticParam(DOCUMENT_ARG);
    49     addStaticParam(RESOURCE_ARG);
    50     addStaticParam(OUTPUT_ARG);
    51     addStaticParam(SERVICE_ARG);
    52     addStaticParam(PROCESS_ID_ARG);
    53     addStaticParam(STATUS_SUBSET_ARG);
    54     addStaticParam(STATUS_MODULE_NAME_ARG);
    55     addStaticParam(STATUS_MODULE_TYPE_ARG);
     50    addStaticParam(ACTION_ARG, false);
     51    addStaticParam(SUBACTION_ARG, false);
     52    addStaticParam(REQUEST_TYPE_ARG, false);
     53    addStaticParam(REQUEST_ONLY_ARG, false);
     54    addStaticParam(CLUSTER_ARG, true);
     55    //addStaticParam(COLLECTION_ARG);
     56    addStaticParam(LANGUAGE_ARG, true);
     57    addStaticParam(DOCUMENT_ARG, true);
     58    addStaticParam(RESOURCE_ARG, true);
     59    addStaticParam(OUTPUT_ARG, false);
     60    addStaticParam(SERVICE_ARG, true);
     61    addStaticParam(PROCESS_ID_ARG, true);
     62    addStaticParam(STATUS_SUBSET_ARG, true);
     63    addStaticParam(STATUS_MODULE_NAME_ARG, true);
     64    addStaticParam(STATUS_MODULE_TYPE_ARG, true);
     65    addStaticParam(SIBLING_ARG, false);
     66    addStaticParam(HITS_PER_PAGE_ARG, true);
    5667    }
    5768
    5869    /* static params - have only one form */
    59     public boolean addStaticParam(String param) {
    60     return addParam(param, param);
     70    public boolean addStaticParam(String param, boolean save) {
     71    return addParam(param, param, save);
    6172    }
    6273    /** adds another param to teh list
    6374     * should check that its not already present? */
    64     public boolean addParam(String long_name, String short_name) {
     75    public boolean addParam(String long_name, String short_name, boolean save) {
    6576    long_map_.put(long_name, short_name);
    6677    short_map_.put(short_name, long_name);
     78    if (save) { // used by servlet, so use short names
     79        save_set_.add(short_name);
     80    }
    6781    return true;
    6882    }
     
    121135    // else need to create a new mapping
    122136    String short_name = newShortName(long_name);
    123     long_map_.put(long_name, short_name);
    124     short_map_.put(short_name, long_name);
     137    addParam(long_name, short_name, true);
    125138    return short_name;
    126139    }
     
    140153   
    141154    }
     155    public boolean shouldSave(String name) {
     156    return save_set_.contains(name);
     157   
     158    }
    142159}
    143160
Note: See TracChangeset for help on using the changeset viewer.