|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.request.Request
public abstract class Request
Request object.
Constructor Summary | |
---|---|
Request()
|
Method Summary | |
---|---|
Request |
cloneWithUrl(Url url)
Returns request with specified URL and same POST parameters as this request. |
abstract java.nio.charset.Charset |
getCharset()
Gets charset of the request |
abstract Url |
getClientUrl()
Returns the url against which the client, usually the browser, will resolve relative urls in the rendered markup. |
abstract java.lang.Object |
getContainerRequest()
Provides access to the low-level container request object that implementaion of this Request delegate to. |
java.lang.String |
getContextPath()
Returns the context path or an empty string if the application is running under root context. |
java.lang.String |
getFilterPath()
Returns the path to which wicket Filter is mapped or an empty string if the filter is mapped to /* . |
abstract java.util.Locale |
getLocale()
Returns locale for this request. |
Url |
getOriginalUrl()
In case this request has been created using cloneWithUrl(Url) , this method should
return the original URL. |
IRequestParameters |
getPostParameters()
|
java.lang.String |
getPrefixToContextPath()
Returns prefix from Wicket Filter mapping to context path. |
IRequestParameters |
getQueryParameters()
|
IRequestParameters |
getRequestParameters()
|
abstract Url |
getUrl()
Returns the URL for this request. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Request()
Method Detail |
---|
public abstract Url getUrl()
public abstract Url getClientUrl()
Under normal circumstances the client and request (getUrl()
) urls are the same.
Handling an Ajax request, however, is a good example of when they may be different.
Technologies such as XHR are free to request whatever url they wish without
modifying the client url; however, any produced urls will be evaluated by the client
against the client url - not against the request url.
Lets take a simple example:
Suppose we are on a client detail page. This page contains an Ajax link which opens a list of
client's orders. Each order has a link that goes to the order detail page.
The client detail page is located at
/detail/customer/15and the order detail page is located at
/order/22The Ajax link which renders the detail section is located at
/detail/wicket?page 3Lets run through the execution and see what happens when the XHR request is processed:
request 1: /details/customer/15 client url: details/customer/15 (the url in the browser's address bar) request url: details/customer/15 Wicket renders relative Ajax details anchor as ../../wicket/page?3 ../../wicket/page?3 resolved against current client url details/customer/15 yields: request 2: /wicket/page?3 client url: customer/15 (unchanged since XHRs requests dont change it) request url: wicket/ajax/page?3 now Wicket has to render a relative url to /details/order/22. If Wicket renders it against the request url it will be: ../order/22, and later evaluated on the client will result in /customer/order/22 which is incorrect.This is why implementations of
Request
must track the client url, so that relative
urls can be rendered against the same url they will be evaluated against on the client -
which is not always the same as the request url. For example, Wicket's Ajax implementation
always sends the current client url in a header along with the XHR request so that Wicket can
correctly render relative urls against it.
public Url getOriginalUrl()
cloneWithUrl(Url)
, this method should
return the original URL.
public IRequestParameters getPostParameters()
public IRequestParameters getQueryParameters()
public IRequestParameters getRequestParameters()
public abstract java.util.Locale getLocale()
public Request cloneWithUrl(Url url)
url
- Url instance
public java.lang.String getPrefixToContextPath()
For example if Wicket filter is mapped to hello/* this method should return ../ regardless of actual URL (after Wicket filter)
public java.lang.String getContextPath()
public java.lang.String getFilterPath()
/*
. Returned path, unless an empty string, will always start with a slash and will
never end with a slash.
public abstract java.nio.charset.Charset getCharset()
public abstract java.lang.Object getContainerRequest()
Request
delegate to. This allows users to access features provided by the container
requests but not by generalized Wicket Request
objects.
null
if none
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |