|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.request.target.coding.AbstractRequestTargetUrlCodingStrategy org.apache.wicket.request.target.coding.BookmarkablePageRequestTargetUrlCodingStrategy org.apache.wicket.request.target.coding.QueryStringUrlCodingStrategy
public class QueryStringUrlCodingStrategy
Encodes and decodes mounts for a single bookmarkable page class, but with the parameters appended in a URL query string rather than integrated into a URL hierarchical path.
For example, whereas
BookmarkablePageRequestTargetUrlCodingStrategy
might encode a request target as
"mywebapp/myservlet/admin/productmanagement/action/edit/product/4995",
QueryStringRequestTargetUrlCodingStrategy
would encode the same target as
"mywebapp/myservlet/admin/productmanagement?action=edit&product=4995".
URLs encoded in this way can be bookmarked just as easily as those produced by
BookmarkablePageRequestTargetUrlCodingStrategy
. For example, Google searches produce
bookmarkable links with query strings.
Whether BookmarkablePageRequestTargetUrlCodingStrategy
or
QueryStringRequestTargetUrlCodingStrategy
is appropriate for a given mount depends
on:
Regardless of which coding strategy is chosen for the mount,
BookmarkablePageLink
can be used
to insert a bookmarkable link to the request target.
This example demonstrates how to mount a path with
QueryStringRequestTargetUrlCodingStrategy
within the init
method of a
class implementing WebApplication
:
mount(new QueryStringUrlCodingStrategy("/admin/productmanagement", admin.ProductManagement.class));
Note that, as with the main BookmarkablePageRequestTargetUrlCodingStrategy, if the output of this
coding strategy is passed through
HttpServletResponse.encodeURL
and the client has cookies turned off, the client's session ID
will be stored in a path parameter, like so:"/mywebapp/myservlet/admin/productmanagement;jsessionid=730EC527564AF1C73F8C2FB19B604F55?action=edit&product=4995"
.
Field Summary |
---|
Fields inherited from class org.apache.wicket.request.target.coding.BookmarkablePageRequestTargetUrlCodingStrategy |
---|
bookmarkablePageClassRef |
Constructor Summary | |
---|---|
QueryStringUrlCodingStrategy(String mountPath,
Class bookmarkablePageClass)
Sole constructor. |
Method Summary | |
---|---|
protected void |
appendParameters(AppendingStringBuffer url,
Map parameters)
Append the parameters to the end of the URL. |
IRequestTarget |
decode(RequestParameters requestParameters)
Gets the decoded request target. |
protected ValueMap |
decodeParameters(String fragment,
Map passedParameters)
Decodes parameters object from the provided query string |
Methods inherited from class org.apache.wicket.request.target.coding.BookmarkablePageRequestTargetUrlCodingStrategy |
---|
encode, matches, toString |
Methods inherited from class org.apache.wicket.request.target.coding.AbstractRequestTargetUrlCodingStrategy |
---|
appendPathParameter, getMountPath, matches, urlDecode, urlDecodePathComponent, urlDecodeQueryComponent, urlEncode, urlEncodePathComponent, urlEncodeQueryComponent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public QueryStringUrlCodingStrategy(String mountPath, Class bookmarkablePageClass)
mountPath
- the relative reference URL on which the page is mountedbookmarkablePageClass
- the class of the mounted pageMethod Detail |
---|
protected void appendParameters(AppendingStringBuffer url, Map parameters)
appendParameters
in class AbstractRequestTargetUrlCodingStrategy
url
- the relative reference URLparameters
- parameter names mapped to parameter valuespublic IRequestTarget decode(RequestParameters requestParameters)
IRequestTargetUrlCodingStrategy
decode
in interface IRequestTargetUrlCodingStrategy
decode
in class BookmarkablePageRequestTargetUrlCodingStrategy
requestParameters
- the request parameters
IRequestTargetUrlCodingStrategy.decode(org.apache.wicket.request.RequestParameters)
protected ValueMap decodeParameters(String fragment, Map passedParameters)
decodeParameters
in class AbstractRequestTargetUrlCodingStrategy
fragment
- contains the query stringpassedParameters
- parameters decoded by wicket before this method - usually off the query string
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |