Ignore:
Timestamp:
2011-06-07T17:12:57+12:00 (13 years ago)
Author:
sjm84
Message:

Fixed a potential problem with the new hhf cgi parameter

File:
1 edited

Legend:

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

    r24054 r24118  
    566566       
    567567        //Add custom HTTP headers if requested
    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++)
    574             {
    575                 Map nameValueMap = (Map)httpHeaders.get(j);
    576                 String name = (String)nameValueMap.get("name");
    577                 String value = (String)nameValueMap.get("value");
     568        String httpHeadersParam = request.getParameter(GSParams.HTTPHEADERFIELDS);
     569        if (httpHeadersParam != null && httpHeadersParam.length() > 0)
     570        {
     571            Gson gson = new Gson();
     572            Type type = new TypeToken<List<Map<String,String>>>() {}.getType();
     573            List<Map<String,String>> httpHeaders = gson.fromJson(httpHeadersParam, type);
     574            if (httpHeaders != null && httpHeaders.size() > 0) {
    578575               
    579                 if(name != null && value != null)
     576                for(int j = 0; j < httpHeaders.size(); j++)
    580577                {
    581                     response.setHeader(name, value);
     578                    Map nameValueMap = (Map)httpHeaders.get(j);
     579                    String name = (String)nameValueMap.get("name");
     580                    String value = (String)nameValueMap.get("value");
     581                   
     582                    if(name != null && value != null)
     583                    {
     584                        response.setHeader(name, value);
     585                    }
    582586                }
    583587            }
Note: See TracChangeset for help on using the changeset viewer.