Milyn-Smooks Version 0.4

org.milyn.container.servlet
Class HttpServletContainerRequest

java.lang.Object
  extended byorg.milyn.container.servlet.HttpServletContainerRequest
All Implemented Interfaces:
BoundAttributeStore, ContainerRequest, HttpRequest, Request

public class HttpServletContainerRequest
extends java.lang.Object
implements ContainerRequest

Smooks ContainerRequest implementation for the HttpServlet container.

Author:
tfennelly

Constructor Summary
HttpServletContainerRequest(javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.ServletConfig servletConfig, ServletContainerContext containerContext)
          Public Constructor.
 
Method Summary
 void clearElementLists()
          Clear the list of ElementLists from this request.
 java.lang.Object getAttribute(java.lang.String name)
          Returns the object bound with the specified name in this BoundAttributeStore implementation, or null if no object is bound under the name.
 ContainerContext getContext()
          Get the container context within which this request "lives".
 java.lang.String getContextPath()
          Returns the portion of the request URI that indicates the context of the request.
 ContentDeliveryConfig getDeliveryConfig()
          Get the content delivery configuration for the useragent attached to this request.
 ElementList getElementList(java.lang.String name)
          Request utility method for "hooking" elements of the same name together within the context of a request.
 java.lang.String getHeader(java.lang.String name)
           
 java.lang.String getParameter(java.lang.String name)
           
 java.util.Enumeration getParameterNames()
          Returns an Enumeration of String objects containing the names of the parameters contained in this request.
 java.lang.String[] getParameterValues(java.lang.String name)
          Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.
 java.net.URI getRequestURI()
          Returns the full request URI made by the requesting device (including the query string).
 javax.servlet.http.HttpServletRequest getServletRequest()
          Get the HttpServletRequest instance associated with this ContainerRequest implementation.
 ContainerSession getSession()
          Get the container session within which this request "lives".
 UAContext getUseragentContext()
          Get the UAContext instance for the useragent attached to this request.
 void removeAttribute(java.lang.String name)
          Removes the object bound with the specified name from this BoundAttributeStore implementation.
 void setAttribute(java.lang.String name, java.lang.Object value)
          Binds an object to this BoundAttributeStore implementation, using the name specified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpServletContainerRequest

public HttpServletContainerRequest(javax.servlet.http.HttpServletRequest servletRequest,
                                   javax.servlet.ServletConfig servletConfig,
                                   ServletContainerContext containerContext)
                            throws UnknownDeviceException
Public Constructor.

Parameters:
servletRequest - HttpServletRequest instance.
servletConfig - ServletConfig instance.
Throws:
UnknownDeviceException - Unable to match device.
Method Detail

getContextPath

public java.lang.String getContextPath()
Description copied from interface: ContainerRequest
Returns the portion of the request URI that indicates the context of the request. The context path always comes first in a request URI. The path starts with a "/" character but does not end with a "/" character.

Specified by:
getContextPath in interface ContainerRequest
Returns:
String specifying the portion of the request URI that indicates the context of the request.

getRequestURI

public java.net.URI getRequestURI()
Description copied from interface: ContainerRequest
Returns the full request URI made by the requesting device (including the query string).

Specified by:
getRequestURI in interface ContainerRequest
Returns:
The full request URI made by the requesting device.

getHeader

public java.lang.String getHeader(java.lang.String name)
Specified by:
getHeader in interface HttpRequest

getParameter

public java.lang.String getParameter(java.lang.String name)
Specified by:
getParameter in interface HttpRequest

getParameterNames

public java.util.Enumeration getParameterNames()
Description copied from interface: ContainerRequest
Returns an Enumeration of String objects containing the names of the parameters contained in this request. If the request has no parameters, the method returns an empty Enumeration.

Specified by:
getParameterNames in interface ContainerRequest
Returns:
an Enumeration of String objects, each String containing the name of a request parameter; or an empty Enumeration if the request has no parameters.

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Description copied from interface: ContainerRequest
Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.

If the parameter has a single value, the array has a length of 1.

Specified by:
getParameterValues in interface ContainerRequest
Parameters:
name - String containing the name of the parameter whose value is requested.
Returns:
an array of String objects containing the parameter's values.

getContext

public ContainerContext getContext()
Description copied from interface: ContainerRequest
Get the container context within which this request "lives".

Specified by:
getContext in interface ContainerRequest
Returns:
The ContainerContext instance.

getSession

public ContainerSession getSession()
Description copied from interface: ContainerRequest
Get the container session within which this request "lives".

Specified by:
getSession in interface ContainerRequest
Returns:
The ContainerSession instance.

getUseragentContext

public UAContext getUseragentContext()
Description copied from interface: ContainerRequest
Get the UAContext instance for the useragent attached to this request.

Specified by:
getUseragentContext in interface ContainerRequest
Returns:
UAContext instance.

getDeliveryConfig

public ContentDeliveryConfig getDeliveryConfig()
Description copied from interface: ContainerRequest
Get the content delivery configuration for the useragent attached to this request.

Specified by:
getDeliveryConfig in interface ContainerRequest
Returns:
ContentDeliveryConfigImpl instance.

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Description copied from interface: BoundAttributeStore
Binds an object to this BoundAttributeStore implementation, using the name specified. If an object of the same name is already bound, the object is replaced.

Specified by:
setAttribute in interface BoundAttributeStore
Parameters:
name - The name to which the object is bound; cannot be null.
value - The object to be bound; cannot be null.

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Description copied from interface: BoundAttributeStore
Returns the object bound with the specified name in this BoundAttributeStore implementation, or null if no object is bound under the name.

Specified by:
getAttribute in interface BoundAttributeStore
Parameters:
name - The name to which the object is bound; cannot be null.
Returns:
The object bound with the specified name in this BoundAttributeStore implementation, or null if no object is bound under the name.

removeAttribute

public void removeAttribute(java.lang.String name)
Description copied from interface: BoundAttributeStore
Removes the object bound with the specified name from this BoundAttributeStore implementation. If the BoundAttributeStore implementation does not have an object bound with the specified name, this method does nothing.

Specified by:
removeAttribute in interface BoundAttributeStore
Parameters:
name - The name to which the object is bound; cannot be null.

getElementList

public ElementList getElementList(java.lang.String name)
Description copied from interface: ContainerRequest
Request utility method for "hooking" elements of the same name together within the context of a request.

Implementations must create the ElementList instance for the element if it doesn't exist.

Specified by:
getElementList in interface ContainerRequest
Parameters:
name - The name of the element whose ElementList is being requested.
Returns:
ElementList for the element specified by the name param.
See Also:
ContainerRequest.clearElementLists()

clearElementLists

public void clearElementLists()
Description copied from interface: ContainerRequest
Clear the list of ElementLists from this request.

Specified by:
clearElementLists in interface ContainerRequest
See Also:
ContainerRequest.getElementList(String)

getServletRequest

public javax.servlet.http.HttpServletRequest getServletRequest()
Get the HttpServletRequest instance associated with this ContainerRequest implementation.

Returns:
HttpServletRequest instance.

Milyn-Smooks Version 0.4