com.endeca.infront.cartridge
Class RequestParamMarshaller

java.lang.Object
  extended by com.endeca.infront.cartridge.RequestParamMarshaller
Direct Known Subclasses:
DimensionSearchResultsRequestParamMarshaller, NavigationContainerRequestParamMarshaller, RefinementMenuRequestParamMarshaller, ResultsListRequestParamMarshaller, SearchAdjustmentsRequestParamMarshaller

public class RequestParamMarshaller
extends Object

A class that transforms request parameter values into a ContentItem.


Field Summary
protected  javax.servlet.http.HttpServletRequest mRequest
           
protected  Map<String,String> mRequestMap
           
 
Constructor Summary
RequestParamMarshaller()
           
 
Method Summary
static void convertToBoolean(ContentItem item, String key)
          Helper method for converting the String value associated with a key to a boolean.
static void convertToInt(ContentItem item, String key)
          Helper method for converting the String value associated with a key to an integer.
static void convertToList(ContentItem item, String key)
          Helper method for converting a pipe delimited String value associated with a key to a list of strings.
static void convertToLong(ContentItem item, String key)
          Helper method for converting the String value associated with a key to a long.
 ContentItem marshall()
          Creates a new ContentItem and populates it with information from the HttpServletRequest.
 void override(ContentItem contentItem)
          Helper method for layering a ContentItem on top of another ContentItem.
 void setHttpServletRequest(javax.servlet.http.HttpServletRequest pRequest)
          Sets the current servlet request.
 void setRequestMap(Map<String,String> requestMap)
          Sets the mapping of request parameters to ContentItem keys.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mRequest

protected javax.servlet.http.HttpServletRequest mRequest

mRequestMap

protected Map<String,String> mRequestMap
Constructor Detail

RequestParamMarshaller

public RequestParamMarshaller()
Method Detail

setHttpServletRequest

public void setHttpServletRequest(javax.servlet.http.HttpServletRequest pRequest)
Sets the current servlet request.


setRequestMap

public void setRequestMap(Map<String,String> requestMap)
Sets the mapping of request parameters to ContentItem keys. For example, values in the requestMap could be "No->offset".


marshall

public ContentItem marshall()
Creates a new ContentItem and populates it with information from the HttpServletRequest. More specifically, this method iterates through the keys in the request map; for each key (URL parameter), if a corresponding value exists in the HttpServletRequest, then this method stores the value in the new ContentItem using the ContentItem key obtained from the request map.


override

public void override(ContentItem contentItem)
Helper method for layering a ContentItem on top of another ContentItem.

Parameters:
contentItem - the ContentItem to mutate by overlaying the values from another ContentItem

convertToLong

public static void convertToLong(ContentItem item,
                                 String key)
Helper method for converting the String value associated with a key to a long. If the conversion fails, the key is removed from the ContentItem so that layering of ContentItems will work (default values will be picked up).


convertToInt

public static void convertToInt(ContentItem item,
                                String key)
Helper method for converting the String value associated with a key to an integer. If the conversion fails, the key is removed from the ContentItem so that layering of ContentItems will work (default values will be picked up).


convertToBoolean

public static void convertToBoolean(ContentItem item,
                                    String key)
Helper method for converting the String value associated with a key to a boolean. Note that this method assumes that a value of "1" corresponds to true, and "0" corresponds to false. Any other values will cause the key to be removed from the ContentItem so that layering of ContentItems will work (default values will be picked up).


convertToList

public static void convertToList(ContentItem item,
                                 String key)
Helper method for converting a pipe delimited String value associated with a key to a list of strings. If the conversion fails, the key is removed from the ContentItem so that layering of ContentItems will work (default values will be picked up).



Copyright © 2012, Oracle and/or its affiliates. All rights reserved.