Changeset 24052


Ignore:
Timestamp:
05/19/11 13:38:12 (10 years ago)
Author:
sjm84
Message:

The hhf cgi parameter is now implemented using JSON, also a few other minor commits

Location:
main/trunk/greenstone3
Files:
6 edited

Legend:

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

    r24019 r24052  
    1515import java.util.ArrayList;
    1616import java.util.HashMap;
     17import java.util.List;
     18import java.util.Map;
    1719import java.io.File;
     20import java.lang.reflect.Type;
    1821import java.util.Hashtable;
    1922import org.apache.log4j.*;
     23
     24import com.google.gson.Gson;
     25import com.google.gson.reflect.TypeToken;
    2026
    2127// Apache Commons
     
    560566       
    561567        //Add custom HTTP headers if requested
    562         String httpHeaders = StringEscapeUtils.unescapeHtml4(request.getParameter(GSParams.HTTPHEADERFIELDS));
    563         if (httpHeaders!=null && !httpHeaders.equals ("")) {
    564             String[] headerParams = StringUtils.split(httpHeaders, "&");
    565            
    566             for(int j = 0; j < headerParams.length; j++)
     568        Gson gson = new Gson();
     569        Type type = new TypeToken<List<Map<String,String>>>() {}.getType();
     570        List<Map<String,String>> httpHeaders = gson.fromJson(request.getParameter(GSParams.HTTPHEADERFIELDS), type);
     571        if (httpHeaders != null && httpHeaders.size() > 0) {
     572           
     573            for(int j = 0; j < httpHeaders.size(); j++)
    567574            {
    568                 int index = StringUtils.indexOf(headerParams[j], "=");
     575                Map nameValueMap = (Map)httpHeaders.get(j);
     576                String name = (String)nameValueMap.get("name");
     577                String value = (String)nameValueMap.get("value");
    569578               
    570                 if(index != -1)
     579                System.err.println("SETTING HEADER " + name + " = " + value);
     580               
     581                if(name != null && value != null)
    571582                {
    572                     response.setHeader(StringUtils.substring(headerParams[j], 0, index), StringUtils.substring(headerParams[j], index+1));
    573                 }
    574             }
    575            
     583                    response.setHeader(name, value);
     584                }
     585            }
    576586        }
    577587       
     
    689699       
    690700    }
    691 
    692701}
  • main/trunk/greenstone3/web/WEB-INF/classes/interface_default.properties

    r24009 r24052  
    6666query.to=to
    6767query.of=of
     68
     69#query.the_term=The term
     70#query.common_word=is too common and has been excluded from the search
     71query.common=The following terms are too common and have been excluded from the search:
    6872
    6973##################
  • main/trunk/greenstone3/web/interfaces/oran/js/berrybasket/berrybasket.js

    r24018 r24052  
    2020   
    2121    var request_type = "GET";
    22     var url = "?a=pr&rt=r&ro=1&s=ItemNum&o=XML&hhf=Cache-Control%3Dno-cache&c=";
     22    var url = "?a=pr&rt=r&ro=1&s=ItemNum&o=XML&hhf=[{\"name\":\"Cache-Control\", \"value\":\"no-cache\"}]&c=";
    2323
    2424    var responseSuccess = function(o){
     
    293293function addBerry(el){
    294294    alert("ADDING");
    295     var addurl = "?a=pr&rt=r&ro=1&s=AddItem&c=&s1.id=2&o=XML&hhf=Cache-Control%3Dno-cache&s1.item=" + el.id;
     295    var addurl = "?a=pr&rt=r&ro=1&s=AddItem&c=&s1.id=2&o=XML&hhf=[{\"name\":\"Cache-Control\", \"value\":\"no-cache\"}]&s1.item=" + el.id;
    296296
    297297    var addSuccess = function(o){
  • main/trunk/greenstone3/web/interfaces/oran/js/berrybasket/ygDDPlayer.js

    r24018 r24052  
    124124
    125125var request_type = "GET";
    126 var addurlPath ="?a=pr&rt=r&ro=1&s=AddItem&c=&s1.id=2&o=XML&hhf=Cache-Control%3Dno-cache&s1.item=";
    127 var delurlPath ="?a=pr&rt=r&ro=1&s=DeleteItem&c=&o=XML&hhf=Cache-Control%3Dno-cache&s1.item=";
     126var addurlPath ="?a=pr&rt=r&ro=1&s=AddItem&c=&s1.id=2&o=XML&hhf=[{\"name\":\"Cache-Control\", \"value\":\"no-cache\"}]&s1.item=";
     127var delurlPath ="?a=pr&rt=r&ro=1&s=DeleteItem&c=&o=XML&hhf=[{\"name\":\"Cache-Control\", \"value\":\"no-cache\"}]&s1.item=";
    128128var postdata = null;
    129129
  • main/trunk/greenstone3/web/interfaces/oran/style/berry.css

    r24018 r24052  
    22    min-height: 22px;
    33    padding: 5px;
    4     /*margin: 0 0 1em 0;*/
    5     /* background: #E0F0E0 url("../images/berrybasket.png") scroll no-repeat 0 0; */
    64    background: transparent url("../images/kete2.png") scroll repeat 0 0;
    75    z-index:10;
    8     /*cursor: pointer;*/
    96    font-size: 80%;
    107    min-height: 2em;
  • main/trunk/greenstone3/web/interfaces/oran/style/core.css

    r24018 r24052  
    330330    float: right;
    331331    margin: 0;
    332     background: transparent url('../images/tab-right.gif') no-repeat scroll 100% -50px;
    333332    padding: 0 2px 0 0;
    334333}
Note: See TracChangeset for help on using the changeset viewer.