Weaver 3.1.0a1-D1

com.oldlight.weaver.interpreter
Class WeaverRequestContextImpl

java.lang.Object
  extended bycom.oldlight.weaver.interpreter.WeaverRequestContextImpl
All Implemented Interfaces:
WeaverRequestContext

public class WeaverRequestContextImpl
extends Object
implements WeaverRequestContext

Representation of a request (GET/POST) in Weaver.

Author:
Paul Harvey

Field Summary
private  Map cookiesMap
           
private  Map headerMap
           
private  Map headerValuesMap
           
private  Map parameterMap
           
private  Map parameterValuesMap
           
private  HttpServletRequest request
           
private  HashMap uploadedFiles
           
 
Constructor Summary
WeaverRequestContextImpl(HttpServletRequest theRequest)
          Create a new WeaverRequestContextImpl.
 
Method Summary
 void addUploadedFile(WeaverUploadedFileImpl uploadedFile)
           
 void cleanUpUploadedFiles()
           
 Object getAttribute(String name)
          Get a request scoped attribute.
 Map getAttributeMap()
          Get a map of request scoped attribute names to values.
 String getCharacterEncoding()
          Returns the character encoding associated with the request.
 int getContentLength()
          Get the length of the request.
 String getContentType()
          Returns the content type (MIME type) associated with the request.
 Cookie[] getCookies()
          Returns the Cookies associated with the request.
 Map getCookiesMap()
           
 long getDateHeader(String name)
          Gets a named request header as a Date.
 String getHeader(String name)
          Gets a named request header as a String.
 Map getHeaderMap()
          Get a map of header names to single values.
 Enumeration getHeaderNames()
          Gets an Enumeration of the names of all header associated with the request.
 Enumeration getHeaders(String name)
          Get an Enumeration of all the headers with a given name associated with the requested.
 Map getHeaderValuesMap()
          Get a map of header names to values.
 InputStream getInputStream()
          Returns an InputStream on to the request contents.
 int getIntHeader(String name)
          Gets a name request header as an int.
 Locale getLocale()
          Retruns the orimary locale associated with the request.
 Enumeration getLocales()
          Returns all locales associated with the request.
 String getParameter(String theName)
          Get a request parameter.
 Map getParameterMap()
          Get a map of parameter names to single values.
 String[] getParameterValues(String theName)
          Get a request parameter.
 Map getParameterValuesMap()
          Get a map of parameter names to multiple values.
 Reader getReader()
          Returns a Reader on to the request contents.
 WeaverUploadedFile getUploadedFile(String name)
          Get an uploaded file
 Map getUploadedFilesMap()
           
 void removeAttribute(String name)
          Remove a scoped attribute.
 void setAttribute(String name, Object value)
          Set a request scoped attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

request

private HttpServletRequest request

uploadedFiles

private HashMap uploadedFiles

parameterMap

private Map parameterMap

parameterValuesMap

private Map parameterValuesMap

headerMap

private Map headerMap

headerValuesMap

private Map headerValuesMap

cookiesMap

private Map cookiesMap
Constructor Detail

WeaverRequestContextImpl

public WeaverRequestContextImpl(HttpServletRequest theRequest)
Create a new WeaverRequestContextImpl.

Parameters:
theRequest - The servlet request to wrap.
Method Detail

addUploadedFile

public void addUploadedFile(WeaverUploadedFileImpl uploadedFile)

getUploadedFilesMap

public Map getUploadedFilesMap()

cleanUpUploadedFiles

public void cleanUpUploadedFiles()

getUploadedFile

public WeaverUploadedFile getUploadedFile(String name)
Description copied from interface: WeaverRequestContext
Get an uploaded file

Specified by:
getUploadedFile in interface WeaverRequestContext
Parameters:
name - The name of the parameter that contains the uploaded file.
Returns:
The uploaded file, or null if it can't be found.

getParameter

public String getParameter(String theName)
Get a request parameter. If the parameter has multiple values then the first is returned.

Specified by:
getParameter in interface WeaverRequestContext
Parameters:
theName - The name of the parameter.
Returns:
The value of the name parameter - or null if it cannot be found.

getParameterValues

public String[] getParameterValues(String theName)
Get a request parameter. All values of the parameter are returned.

Specified by:
getParameterValues in interface WeaverRequestContext
Parameters:
theName - The name of the parameter to retrieve.
Returns:
The values of the named parameter.

getParameterMap

public Map getParameterMap()
Get a map of parameter names to single values. (This method is used by the EL variable resolver).

Returns:
The requested map.

getParameterValuesMap

public Map getParameterValuesMap()
Get a map of parameter names to multiple values. (This method is used by the EL variable resolver).

Returns:
The requested map.

setAttribute

public void setAttribute(String name,
                         Object value)
Set a request scoped attribute.

Specified by:
setAttribute in interface WeaverRequestContext
Parameters:
name - The name of the attribute to set.
value - The value to set the attribute to.

getAttribute

public Object getAttribute(String name)
Get a request scoped attribute.

Specified by:
getAttribute in interface WeaverRequestContext
Parameters:
name - The name of the attribute to retrieve.
Returns:
The request attribute value - or null if it cannot be found.

removeAttribute

public void removeAttribute(String name)
Remove a scoped attribute.

Specified by:
removeAttribute in interface WeaverRequestContext
Parameters:
name - The name of the attribute to remove.

getAttributeMap

public Map getAttributeMap()
Get a map of request scoped attribute names to values.

Returns:
The requested map.

getContentType

public String getContentType()
Returns the content type (MIME type) associated with the request.

Specified by:
getContentType in interface WeaverRequestContext
Returns:
The requested content type.

getCharacterEncoding

public String getCharacterEncoding()
Returns the character encoding associated with the request.

Specified by:
getCharacterEncoding in interface WeaverRequestContext
Returns:
The requested character encoding.

getLocale

public Locale getLocale()
Retruns the orimary locale associated with the request.

Specified by:
getLocale in interface WeaverRequestContext
Returns:
The requests locale.

getLocales

public Enumeration getLocales()
Returns all locales associated with the request.

Specified by:
getLocales in interface WeaverRequestContext
Returns:
The requested locales.

getReader

public Reader getReader()
                 throws WeaverException
Returns a Reader on to the request contents.

Returns:
The requested Reader.
Throws:
WeaverException

getInputStream

public InputStream getInputStream()
                           throws WeaverException
Returns an InputStream on to the request contents.

Returns:
The requested InputStream.
Throws:
WeaverException

getCookies

public Cookie[] getCookies()
Returns the Cookies associated with the request.

Specified by:
getCookies in interface WeaverRequestContext
Returns:
The requested Cookies.

getDateHeader

public long getDateHeader(String name)
Gets a named request header as a Date.

Specified by:
getDateHeader in interface WeaverRequestContext
Parameters:
name - The name of the header to retrieve.
Returns:
Value of the named header, or null if the header cannot be found.

getHeader

public String getHeader(String name)
Gets a named request header as a String.

Specified by:
getHeader in interface WeaverRequestContext
Parameters:
name - The name of the header to retrieve.
Returns:
Value of the named header, or null if the header cannot be found.

getIntHeader

public int getIntHeader(String name)
Gets a name request header as an int.

Specified by:
getIntHeader in interface WeaverRequestContext
Parameters:
name - The name of the header to retrieve.
Returns:
Value of the named header, or null if the header cannout be found.

getHeaderNames

public Enumeration getHeaderNames()
Gets an Enumeration of the names of all header associated with the request.

Specified by:
getHeaderNames in interface WeaverRequestContext
Returns:
The requested Enumeration.

getHeaders

public Enumeration getHeaders(String name)
Get an Enumeration of all the headers with a given name associated with the requested.

Specified by:
getHeaders in interface WeaverRequestContext
Parameters:
name - Name of the headers to retrieve.
Returns:
The requestsed headers.

getHeaderMap

public Map getHeaderMap()
Get a map of header names to single values. (This method is used by the EL variable resolver).

Returns:
The requested map.

getHeaderValuesMap

public Map getHeaderValuesMap()
Get a map of header names to values. (This method is used by the EL variable resolver)

Returns:
The requested map.

getContentLength

public int getContentLength()
Get the length of the request.

Specified by:
getContentLength in interface WeaverRequestContext
Returns:
The requested length.

getCookiesMap

public Map getCookiesMap()

Copyright ©Paul Harvey