|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.protocol.http.request.WebRequestCodingStrategy
public class WebRequestCodingStrategy
Request parameters factory implementation that uses http request parameters and path info to construct the request parameters object.
Nested Class Summary | |
---|---|
static class |
WebRequestCodingStrategy.Settings
Various settings used to configure this strategy |
Field Summary | |
---|---|
static String |
BEHAVIOR_ID_PARAMETER_NAME
AJAX query parameter name |
static String |
BOOKMARKABLE_PAGE_PARAMETER_NAME
Parameter name used all over the place |
static String |
DEFAULT_PAGEMAP_NAME
Url name of the default pagemap When we encode the default pagemap name in a url we cannot always use null or "" because it breaks urls which are encoded with /param1/value1/ eg /product/14/wicket:pageMapName/ split on / will split into {product,14,wicket:pageMapName} |
static String |
IGNORE_IF_NOT_ACTIVE_PARAMETER_NAME
Parameter name that tells decode to ignore this request if the page+version encoded in the url is not on top of the stack. |
static String |
INTERFACE_PARAMETER_NAME
Name of interface target query parameter |
static String |
NAME_SPACE
Name of interface target query parameter |
static String |
PAGEMAP
Pagemap parameter constant |
static String |
RESOURCES_PATH_PREFIX
The URL path prefix expected for (so called) resources (not html pages). |
Constructor Summary | |
---|---|
WebRequestCodingStrategy()
Construct. |
|
WebRequestCodingStrategy(WebRequestCodingStrategy.Settings settings)
Construct. |
Method Summary | |
---|---|
protected void |
addBookmarkablePageParameters(Request request,
RequestParameters parameters)
Adds bookmarkable page related parameters (page alias and optionally page parameters). |
void |
addIgnoreMountPath(String path)
Partly unmounts/ignores a path that normally would map to another mount path. |
protected void |
addInterfaceParameters(Request request,
RequestParameters parameters)
Adds page related parameters (path and pagemap and optionally version and interface). |
static void |
addInterfaceParameters(String interfaceParameter,
RequestParameters parameters)
Analyzes the passed in interfaceParameter for the relevant parts and puts the parts as parameters in the provided request parameters object. |
protected void |
addResourceParameters(Request request,
RequestParameters parameters)
Adds (shared) resource related parameters (resource key). |
RequestParameters |
decode(Request request)
Analyze the request and create a corresponding request parameters object for it. |
static String |
decodePageMapName(String pageMapName)
Undoes the effect of encodePageMapName(String) |
protected String |
doEncode(RequestCycle requestCycle,
IRequestTarget requestTarget)
In case you are using custom targets that are not part of the default target hierarchy, you need to override this method, which will be called after the defaults have been tried. |
CharSequence |
encode(CharSequence url)
Returns the given url encoded. |
protected CharSequence |
encode(RequestCycle requestCycle,
IBookmarkablePageRequestTarget requestTarget)
Encode a page class target. |
protected CharSequence |
encode(RequestCycle requestCycle,
IListenerInterfaceRequestTarget requestTarget)
Encode a listener interface target. |
protected CharSequence |
encode(RequestCycle requestCycle,
IPageRequestTarget requestTarget)
Encode a page target. |
CharSequence |
encode(RequestCycle requestCycle,
IRequestTarget requestTarget)
Encode the given request target. |
protected CharSequence |
encode(RequestCycle requestCycle,
ISharedResourceRequestTarget requestTarget)
Encode a shared resource target. |
protected CharSequence |
encode(RequestCycle requestCycle,
PageReferenceRequestTarget requestTarget)
Encode a pageid request target. |
static String |
encodePageMapName(String pageMapName)
Makes page map name url safe. |
protected IRequestTargetUrlCodingStrategy |
getMountEncoder(IRequestTarget requestTarget)
Gets the mount encoder for the given request target if any. |
protected String |
getRequestPath(Request request)
Gets the request info path. |
IRequestTargetUrlCodingStrategy[] |
listMounts()
List the mounts that are known to the implementing mounter. |
void |
mount(IRequestTargetUrlCodingStrategy encoder)
Mounts a request target with the given path. |
CharSequence |
pathForTarget(IRequestTarget requestTarget)
Gets the url that the provided request target conforms to. |
String |
rewriteStaticRelativeUrl(String string)
Rewrites relative paths found in static markup attributes ( src,href,background )
of wicket pages. |
IRequestTarget |
targetForRequest(RequestParameters requestParameters)
Gets the request target that conforms to the given request parameters. |
void |
unmount(String path)
Unmounts a request target. |
IRequestTargetUrlCodingStrategy |
urlCodingStrategyForPath(String path)
Gets the encoder that was mounted on the provided path if any. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String NAME_SPACE
public static final String INTERFACE_PARAMETER_NAME
public static final String BEHAVIOR_ID_PARAMETER_NAME
public static final String BOOKMARKABLE_PAGE_PARAMETER_NAME
public static final String PAGEMAP
public static final String DEFAULT_PAGEMAP_NAME
public static final String RESOURCES_PATH_PREFIX
public static final String IGNORE_IF_NOT_ACTIVE_PARAMETER_NAME
Constructor Detail |
---|
public WebRequestCodingStrategy()
public WebRequestCodingStrategy(WebRequestCodingStrategy.Settings settings)
settings
- Method Detail |
---|
public RequestParameters decode(Request request)
IRequestCodingStrategy
decode
in interface IRequestCodingStrategy
request
- the incoming request
IRequestCodingStrategy.decode(org.apache.wicket.Request)
public CharSequence encode(RequestCycle requestCycle, IRequestTarget requestTarget)
doEncode(RequestCycle, IRequestTarget)
, which will be called after the defaults have
been tried. When that doesn't provide a url either, an exception will be thrown saying that
encoding could not be done.
encode
in interface IRequestCodingStrategy
requestCycle
- the current request cycle (for efficient access)requestTarget
- the request target
IRequestCodingStrategy.encode(org.apache.wicket.RequestCycle,
org.apache.wicket.IRequestTarget)
public CharSequence encode(CharSequence url)
url
- The URL to encode
public IRequestTargetUrlCodingStrategy[] listMounts()
IRequestTargetMountsInfo
listMounts
in interface IRequestTargetMountsInfo
IRequestTargetMountsInfo.listMounts()
public IRequestTargetUrlCodingStrategy urlCodingStrategyForPath(String path)
IRequestTargetMounter
urlCodingStrategyForPath
in interface IRequestTargetMounter
path
- the path
IRequestTargetMounter.urlCodingStrategyForPath(java.lang.String)
public void mount(IRequestTargetUrlCodingStrategy encoder)
IRequestTargetMounter
mount
in interface IRequestTargetMounter
encoder
- The strategy to use for encoding and decoding urlsIRequestTargetMounter.mount(org.apache.wicket.request.target.coding.IRequestTargetUrlCodingStrategy)
public void addIgnoreMountPath(String path)
IRequestTargetMounter
addIgnoreMountPath
in interface IRequestTargetMounter
path
- the path that should be ignored.IRequestTargetMounter.addIgnoreMountPath(String)
public CharSequence pathForTarget(IRequestTarget requestTarget)
IRequestTargetMounter
pathForTarget
in interface IRequestTargetMounter
requestTarget
- the request target
IRequestTargetMounter.pathForTarget(org.apache.wicket.IRequestTarget)
public IRequestTarget targetForRequest(RequestParameters requestParameters)
IRequestTargetMounter
targetForRequest
in interface IRequestTargetMounter
requestParameters
- the request parameters
IRequestTargetMounter.targetForRequest(org.apache.wicket.request.RequestParameters)
public void unmount(String path)
IRequestTargetMounter
unmount
in interface IRequestTargetMounter
path
- the path to unmountIRequestTargetMounter.unmount(java.lang.String)
protected void addBookmarkablePageParameters(Request request, RequestParameters parameters)
encode(RequestCycle, IBookmarkablePageRequestTarget)
should also be overridden to be
in sync with that behavior.
request
- the incoming requestparameters
- the parameters object to set the found values onprotected void addInterfaceParameters(Request request, RequestParameters parameters)
encode(RequestCycle, IListenerInterfaceRequestTarget)
should be overridden to be in
sync with that behavior.
request
- the incoming requestparameters
- the parameters object to set the found values onpublic static void addInterfaceParameters(String interfaceParameter, RequestParameters parameters)
interfaceParameter
- The format of the interfaceParameter is:
page-map-name:path:version:interface:behaviourId:urlDepth
parameters
- parameters object to set the found parts inprotected void addResourceParameters(Request request, RequestParameters parameters)
encode(RequestCycle, ISharedResourceRequestTarget)
should be overridden to be in
sync with that behavior.
request
- the incoming requestparameters
- the parameters object to set the found values onprotected String doEncode(RequestCycle requestCycle, IRequestTarget requestTarget)
null
will be returned by the encode
method.
requestCycle
- the current request cycle (for efficient access)requestTarget
- the request target
protected CharSequence encode(RequestCycle requestCycle, IBookmarkablePageRequestTarget requestTarget)
addBookmarkablePageParameters(Request, RequestParameters)
should be overridden to be
in sync with that behavior.
requestCycle
- the current request cyclerequestTarget
- the target to encode
protected CharSequence encode(RequestCycle requestCycle, ISharedResourceRequestTarget requestTarget)
addResourceParameters(Request, RequestParameters)
should be overridden to be in sync
with that behavior.
requestCycle
- the current request cyclerequestTarget
- the target to encode
protected CharSequence encode(RequestCycle requestCycle, PageReferenceRequestTarget requestTarget)
requestCycle
- the current request cyclerequestTarget
- the target to encode
protected CharSequence encode(RequestCycle requestCycle, IListenerInterfaceRequestTarget requestTarget)
addInterfaceParameters(Request, RequestParameters)
should be overridden to be in
sync with that behavior.
requestCycle
- the current request cyclerequestTarget
- the target to encode
protected CharSequence encode(RequestCycle requestCycle, IPageRequestTarget requestTarget)
requestCycle
- the current request cyclerequestTarget
- the target to encode
protected IRequestTargetUrlCodingStrategy getMountEncoder(IRequestTarget requestTarget)
requestTarget
- the request target to match
protected String getRequestPath(Request request)
Request.getPath()
.
request
- the request
public static final String encodePageMapName(String pageMapName)
pageMapName
passed in
is not null it is returned without modification.
pageMapName
- page map name
public static String decodePageMapName(String pageMapName)
encodePageMapName(String)
pageMapName
- page map name
public String rewriteStaticRelativeUrl(String string)
src,href,background
)
of wicket pages. Since we do not know the url depth at which the page will be rendered the
implementations should usually simply append a prefix, eg ../../
, to make the
path context-relative. If the url is not relative it is returned intact.
Implementations can be as simple as delegating to
UrlUtils.rewriteToContextRelative(String, Request)
rewriteStaticRelativeUrl
in interface IRequestCodingStrategy
Request.getRelativePathPrefixToContextRoot()
,
UrlUtils.rewriteToContextRelative(String, Request)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |