org.apache.wicket.request.http
Class WebRequest

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

public abstract class WebRequest
extends Request

Base class for request that provides additional web-related information.

Author:
Matej Knopp, Igor Vaynberg

Field Summary
protected static String HEADER_AJAX
          marker for Ajax requests
protected static String HEADER_AJAX_BASE_URL
          marker for Ajax-relative url
protected static String PARAM_AJAX
          marker for Ajax requests
protected static String PARAM_AJAX_BASE_URL
          marker for Ajax-relative url
 
Constructor Summary
WebRequest()
           
 
Method Summary
 WebRequest cloneWithUrl(Url url)
          Returns request with specified URL and same POST parameters as this request.
 javax.servlet.http.Cookie getCookie(String cookieName)
           
abstract  List<javax.servlet.http.Cookie> getCookies()
           
abstract  long getDateHeader(String name)
          Returns the value of the specified request header as a long value that represents a Date object.
abstract  String getHeader(String name)
          Returns the value of the specified request header as a String
abstract  List<String> getHeaders(String name)
          Returns all the values of the specified request header.
 Date getIfModifiedSinceHeader()
          Convenience method for retrieving If-Modified-Since header.
 boolean isAjax()
          Returns whether this request is an Ajax request.
 
Methods inherited from class org.apache.wicket.request.Request
getCharset, getClientUrl, getContainerRequest, getLocale, getOriginalUrl, getPostParameters, getPrefixToContextPath, getQueryParameters, getRequestParameters, getUrl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAM_AJAX

protected static final String PARAM_AJAX
marker for Ajax requests

See Also:
Constant Field Values

HEADER_AJAX

protected static final String HEADER_AJAX
marker for Ajax requests

See Also:
Constant Field Values

PARAM_AJAX_BASE_URL

protected static final String PARAM_AJAX_BASE_URL
marker for Ajax-relative url

See Also:
Constant Field Values

HEADER_AJAX_BASE_URL

protected static final String HEADER_AJAX_BASE_URL
marker for Ajax-relative url

See Also:
Constant Field Values
Constructor Detail

WebRequest

public WebRequest()
Method Detail

getCookies

public abstract List<javax.servlet.http.Cookie> getCookies()
Returns:
request cookies

getCookie

public javax.servlet.http.Cookie getCookie(String cookieName)
Parameters:
cookieName -
Returns:
cookie with specified name or null if the cookie does not exist

getHeaders

public abstract List<String> getHeaders(String name)
Returns all the values of the specified request header.

Parameters:
name -
Returns:
unmodifiable list of header values

getHeader

public abstract String getHeader(String name)
Returns the value of the specified request header as a String

Parameters:
name -
Returns:
string value of request header

getDateHeader

public abstract long getDateHeader(String name)
Returns the value of the specified request header as a long value that represents a Date object. Use this method with headers that contain dates, such as If-Modified-Since.

Parameters:
name -
Returns:
date value of request header

getIfModifiedSinceHeader

public final Date getIfModifiedSinceHeader()
Convenience method for retrieving If-Modified-Since header.

Returns:
date representing the header or null if not set

isAjax

public boolean isAjax()
Returns whether this request is an Ajax request. This implementation checks for values of "wicket-ajax" url parameter or the "Wicket-Ajax" header. Subclasses can use other approaches.

Returns:
true if this request is an ajax request, false otherwise.

cloneWithUrl

public WebRequest cloneWithUrl(Url url)
Returns request with specified URL and same POST parameters as this request.

Overrides:
cloneWithUrl in class Request
Parameters:
url - Url instance
Returns:
request with specified URL.


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