org.apache.wicket.protocol.http
Class WebRequest

java.lang.Object
  extended by org.apache.wicket.Request
      extended by org.apache.wicket.protocol.http.WebRequest
Direct Known Subclasses:
ServletWebRequest

public abstract class WebRequest
extends Request

Subclass of Request for HTTP protocol requests which holds an underlying HttpServletRequest object. 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

Constructor Summary
WebRequest()
           
 
Method Summary
 javax.servlet.http.Cookie getCookie(java.lang.String name)
          Get the requests' cookie by name
 javax.servlet.http.Cookie[] getCookies()
          Get the requests' cookies
abstract  javax.servlet.http.HttpServletRequest getHttpServletRequest()
          Gets the wrapped http servlet request object.
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 getServletPath()
          Gets the servlet path.
abstract  boolean isAjax()
          Is the request an ajax request?
abstract  WebRequest newMultipartWebRequest(Bytes maxSize)
          Create a runtime context type specific (e.g.
 
Methods inherited from class org.apache.wicket.Request
decodeURL, getPage, getPath, getRelativePathPrefixToContextRoot, getRelativePathPrefixToWicketHandler, getRelativeURL, getRequestParameters, getURL, mergeVersion, setPage, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WebRequest

public WebRequest()
Method Detail

getCookies

public javax.servlet.http.Cookie[] getCookies()
Get the requests' cookies

Returns:
Cookies

getCookie

public javax.servlet.http.Cookie getCookie(java.lang.String name)
Get the requests' cookie by name

Parameters:
name - The name of the cookie to be looked up
Returns:
A cookie, null if not found.
Since:
1.3.0-beta4

getHttpServletRequest

public abstract javax.servlet.http.HttpServletRequest getHttpServletRequest()
Gets the wrapped http servlet request object.

WARNING: it is usually a bad idea to depend on the http servlet request directly. Please use the classes and methods that are exposed by Wicket (such as Session instead. Send an email to the mailing list in case it is not clear how to do things or you think you miss functionality which causes you to depend on this directly.

Returns:
the wrapped http serlvet request object.

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

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

isAjax

public abstract boolean isAjax()
Is the request an ajax request?

Returns:
True if the ajax is an ajax request. False if it's not.


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.