public class WicketPortlet
extends javax.portlet.GenericPortlet
It receives a portlet request and dispatches to a a Wicket filter; wrapping the servlet context, request and response objects; intercepts response writing (especially urls and redirects) and rewrites and adapts the output to accommodate the portlet requirements.
The WicketPortlet is configured (using an initParameter) against a specific filter path, e.g. Wicket WebApplication. The WicketPortlet maintains a parameter for the current Wicket page URL being requested as a URL parameter, based against the filter path (e.g. fully qualified to the context path). When a request (action, render or direct resource/ajax call) is received by the WicketPortlet, it dispatches it to Wicket core as a filter request using the provided Wicket page URL parameter.
WICKET_URL_PORTLET_PARAMETER
,
WicketFilter
Modifier and Type | Class and Description |
---|---|
static class |
WicketPortlet.PageType |
Modifier and Type | Field and Description |
---|---|
static String |
CONFIG_PARAM_PREFIX
FIXME javadoc
|
static String |
RESPONSE_BUFFER_FOLDER_PARAM
FIXME javadoc
|
static String |
RESPONSE_STATE_ATTR
Marker used as key for the ResponseState object stored as a request
attribute.
|
static String |
WICKET_FILTER_PATH_PARAM
FIXME javadoc
|
static String |
WICKET_PORTLET_PROPERTIES
FIXME javadoc
|
static String |
WICKET_URL_PORTLET_PARAMETER
FIXME javadoc
|
Constructor and Description |
---|
WicketPortlet() |
Modifier and Type | Method and Description |
---|---|
protected String |
buildWicketFilterPath(String filterPath) |
protected void |
doCustom(javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response)
Delegates to
#processRequest(PortletRequest, PortletResponse, String, String) . |
protected void |
doEdit(javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response)
Delegates to
#processRequest(PortletRequest, PortletResponse, String, String) . |
protected void |
doHelp(javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response)
Delegates to
#processRequest(PortletRequest, PortletResponse, String, String) . |
protected void |
doView(javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response)
Delegates to
#processRequest(PortletRequest, PortletResponse, String, String) . |
protected String |
fixWicketUrl(String url)
FIXME javadoc
|
protected String |
fixWicketUrl(String requestUrl,
String url)
FIXME javadoc
|
protected String |
getDefaultPage(WicketPortlet.PageType pageType) |
protected Properties |
getWicketPortletProperties(Properties properties)
Loads the Wicket Portlet properties file off the class path.
|
protected String |
getWicketURL(javax.portlet.PortletRequest request,
WicketPortlet.PageType pageType,
String defaultPage)
Retrieves the Wicket URL from the request object as a request parameter,
or if none exists returns the default URL.
|
void |
init(javax.portlet.PortletConfig config) |
void |
processAction(javax.portlet.ActionRequest request,
javax.portlet.ActionResponse response)
Delegates to
#processRequest(PortletRequest, PortletResponse, String, String) . |
protected void |
processActionResponseState(String wicketURL,
javax.portlet.PortletRequest request,
javax.portlet.ActionResponse response,
ResponseState responseState)
Handles redirects set from processing the action.
|
protected void |
processRequest(javax.portlet.PortletRequest request,
javax.portlet.PortletResponse response,
WicketPortlet.PageType pageType)
Consumes and processes all portlet requests.
|
void |
serveResource(javax.portlet.ResourceRequest request,
javax.portlet.ResourceResponse response)
Delegates to
#processRequest(PortletRequest, PortletResponse, String, String) . |
protected void |
validateDefaultPages(Map<WicketPortlet.PageType,String> defaultPages)
FIXME javadoc
|
destroy, doDispatch, doHeaders, getContainerRuntimeOptions, getDefaultNamespace, getInitParameter, getInitParameterNames, getNextPossiblePortletModes, getPortletConfig, getPortletContext, getPortletName, getProcessingEventQNames, getPublicRenderParameterNames, getPublishingEventQNames, getResourceBundle, getSupportedLocales, getTitle, init, processEvent, render
public static final String WICKET_URL_PORTLET_PARAMETER
The prefix for the parameter name for storing Wicket URLs.
The actual Wicket URLs generated by Wicket are passed around in portal URLs, encoded by the portal (as a URL parameter of this name). The Wicket URL is later decoded on subsequent requests, from the portal URL, so that we know where to route the request, once it's passed out of the 'portal' realm and into the 'Wicket' realm.
This is also used in generating links by PortletRequestContext
in
generating links, as the links have to be portal encoded links, but must
also still contain the original wicket url for use by Wicket (e.g.
PortletRequestContext#encodeActionURL
).
The default/buildin name of the parameter which stores the name of the
wicket url is stored under WICKET_URL_PORTLET_PARAMETER
. It will
be stored suffixed with the current portlet mode (e.g. view), so that
render requests know what mode to render.
PortletRequestContext
,
Constant Field Valuespublic static final String WICKET_FILTER_PATH_PARAM
public static final String RESPONSE_BUFFER_FOLDER_PARAM
public static final String CONFIG_PARAM_PREFIX
public static final String RESPONSE_STATE_ATTR
public static final String WICKET_PORTLET_PROPERTIES
protected void doCustom(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response) throws javax.portlet.PortletException, IOException
#processRequest(PortletRequest, PortletResponse, String, String)
.javax.portlet.PortletException
IOException
#processRequest(PortletRequest, PortletResponse, String, String)
protected void doEdit(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response) throws javax.portlet.PortletException, IOException
#processRequest(PortletRequest, PortletResponse, String, String)
.doEdit
in class javax.portlet.GenericPortlet
javax.portlet.PortletException
IOException
#processRequest(PortletRequest, PortletResponse, String, String)
protected void doHelp(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response) throws javax.portlet.PortletException, IOException
#processRequest(PortletRequest, PortletResponse, String, String)
.doHelp
in class javax.portlet.GenericPortlet
javax.portlet.PortletException
IOException
#processRequest(PortletRequest, PortletResponse, String, String)
protected void doView(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response) throws javax.portlet.PortletException, IOException
#processRequest(PortletRequest, PortletResponse, String, String)
.doView
in class javax.portlet.GenericPortlet
javax.portlet.PortletException
IOException
#processRequest(PortletRequest, PortletResponse, String, String)
protected String getDefaultPage(WicketPortlet.PageType pageType)
pageType
- the mode of the portlet page, e.g. VIEW, EDIT etc...protected Properties getWicketPortletProperties(Properties properties) throws javax.portlet.PortletException
properties
- appends the portlet properties tojavax.portlet.PortletException
- if loading the properties failsprotected String getWicketURL(javax.portlet.PortletRequest request, WicketPortlet.PageType pageType, String defaultPage)
This url is then used to pass on to the matching WicketFilter
to
process, by way of RequestDispatcher
via the filters context
path.
A "parameter" is a form field name/value pair passed from the HTML side of the world. Its value is a String.
An "attribute" is a Java object name/value pair passed only through the internal JavaServer processes. (I.e. it can come from a JSP or servlet but not an HTML page.) Its value is an Object.
request
- pageType
- defaultPage
- url of the default pagePortletRequestContext#getLastEncodedPath()
public void init(javax.portlet.PortletConfig config) throws javax.portlet.PortletException
init
in interface javax.portlet.Portlet
init
in class javax.portlet.GenericPortlet
javax.portlet.PortletException
public void processAction(javax.portlet.ActionRequest request, javax.portlet.ActionResponse response) throws javax.portlet.PortletException, IOException
#processRequest(PortletRequest, PortletResponse, String, String)
.
Stores the ActionResponse
so that
PortletEventService#broadcast
can send events using
StateAwareResponse.setEvent(javax.xml.namespace.QName, java.io.Serializable)
processAction
in interface javax.portlet.Portlet
processAction
in class javax.portlet.GenericPortlet
javax.portlet.PortletException
IOException
PortletEventService#broadcastToPortletListeners
,
#processRequest(PortletRequest, PortletResponse, String, String)
protected void processActionResponseState(String wicketURL, javax.portlet.PortletRequest request, javax.portlet.ActionResponse response, ResponseState responseState) throws javax.portlet.PortletException, IOException
wicketURL
- request
- response
- responseState
- javax.portlet.PortletException
IOException
IRequestCycleSettings#REDIRECT_TO_RENDER
protected void processRequest(javax.portlet.PortletRequest request, javax.portlet.PortletResponse response, WicketPortlet.PageType pageType) throws javax.portlet.PortletException, IOException
request
- response
- requestType
- pageType
- javax.portlet.PortletException
IOException
public void serveResource(javax.portlet.ResourceRequest request, javax.portlet.ResourceResponse response) throws javax.portlet.PortletException, IOException
#processRequest(PortletRequest, PortletResponse, String, String)
.serveResource
in interface javax.portlet.ResourceServingPortlet
serveResource
in class javax.portlet.GenericPortlet
javax.portlet.PortletException
IOException
#processRequest(PortletRequest, PortletResponse, String, String)
protected String fixWicketUrl(String url)
Corrects the incoming URL if the old home page style, or if it's missing the filter path prefix.
url
- the URL to fixprotected String fixWicketUrl(String requestUrl, String url)
Corrects the incoming URL if the old home page style, or if it's missing the filter path prefix.
requestUrl
- the original request URLurl
- the URL to fixprotected void validateDefaultPages(Map<WicketPortlet.PageType,String> defaultPages)
Registers the default pages and their URLs for the different
PortletMode
s. Also corrects and slightly incorrect URLs (see
fixWicketUrl(String)
).
If no specific page was specified for a given portlet mode (VIEW, EDIT etc) then the page for that mode is set to be the same page as that of the VIEW mode.
defaultPages
- PortletMode
,
fixWicketUrl(String)
Copyright © 2015. All rights reserved.