wicket.protocol.http.portlet
Class PortletRequestCodingStrategy

java.lang.Object
  extended by wicket.protocol.http.portlet.PortletRequestCodingStrategy
All Implemented Interfaces:
IRequestCodingStrategy, IRequestTargetMounter

public class PortletRequestCodingStrategy
extends java.lang.Object
implements IRequestCodingStrategy

Request coding strategy implementation that uses PortletURL object to create links. Also stores response/render parameters as portlet render parameters.

Author:
Janne Hietamäki

Field Summary
static java.lang.String BEHAVIOR_ID_PARAMETER_NAME
          AJAX query parameter name
static java.lang.String COMPONENT_PATH_PARAMETER_NAME
          Name of component path query parameter
static java.lang.String INTERFACE_PARAMETER_NAME
          Name of interface target query parameter
static java.lang.String NAME_SPACE
          Name of interface target query parameter
static java.lang.String PAGEMAP
          Pagemap parameter constant
static java.lang.String RESOURCES_PARAMETER_NAME
          Resource key parameter name
static java.lang.String VERSION_PARAMETER_NAME
          Name of version number query parameter
 
Constructor Summary
PortletRequestCodingStrategy()
          Construct.
 
Method Summary
protected  void addBookmarkablePageParameters(Request request, RequestParameters parameters)
          Adds bookmarkable page related parameters (page alias and optionally page parameters).
protected  void addInterfaceParameters(Request request, RequestParameters parameters)
          Adds page related parameters (path and pagemap and optionally version and interface).
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.
protected  java.lang.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.
 java.lang.CharSequence encode(RequestCycle requestCycle, IRequestTarget requestTarget)
          Encode the given request target and one of the delegation methods will be called.
protected  java.lang.CharSequence encodeRequest(RequestCycle requestCycle, IBookmarkablePageRequestTarget requestTarget)
          Encode a page class target.
protected  java.lang.CharSequence encodeRequest(RequestCycle requestCycle, IListenerInterfaceRequestTarget requestTarget)
          Encode a listener interface target.
protected  java.lang.CharSequence encodeRequest(RequestCycle requestCycle, IPageRequestTarget requestTarget)
          Encode a page target.
protected  java.lang.CharSequence encodeRequest(RequestCycle requestCycle, ISharedResourceRequestTarget requestTarget)
          Encode a shared resource target.
protected  java.lang.CharSequence encodeServletRequest(RequestCycle requestCycle, IListenerInterfaceRequestTarget requestTarget)
          Encode a listener interface target.
 void mount(java.lang.String path, IRequestTargetUrlCodingStrategy urlCodingStrategy)
          Mounts a request target with the given path.
 java.lang.CharSequence pathForTarget(IRequestTarget requestTarget)
          Gets the url that the provided request target conforms to.
 void setRenderParameters(PortletRequestCycle requestCycle, IRequestTarget requestTarget)
           
 IRequestTarget targetForRequest(RequestParameters requestParameters)
          Gets the request target that conforms to the given request parameters.
 void unmount(java.lang.String path)
          Unmounts a request target.
 IRequestTargetUrlCodingStrategy urlCodingStrategyForPath(java.lang.String path)
          Gets the encoder that was mounted on the provided path if any.
protected  java.lang.CharSequence urlPrefix(RequestCycle requestCycle)
          Gets prefix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME_SPACE

public static final java.lang.String NAME_SPACE
Name of interface target query parameter

See Also:
Constant Field Values

INTERFACE_PARAMETER_NAME

public static final java.lang.String INTERFACE_PARAMETER_NAME
Name of interface target query parameter

See Also:
Constant Field Values

VERSION_PARAMETER_NAME

public static final java.lang.String VERSION_PARAMETER_NAME
Name of version number query parameter

See Also:
Constant Field Values

COMPONENT_PATH_PARAMETER_NAME

public static final java.lang.String COMPONENT_PATH_PARAMETER_NAME
Name of component path query parameter

See Also:
Constant Field Values

BEHAVIOR_ID_PARAMETER_NAME

public static final java.lang.String BEHAVIOR_ID_PARAMETER_NAME
AJAX query parameter name

See Also:
Constant Field Values

RESOURCES_PARAMETER_NAME

public static final java.lang.String RESOURCES_PARAMETER_NAME
Resource key parameter name

See Also:
Constant Field Values

PAGEMAP

public static final java.lang.String PAGEMAP
Pagemap parameter constant

See Also:
Constant Field Values
Constructor Detail

PortletRequestCodingStrategy

public PortletRequestCodingStrategy()
Construct.

Method Detail

decode

public final RequestParameters decode(Request request)
Description copied from interface: IRequestCodingStrategy
Analyze the request and create a corresponding request parameters object for it.

Specified by:
decode in interface IRequestCodingStrategy
Parameters:
request - the incoming request
Returns:
a request parameters object that corresponds to the request
See Also:
IRequestCodingStrategy.decode(wicket.Request)

encode

public final java.lang.CharSequence encode(RequestCycle requestCycle,
                                           IRequestTarget requestTarget)
Encode the given request target and one of the delegation methods will be called. In case you are using custom targets that are not part of the default target hierarchy, you need to override doEncode(RequestCycle, IRequestTarget), which will be called after the defaults have been tried. When that doesn't provide a url either, and exception will be thrown saying that encoding could not be done.

Specified by:
encode in interface IRequestCodingStrategy
Parameters:
requestCycle - the current request cycle (for efficient access)
requestTarget - the request target
Returns:
the url to the provided target
See Also:
IRequestCodingStrategy.encode(wicket.RequestCycle, wicket.IRequestTarget)

addBookmarkablePageParameters

protected void addBookmarkablePageParameters(Request request,
                                             RequestParameters parameters)
Adds bookmarkable page related parameters (page alias and optionally page parameters). Any bookmarkable page alias mount will override this method; hence if a mount is found, this method will not be called. If you override this method to behave different then also #encode(RequestCycle, IBookmarkablePageRequestTarget) should be overridden to by in sync with that behaviour.

Parameters:
request - the incoming request
parameters - the parameters object to set the found values on

addInterfaceParameters

protected void addInterfaceParameters(Request request,
                                      RequestParameters parameters)
Adds page related parameters (path and pagemap and optionally version and interface). If you override this method to behave different then also #encode(RequestCycle, IListenerInterfaceRequestTarget) should be overridden to by in sync with that behaviour.

Parameters:
request - the incoming request
parameters - the parameters object to set the found values on

addResourceParameters

protected void addResourceParameters(Request request,
                                     RequestParameters parameters)
Adds (shared) resource related parameters (resource key). Any shared resource key mount will override this method If you override this method to behave different then also #encode(RequestCycle, ISharedResourceRequestTarget) should be overridden to by in sync with that behaviour.

Parameters:
request - the incomming request
parameters - the parameters object to set the found values on

doEncode

protected java.lang.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. When this doesn't provide a url either (returns null), an exception will be thrown by the encode method saying that encoding could not be done.

Parameters:
requestCycle - the current request cycle (for efficient access)
requestTarget - the request target
Returns:
the url to the provided target

encodeRequest

protected java.lang.CharSequence encodeRequest(RequestCycle requestCycle,
                                               ISharedResourceRequestTarget requestTarget)
Encode a shared resource target. If you override this method to behave different then also addResourceParameters(Request, RequestParameters) should be overridden to by in sync with that behaviour.

Parameters:
requestCycle - the current request cycle
requestTarget - the target to encode
Returns:
the encoded url

encodeRequest

protected java.lang.CharSequence encodeRequest(RequestCycle requestCycle,
                                               IListenerInterfaceRequestTarget requestTarget)
Encode a listener interface target. If you override this method to behave different then also addInterfaceParameters(Request, RequestParameters) should be overridden to by in sync with that behaviour.

Parameters:
requestCycle - the current request cycle
requestTarget - the target to encode
Returns:
the encoded url

encodeServletRequest

protected java.lang.CharSequence encodeServletRequest(RequestCycle requestCycle,
                                                      IListenerInterfaceRequestTarget requestTarget)
Encode a listener interface target. If you override this method to behave different then also addInterfaceParameters(Request, RequestParameters) should be overridden to by in sync with that behaviour.

Parameters:
requestCycle - the current request cycle
requestTarget - the target to encode
Returns:
the encoded url

encodeRequest

protected java.lang.CharSequence encodeRequest(RequestCycle requestCycle,
                                               IBookmarkablePageRequestTarget requestTarget)
Encode a page class target. If you override this method to behave different then also addBookmarkablePageParameters(Request, RequestParameters) should be overridden to by in sync with that behaviour.

Parameters:
requestCycle - the current request cycle
requestTarget - the target to encode
Returns:
the encoded url

encodeRequest

protected java.lang.CharSequence encodeRequest(RequestCycle requestCycle,
                                               IPageRequestTarget requestTarget)
Encode a page target.

Parameters:
requestCycle - the current request cycle
requestTarget - the target to encode
Returns:
the encoded url

setRenderParameters

public void setRenderParameters(PortletRequestCycle requestCycle,
                                IRequestTarget requestTarget)
Parameters:
requestCycle -
requestTarget -

pathForTarget

public java.lang.CharSequence pathForTarget(IRequestTarget requestTarget)
Description copied from interface: IRequestTargetMounter
Gets the url that the provided request target conforms to.

Specified by:
pathForTarget in interface IRequestTargetMounter
Parameters:
requestTarget - the request target
Returns:
The url that the provided request target conforms to

urlCodingStrategyForPath

public final IRequestTargetUrlCodingStrategy urlCodingStrategyForPath(java.lang.String path)
Description copied from interface: IRequestTargetMounter
Gets the encoder that was mounted on the provided path if any.

Specified by:
urlCodingStrategyForPath in interface IRequestTargetMounter
Parameters:
path - the path
Returns:
The encoder/decoder that was mounted on the provided path, if any
See Also:
IRequestTargetMounter.urlCodingStrategyForPath(java.lang.String)

mount

public void mount(java.lang.String path,
                  IRequestTargetUrlCodingStrategy urlCodingStrategy)
Description copied from interface: IRequestTargetMounter
Mounts a request target with the given path.

Specified by:
mount in interface IRequestTargetMounter
Parameters:
path - the path to mount the request target with
urlCodingStrategy - The strategy to use for encoding and decoding urls

unmount

public void unmount(java.lang.String path)
Description copied from interface: IRequestTargetMounter
Unmounts a request target.

Specified by:
unmount in interface IRequestTargetMounter
Parameters:
path - the path to unmount

targetForRequest

public final IRequestTarget targetForRequest(RequestParameters requestParameters)
Description copied from interface: IRequestTargetMounter
Gets the request target that conforms to the given request parameters.

Specified by:
targetForRequest in interface IRequestTargetMounter
Parameters:
requestParameters - the request parameters
Returns:
the request target or null if nothing was mounted with the given request parameters
See Also:
IRequestTargetMounter.targetForRequest(wicket.request.RequestParameters)

urlPrefix

protected final java.lang.CharSequence urlPrefix(RequestCycle requestCycle)
Gets prefix.

Parameters:
requestCycle - the request cycle
Returns:
prefix


Copyright © 2004-2007 Wicket developers. All Rights Reserved.