com.ibm.wps.pb.wrapper
Class PortletWrapper
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.ibm.wps.pe.pc.legacy.cache.CacheablePortlet
org.apache.jetspeed.portlet.Portlet
org.apache.jetspeed.portlet.PortletAdapter
com.ibm.wps.pb.wrapper.PortletWrapperBase
com.ibm.wps.pb.wrapper.PortletWrapper
- All Implemented Interfaces:
- org.apache.jetspeed.portlet.event.ActionListener, com.ibm.websphere.servlet.cache.CacheableServlet, com.ibm.wps.portlet.event.EventPhaseListener, org.apache.jetspeed.portlet.event.MessageListener, org.apache.jetspeed.portlet.event.PortletApplicationSettingsAttributesListener, org.apache.jetspeed.portlet.PortletPageListener, org.apache.jetspeed.portlet.PortletSessionListener, com.ibm.wps.pb.portlet.PropertyListener, java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig, org.apache.jetspeed.portlet.event.WindowListener
- public class PortletWrapper
- extends PortletWrapperBase
The actual wrapper code for the application portlet is contained in the base class
PortletWrapperBase. This class only implements the abstract method instantiateApplicationPortlet
to instantiate and return the application portlet class.
Sometimes, the application programmer may need to extend this class and use the extended
class in place of this class. An example of this is when the application portlet implements
PortletTitleListener. The wrapper code provided as part of the runtime does not
implement this interface, so the extended wrapper must implement the interface in this case.
The application portlet must extend this class, implement PortletTitleListener
and the doTitle() method in the extension, and use this as the wrapper class in web.xml.
An example code snippet is shown below:
package com.myco.mywrapper;
import org.apache.jetspeed.portlet.*;
public class MyPortletWrapper extends com.ibm.wps.pb.wrapper.PortletWrapper
implements PortletTitleListener
{
Portlet appPortlet_ = null;
public void doTitle(PortletRequest request, PortletResponse response)
throws PortletException, IOException
{
Portlet appPortlet_ = getApplicationPortlet();
try
{
((PortletTitleListener)appPortlet_).doTitle(request, response);
}
catch (ClassCastException e)// should not happen, as this class should
// be provided only if the app portlet
// implements PortletTitleListener
{
response.getWriter().print(request.getPortletSettings().getTitle(request.getLocale(), request.getClient()));
}
}
}
To specify the new wrapper portlet in the web.xml, change the standard wrapper for cooperative portlets:
<servlet-class>com.ibm.wps.pb.wrapper.PortletWrapper</servlet-class> to the new wrapper class:
<servlet-class>com.myco.mywrapper.MyPortletWrapper</servlet-class>
- Since:
- 5.1.0.1
- See Also:
- PortletWrapperBase,
PortletTitleListener,
Serialized Form
Method Summary
java.lang.Object
| instantiateApplicationPortlet(java.lang.String _appPortletClassName)
This method is marked final as it must not be overridden.
| |
Methods inherited from class com.ibm.wps.pb.wrapper.PortletWrapperBase
org.apache.jetspeed.portlet.event.ActionEvent)">actionPerformed, attributeAdded, attributeAdded, attributeRemoved, attributeRemoved, attributeReplaced, attributeReplaced, beginEventPhase, beginPage, destroyConcrete, doTitle, endEventPhase, endPage, getApplicationPortlet, getLastModified, init, initConcrete, login, logout, messageReceived, service, setProperties, windowClosed, windowClosing, windowDetached, windowMaximized, windowMinimized, windowRestored
| |
Methods inherited from class org.apache.jetspeed.portlet.PortletAdapter
|
destroy, doConfigure, doEdit, doHelp, doView, getPortletConfig, getPortletLog, getVariable, removeVariable, setVariable
|
Methods inherited from class org.apache.jetspeed.portlet.Portlet
|
destroy, doGet, doPost, doPut, getId, getInitParameter, getInitParameterNames, getLastModified, getPortletSettings, getServletContext, getServletInfo, init, service
|
Methods inherited from class com.ibm.wps.pe.pc.legacy.cache.CacheablePortlet
|
getSharingPolicy, service
|
Methods inherited from class javax.servlet.http.HttpServlet
|
doDelete, doHead, doOptions, doTrace
|
Methods inherited from class javax.servlet.GenericServlet
|
getServletConfig, getServletName, init, log, log
|
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
|
PortletWrapper
public PortletWrapper()
instantiateApplicationPortlet
public final java.lang.Object instantiateApplicationPortlet(java.lang.String _appPortletClassName)
throws java.lang.Exception
- This method is marked final as it must not be overridden.
- Specified by:
- instantiateApplicationPortlet in class PortletWrapperBase
- Parameters:
- _appPortletClassName - the name of the class to be instantiated
- Returns:
- an instance of the class
- Throws:
- java.lang.Exception - if the class cannot be instantiated
WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.
IBM is a trademark of the IBM Corporation in the United States, other countries, or both.