org.apache.wicket.protocol.http.portlet
Class PortletRequestContext

java.lang.Object
  extended by org.apache.wicket.RequestContext
      extended by org.apache.wicket.protocol.http.portlet.PortletRequestContext

public class PortletRequestContext
extends RequestContext

FIXME javadoc

Porlet strategy for url rewriting, and providing access to the portlet namespace for markup Ids and isolated session state. Portlets need to have their URLs encoded with special portal information, namespace etc.

For url rewriting, only three methods are needed to support creating Portlet ActionURLs, Portlet RenderURLs and Resource/Ajax URLs.

Author:
Ate Douma
See Also:
RequestContext

Constructor Summary
PortletRequestContext(WicketFilterPortletContext filterContext, ServletWebRequest request, WebResponse response)
           
 
Method Summary
 CharSequence encodeActionURL(CharSequence path)
          FIXME javadoc
 CharSequence encodeActionURL(CharSequence path, boolean forceActionURL)
          FIXME javadoc
 String encodeMarkupId(String markupId)
          Encodes markup Ids, typically overridden by the portlet implementation.
 CharSequence encodeRenderURL(CharSequence path)
          FIXME javadoc
 CharSequence encodeRenderURL(CharSequence path, boolean forceRenderURL)
          FIXME javadoc
 CharSequence encodeResourceURL(CharSequence path)
          Override to encode the path to the resource with the portal specific URL (e.g.
 CharSequence encodeSharedResourceURL(CharSequence path)
          Override to encode the path to the resource with the portal specific url (e.g.
 IHeaderResponse getHeaderResponse()
          Override to return the special EmbeddedPortletHeaderResponse.
 String getLastEncodedPath()
          Used to retrieve the path last encoded as a portlet URL, used for internal Wicket processing when internal methods require a target URL e.g.
 String getLastEncodedPath(String url)
           
 CharSequence getNamespace()
          Should be prefixed or appended to elements, such as JavaScript variables or function names, to ensure they are unique in the context of the portal page.
 javax.portlet.PortletConfig getPortletConfig()
           
 javax.portlet.PortletRequest getPortletRequest()
           
 javax.portlet.PortletResponse getPortletResponse()
           
protected  String getPortletWindowId()
           
protected  String getQualifiedPath(CharSequence path)
           
 boolean isAjax()
           
 boolean isEmbedded()
           
 boolean isPortletRequest()
           
protected  IHeaderResponse newPortletHeaderResponse(Response response)
           
protected  String saveLastEncodedUrl(String url, String path)
          Saves the key/value pairs so the original Wicket URL can be retrieved later if needed by Wicket, keyed by the encoded portal URL.
 
Methods inherited from class org.apache.wicket.RequestContext
get, set, unset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortletRequestContext

public PortletRequestContext(WicketFilterPortletContext filterContext,
                             ServletWebRequest request,
                             WebResponse response)
Method Detail

newPortletHeaderResponse

protected IHeaderResponse newPortletHeaderResponse(Response response)

getLastEncodedPath

public String getLastEncodedPath()
Used to retrieve the path last encoded as a portlet URL, used for internal Wicket processing when internal methods require a target URL e.g. Form.getJsForInterfaceUrl(CharSequence).

Returns:
the original Wicket URL

getLastEncodedPath

public String getLastEncodedPath(String url)
Parameters:
url - the portal encoded URL
Returns:
the original Wicket URL
See Also:
getLastEncodedPath()

saveLastEncodedUrl

protected String saveLastEncodedUrl(String url,
                                    String path)
Saves the key/value pairs so the original Wicket URL can be retrieved later if needed by Wicket, keyed by the encoded portal URL.

Parameters:
url - the portal encoded URL
path - the original Wicket URL
Returns:
See Also:
getLastEncodedPath()

encodeActionURL

public CharSequence encodeActionURL(CharSequence path)
FIXME javadoc

Delegates to encodeActionURL(CharSequence, boolean), passing in forceRenderURL as false - FIXME why?

Overrides:
encodeActionURL in class RequestContext
Parameters:
path - the URL to encode
Returns:
the encoded url
See Also:
RequestContext.encodeActionURL(java.lang.CharSequence), encodeActionURL(CharSequence, boolean)

encodeActionURL

public CharSequence encodeActionURL(CharSequence path,
                                    boolean forceActionURL)
FIXME javadoc

Encodes the given path into a portlet URL, saving the original Wicket URL against the PortletURL and in the class saveLastEncodedUrl(String, String).

Parameters:
path - the path to encode
forceRenderURL - FIXME param
Returns:
See Also:
saveLastEncodedUrl(String, String)

encodeMarkupId

public String encodeMarkupId(String markupId)
Description copied from class: RequestContext
Encodes markup Ids, typically overridden by the portlet implementation.

Overrides:
encodeMarkupId in class RequestContext
Parameters:
markupId - the markup Id to encode
Returns:
the markupId prefixed with the portlet's namespace.
See Also:
RequestContext.encodeMarkupId(java.lang.String)

encodeRenderURL

public CharSequence encodeRenderURL(CharSequence path)
FIXME javadoc

Delegates to encodeRenderURL(CharSequence, boolean), passing in forceRenderURL as false - FIXME why?

Overrides:
encodeRenderURL in class RequestContext
Parameters:
path - the URL to encode
Returns:
the encoded url
See Also:
RequestContext.encodeRenderURL(java.lang.CharSequence), encodeActionURL(CharSequence, boolean)

encodeRenderURL

public CharSequence encodeRenderURL(CharSequence path,
                                    boolean forceRenderURL)
FIXME javadoc

Encodes the given path into a portlet URL, saving the original Wicket URL against the PortletURL and in the class saveLastEncodedUrl(String, String) and also includes the portlet view mode in the url link..

Parameters:
path - the path to encode
forceRenderURL - FIXME param
Returns:
See Also:
saveLastEncodedUrl(String, String)

encodeResourceURL

public CharSequence encodeResourceURL(CharSequence path)
Override to encode the path to the resource with the portal specific URL (e.g. adds portlet window id etc...) and includes the actual Wicket URL as a URL parameter.

Overrides:
encodeResourceURL in class RequestContext
Parameters:
path - the URL to encode
Returns:
the encoded url
See Also:
RequestContext.encodeResourceURL(java.lang.CharSequence)

encodeSharedResourceURL

public CharSequence encodeSharedResourceURL(CharSequence path)
Override to encode the path to the resource with the portal specific url (e.g. adds portlet window id etc...).

Overrides:
encodeSharedResourceURL in class RequestContext
Parameters:
path - the URL to encode
Returns:
the encoded url
See Also:
WicketFilterPortletContext.encodeWindowIdInPath(String, CharSequence), RequestContext.encodeSharedResourceURL(java.lang.CharSequence)

getHeaderResponse

public IHeaderResponse getHeaderResponse()
Override to return the special EmbeddedPortletHeaderResponse.

Overrides:
getHeaderResponse in class RequestContext
Returns:
The IHeaderResponse
See Also:
EmbeddedPortletHeaderResponse, newPortletHeaderResponse(Response), RequestContext.getHeaderResponse()

getNamespace

public CharSequence getNamespace()
Should be prefixed or appended to elements, such as JavaScript variables or function names, to ensure they are unique in the context of the portal page.

Overrides:
getNamespace in class RequestContext
Returns:
the portlet's namespace, typically the portlet window id.
See Also:
PortletResponse.getNamespace(), RequestContext.getNamespace()

isPortletRequest

public boolean isPortletRequest()
Overrides:
isPortletRequest in class RequestContext
Returns:
boolean true if this is a portlet request
See Also:
RequestContext.isPortletRequest()

isEmbedded

public boolean isEmbedded()
Returns:
true if this is an embedded request.

getQualifiedPath

protected String getQualifiedPath(CharSequence path)
Parameters:
path - the relative path
Returns:
the fully qualified path which begins with the servlet context.

getPortletWindowId

protected String getPortletWindowId()
Returns:
the portlet window id as assigned by the portlet container.
See Also:
PortletWindowUtils#getPortletWindowId(javax.portlet.PortletSession)

getPortletConfig

public javax.portlet.PortletConfig getPortletConfig()
Returns:
the portlet config
See Also:
PortletConfig

getPortletRequest

public javax.portlet.PortletRequest getPortletRequest()
Returns:
the portlet request
See Also:
PortletRequest

getPortletResponse

public javax.portlet.PortletResponse getPortletResponse()
Returns:
the portlet response
See Also:
PortletResponse

isAjax

public boolean isAjax()
Returns:
is the current request an Ajax request?


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.