wicket.protocol.http
Class WebRequest

java.lang.Object
  extended bywicket.Request
      extended bywicket.protocol.http.WebRequest
Direct Known Subclasses:
NullWebRequest, ServletWebRequest

public abstract class WebRequest
extends Request

Subclass of Request for HTTP protocol requests which holds an underlying HttpServletRequest object. A NULL request object implementing all methods as NOPs is available via WebRequest#NULL. A variety of convenience methods are available that operate on the HttpServletRequest object. These methods do things such as providing access to parameters, cookies, URLs and path information.

Author:
Jonathan Locke

Field Summary
static WebRequest NULL
          Null WebRequest object that does nothing
 
Constructor Summary
WebRequest()
           
 
Method Summary
abstract  java.lang.String getContextPath()
          Gets the application context path.
abstract  java.util.Locale getLocale()
          Returns the preferred Locale that the client will accept content in, based on the Accept-Language header.
abstract  java.lang.String getParameter(java.lang.String key)
          Gets the request parameter with the given key.
abstract  java.util.Map getParameterMap()
          Gets the request parameters.
abstract  java.lang.String[] getParameters(java.lang.String key)
          Gets the request parameters with the given key.
abstract  java.lang.String getRelativeURL()
          Gets the relative url (url without the context path and without a leading '/').
abstract  java.lang.String getServletPath()
          Gets the servlet path.
 java.lang.String getURL()
          Retrieves the URL of this request for local use.
abstract  WebRequest newMultipartWebRequest(Bytes maxSize)
          Create a runtime context type specific (e.g.
 
Methods inherited from class wicket.Request
getPath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL

public static final WebRequest NULL
Null WebRequest object that does nothing

Constructor Detail

WebRequest

public WebRequest()
Method Detail

getContextPath

public abstract java.lang.String getContextPath()
Gets the application context path.

Returns:
application context path

getRelativeURL

public abstract java.lang.String getRelativeURL()
Gets the relative url (url without the context path and without a leading '/'). Use this method to load resources using the servlet context.

Returns:
Request URL

getServletPath

public abstract java.lang.String getServletPath()
Gets the servlet path.

Returns:
Servlet path

newMultipartWebRequest

public abstract WebRequest newMultipartWebRequest(Bytes maxSize)
Create a runtime context type specific (e.g. Servlet or Portlet) MultipartWebRequest wrapper for handling multipart content uploads.

Parameters:
maxSize - the maximum size this request may be
Returns:
new WebRequest wrapper implementing MultipartWebRequest

getLocale

public abstract java.util.Locale getLocale()
Returns the preferred Locale that the client will accept content in, based on the Accept-Language header. If the client request doesn't provide an Accept-Language header, this method returns the default locale for the server.

Specified by:
getLocale in class Request
Returns:
the preferred Locale for the client

getParameter

public abstract java.lang.String getParameter(java.lang.String key)
Gets the request parameter with the given key.

Specified by:
getParameter in class Request
Parameters:
key - Parameter name
Returns:
Parameter value

getParameterMap

public abstract java.util.Map getParameterMap()
Gets the request parameters.

Specified by:
getParameterMap in class Request
Returns:
Map of parameters

getParameters

public abstract java.lang.String[] getParameters(java.lang.String key)
Gets the request parameters with the given key.

Specified by:
getParameters in class Request
Parameters:
key - Parameter name
Returns:
Parameter values

getURL

public java.lang.String getURL()
Retrieves the URL of this request for local use.

Specified by:
getURL in class Request
Returns:
The request URL for local use, which is the context path + the relative url


Copyright © 2004-2006 Wicket developers. All Rights Reserved.