Package org.apache.wicket.request.http
Class WebRequest
- java.lang.Object
-
- org.apache.wicket.request.Request
-
- org.apache.wicket.request.http.WebRequest
-
public abstract class WebRequest extends Request
Base class for request that provides additional web-related information.- Author:
- Matej Knopp, Igor Vaynberg
-
-
Field Summary
Fields Modifier and Type Field Description static StringHEADER_AJAXmarker for Ajax requestsstatic StringHEADER_AJAX_BASE_URLmarker for Ajax-relative urlstatic StringHEADER_ORIGINOriginhttp headerstatic StringHEADER_REFERERRefererhttp headerstatic StringPARAM_AJAXmarker for Ajax requestsstatic StringPARAM_AJAX_BASE_URLmarker for Ajax-relative urlstatic StringPARAM_AJAX_REQUEST_ANTI_CACHEanti-cache query parameter added by Wicket.Ajax.Request at its URL
-
Constructor Summary
Constructors Constructor Description WebRequest()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description WebRequestcloneWithUrl(Url url)Returns request with specified URL and same POST parameters as this request.javax.servlet.http.CookiegetCookie(String cookieName)abstract List<javax.servlet.http.Cookie>getCookies()abstract InstantgetDateHeader(String name)Returns the value of the specified request header as alongvalue that represents aDateobject.abstract StringgetHeader(String name)Returns the value of the specified request header as aStringabstract List<String>getHeaders(String name)Returns all the values of the specified request header.InstantgetIfModifiedSinceHeader()Convenience method for retrieving If-Modified-Since header.booleanisAjax()Returns whether this request is an Ajax request.booleanshouldPreserveClientUrl()Signals whether or not request processing should preserve the current client url - in other words, handle this request without redirecting.-
Methods inherited from class org.apache.wicket.request.Request
getCharset, getClientUrl, getContainerRequest, getContextPath, getFilterPath, getLocale, getOriginalUrl, getPostParameters, getPrefixToContextPath, getQueryParameters, getRequestParameters, getUrl
-
-
-
-
Field Detail
-
PARAM_AJAX
public static final String PARAM_AJAX
marker for Ajax requests- See Also:
- Constant Field Values
-
HEADER_AJAX
public static final String HEADER_AJAX
marker for Ajax requests- See Also:
- Constant Field Values
-
PARAM_AJAX_BASE_URL
public static final String PARAM_AJAX_BASE_URL
marker for Ajax-relative url- See Also:
- Constant Field Values
-
HEADER_AJAX_BASE_URL
public static final String HEADER_AJAX_BASE_URL
marker for Ajax-relative url- See Also:
- Constant Field Values
-
PARAM_AJAX_REQUEST_ANTI_CACHE
public static final String PARAM_AJAX_REQUEST_ANTI_CACHE
anti-cache query parameter added by Wicket.Ajax.Request at its URL- See Also:
- Constant Field Values
-
HEADER_ORIGIN
public static final String HEADER_ORIGIN
Originhttp header- See Also:
- Constant Field Values
-
HEADER_REFERER
public static final String HEADER_REFERER
Refererhttp header- 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
nullif 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 aString- Parameters:
name-- Returns:
- string value of request header
-
getDateHeader
public abstract Instant getDateHeader(String name)
Returns the value of the specified request header as alongvalue that represents aDateobject. Use this method with headers that contain dates, such asIf-Modified-Since.- Parameters:
name-- Returns:
- date value of request header or
nullif not found
-
getIfModifiedSinceHeader
public final Instant getIfModifiedSinceHeader()
Convenience method for retrieving If-Modified-Since header.- Returns:
- date representing the header or
nullif 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:
trueif this request is an ajax request,falseotherwise.
-
shouldPreserveClientUrl
public boolean shouldPreserveClientUrl()
Signals whether or not request processing should preserve the current client url - in other words, handle this request without redirecting. By default, this method returnsfalse. For example, this method can be used to preserve the url that caused a 404 in the browser if Wicket is also responsible for rendering the 404 page. If this method returns the default value offalsethen Wicket will redirect to the bookmarkable url of the error page, instead of preserving the url that caused the 404 in the browser.- Returns:
trueif current client url should be preserved
-
cloneWithUrl
public WebRequest cloneWithUrl(Url url)
Returns request with specified URL and same POST parameters as this request.- Overrides:
cloneWithUrlin classRequest- Parameters:
url- Url instance- Returns:
- request with specified URL.
-
-