wicket.protocol.http.portlet
Class WicketPortlet

java.lang.Object
  extended by javax.portlet.GenericPortlet
      extended by wicket.protocol.http.portlet.WicketPortlet
All Implemented Interfaces:
javax.portlet.Portlet, javax.portlet.PortletConfig

public class WicketPortlet
extends javax.portlet.GenericPortlet

Portlet class for all wicket portlet applications. The specific application class to instantiate should be specified to the application server via an portlet-preferences/preference argument named "applicationClassName" in the portlet declaration, which is typically in a portlet.xml file.

                <portlet id="WicketPortlet">
                <portlet-name>WicketPortlet</portlet-name>
                <portlet-class>
                        wicket.protocol.http.portlet.WicketPortlet
                </portlet-class>
                <expiration-cache>0</expiration-cache>
                <resource-bundle>WicketPortlet</resource-bundle>
 
                <portlet-preferences>
                        <preference>
                                <name>applicationClassName</name>
                                <value>wicket.examples.portlet.ExamplePortletApplication</value>
                        </preference>             
                </portlet-preferences>
 
                <supports>
                        <mime-type>text/html</mime-type>
                        <portlet-mode>VIEW</portlet-mode>
                        <portlet-mode>EDIT</portlet-mode>
                        <portlet-mode>HELP</portlet-mode>
                </supports>
                <portlet-info>
                        <title>WicketPortlet</title>
                </portlet-info>
        </portlet>
 
Note that the applicationClassName parameter you specify must be the fully qualified name of a class that extends PortletApplication. If your class cannot be found, does not extend PortletApplication or cannot be instantiated, a runtime exception of type WicketRuntimeException will be thrown.

As an alternative, you can configure an application factory instead. This looks like:
           
                        <preference>
                                <name>applicationFactoryClassName</name>
                                <value>com.cemron.cpf.web.wicket.SpringApplicationFactory</value>
                        </preference>             
 
and it has to satisfy interface IPortletApplicationFactory. In order to support frameworks like Spring, the class is non-final and the variable portletApplication is protected instead of private. Thus subclasses may provide there own means of providing the application object.

Author:
Janne Hietamäki
See Also:
RequestCycle

Field Summary
static java.lang.String APP_FACT_PARAM
          The name of the context parameter that specifies application factory class
protected  PortletApplication portletApplication
          The application this portlet is serving
 
Constructor Summary
WicketPortlet()
           
 
Method Summary
 void destroy()
           
protected  IPortletApplicationFactory getApplicationFactory()
          Creates the web application factory instance.
 void init(javax.portlet.PortletConfig cfg)
           
 void processAction(javax.portlet.ActionRequest req, javax.portlet.ActionResponse res)
           
 void render(javax.portlet.RenderRequest req, javax.portlet.RenderResponse res)
           
 
Methods inherited from class javax.portlet.GenericPortlet
doDispatch, doEdit, doHelp, doView, getInitParameter, getInitParameterNames, getPortletConfig, getPortletContext, getPortletName, getResourceBundle, getTitle, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APP_FACT_PARAM

public static final java.lang.String APP_FACT_PARAM
The name of the context parameter that specifies application factory class

See Also:
Constant Field Values

portletApplication

protected PortletApplication portletApplication
The application this portlet is serving

Constructor Detail

WicketPortlet

public WicketPortlet()
Method Detail

destroy

public final void destroy()
Specified by:
destroy in interface javax.portlet.Portlet
Overrides:
destroy in class javax.portlet.GenericPortlet

init

public final void init(javax.portlet.PortletConfig cfg)
                throws javax.portlet.PortletException
Specified by:
init in interface javax.portlet.Portlet
Overrides:
init in class javax.portlet.GenericPortlet
Throws:
javax.portlet.PortletException

processAction

public final void processAction(javax.portlet.ActionRequest req,
                                javax.portlet.ActionResponse res)
Specified by:
processAction in interface javax.portlet.Portlet
Overrides:
processAction in class javax.portlet.GenericPortlet

render

public final void render(javax.portlet.RenderRequest req,
                         javax.portlet.RenderResponse res)
                  throws javax.portlet.PortletException,
                         java.io.IOException
Specified by:
render in interface javax.portlet.Portlet
Overrides:
render in class javax.portlet.GenericPortlet
Throws:
javax.portlet.PortletException
java.io.IOException

getApplicationFactory

protected final IPortletApplicationFactory getApplicationFactory()
Creates the web application factory instance. If no APP_FACT_PARAM is specified in web.xml ContextParamWebApplicationFactory will be used by default.

Returns:
application factory instance
See Also:
ContextParamWebApplicationFactory


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