org.jboss.portal.web.impl
Class AbstractWebRequest

java.lang.Object
  extended by javax.servlet.ServletRequestWrapper
      extended by javax.servlet.http.HttpServletRequestWrapper
          extended by org.jboss.portal.web.impl.AbstractWebRequest
All Implemented Interfaces:
javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest, WebRequest
Direct Known Subclasses:
EndPointRequest

public abstract class AbstractWebRequest
extends javax.servlet.http.HttpServletRequestWrapper
implements WebRequest

Add useful information about an HttpServletRequest.

Version:
$Revision: 1.1 $
Author:
Julien Viet

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.portal.web.WebRequest
WebRequest.Verb
 
Field Summary
static org.jboss.portal.common.net.media.MediaType APPLICATION_X_WWW_FORM_URLENCODED_MEDIA_TYPE
          .
static org.jboss.portal.common.net.media.MediaType MULTIPART_FORM_DATA_MEDIA_TYPE
          .
static java.nio.charset.Charset UTF_8_CHARSET
          .
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
AbstractWebRequest(javax.servlet.http.HttpServletRequest req)
           
 
Method Summary
 Body getBody()
          Returns the body of the request when the request is of type POST otherwise return null.
 java.lang.String getBodyParameter(java.lang.String parameterName)
          Returns a parameter value from the body or null if it cannot be found.
 java.lang.String[] getBodyParameterValues(java.lang.String parameterName)
          Returns a parameter values from the body or null if it cannot be found.
 org.jboss.portal.common.net.media.MediaType getMediaType()
          Returns the media type or null if none was provided.
 java.lang.String getQueryParameter(java.lang.String parameterName)
          Returns a parameter value from the query string or null if it cannot be found.
 java.util.Map<java.lang.String,java.lang.String[]> getQueryParameterMap()
          Returns the query parameter map.
 java.lang.String[] getQueryParameterValues(java.lang.String parameterName)
          Returns a parameter values from the query string or null if it cannot be found.
 WebRequest.Verb getVerb()
          Returns the an enum instead of a string as returned by HttpServletRequest.getMethod() which is more convenient to use sometimes.
 
Methods inherited from class javax.servlet.http.HttpServletRequestWrapper
getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole
 
Methods inherited from class javax.servlet.ServletRequestWrapper
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding, setRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.portal.web.WebRequest
getWebContextPath, getWebRequestPath
 
Methods inherited from interface javax.servlet.http.HttpServletRequest
getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole
 
Methods inherited from interface javax.servlet.ServletRequest
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding
 

Field Detail

APPLICATION_X_WWW_FORM_URLENCODED_MEDIA_TYPE

public static final org.jboss.portal.common.net.media.MediaType APPLICATION_X_WWW_FORM_URLENCODED_MEDIA_TYPE
.


MULTIPART_FORM_DATA_MEDIA_TYPE

public static final org.jboss.portal.common.net.media.MediaType MULTIPART_FORM_DATA_MEDIA_TYPE
.


UTF_8_CHARSET

public static final java.nio.charset.Charset UTF_8_CHARSET
.

Constructor Detail

AbstractWebRequest

public AbstractWebRequest(javax.servlet.http.HttpServletRequest req)
                   throws java.io.UnsupportedEncodingException,
                          IllegalRequestException
Throws:
java.io.UnsupportedEncodingException
IllegalRequestException
Method Detail

getVerb

public WebRequest.Verb getVerb()
Description copied from interface: WebRequest
Returns the an enum instead of a string as returned by HttpServletRequest.getMethod() which is more convenient to use sometimes.

Specified by:
getVerb in interface WebRequest
Returns:
the verb

getQueryParameterMap

public java.util.Map<java.lang.String,java.lang.String[]> getQueryParameterMap()
Description copied from interface: WebRequest
Returns the query parameter map. If no query string was provided it returns an empty map in order to avoid to return a null object.

Specified by:
getQueryParameterMap in interface WebRequest
Returns:
the query parameter map

getBody

public Body getBody()
Description copied from interface: WebRequest
Returns the body of the request when the request is of type POST otherwise return null.

Specified by:
getBody in interface WebRequest
Returns:
the body

getMediaType

public org.jboss.portal.common.net.media.MediaType getMediaType()
Description copied from interface: WebRequest
Returns the media type or null if none was provided.

Specified by:
getMediaType in interface WebRequest
Returns:
the media type

getQueryParameter

public java.lang.String getQueryParameter(java.lang.String parameterName)
Description copied from interface: WebRequest
Returns a parameter value from the query string or null if it cannot be found.

Specified by:
getQueryParameter in interface WebRequest
Parameters:
parameterName - the parameter name
Returns:
the parameter value

getQueryParameterValues

public java.lang.String[] getQueryParameterValues(java.lang.String parameterName)
Description copied from interface: WebRequest
Returns a parameter values from the query string or null if it cannot be found.

Specified by:
getQueryParameterValues in interface WebRequest
Parameters:
parameterName - the parameter name
Returns:
the parameter value

getBodyParameter

public java.lang.String getBodyParameter(java.lang.String parameterName)
Description copied from interface: WebRequest
Returns a parameter value from the body or null if it cannot be found. If the content type of the request is not application/x-www-form-urlencoded then this method will always return null.

Specified by:
getBodyParameter in interface WebRequest
Parameters:
parameterName - the parameter name
Returns:
the parameter value

getBodyParameterValues

public java.lang.String[] getBodyParameterValues(java.lang.String parameterName)
Description copied from interface: WebRequest
Returns a parameter values from the body or null if it cannot be found. If the content type of the request is not application/x-www-form-urlencoded then this method will always return null.

Specified by:
getBodyParameterValues in interface WebRequest
Parameters:
parameterName - the parameter name
Returns:
the parameter value


Copyright © 2008. All Rights Reserved.