org.apache.jetspeed.container.invoker
Class ServletPortletInvoker

java.lang.Object
  extended by org.apache.jetspeed.container.invoker.ServletPortletInvoker
All Implemented Interfaces:
JetspeedPortletInvoker, org.apache.pluto.invoker.PortletInvoker

public class ServletPortletInvoker
extends Object
implements JetspeedPortletInvoker

ServletPortletInvoker invokes portlets in another web application, calling a portlet's render or action method via a cross context request dispatcher. In order for this class to work, a servlet must be special servlet must be infused into the web (portlet) application. This servlet knows how to delegate to portlets and package their response back into a servlet response. The context name of the servlet should be configurable. The default context name is "/container" ServletPortletInvokerFactory is the factory for creating portlet invokers that use Jetspeed Container servlet.

Sample Factory Configuration

 
 factory.invoker.servlet = org.apache.jetspeed.container.invoker.ServletPortletInvoker
 factory.invoker.servlet.pool.size = 50
 factory.invoker.servlet.mapping.name = /container
  
 

Version:
$Id: ServletPortletInvoker.java 598155 2007-11-26 07:41:26Z woonsan $
Author:
David Sean Taylor

Field Summary
protected  boolean activated
           
protected  javax.servlet.ServletConfig jetspeedConfig
           
protected  javax.servlet.ServletContext jetspeedContext
           
private static org.apache.commons.logging.Log log
           
protected  org.apache.pluto.om.portlet.PortletDefinition portletDefinition
           
protected  org.apache.jetspeed.factory.PortletFactory portletFactory
           
protected  org.apache.jetspeed.container.invoker.PortletRequestResponseUnwrapper requestResponseUnwrapper
          requestResponseUnwrapper used to unwrap portlet request or portlet response to find the real servlet request or servlet response.
protected  String servletMappingName
           
 
Constructor Summary
ServletPortletInvoker()
           
ServletPortletInvoker(org.apache.jetspeed.container.invoker.PortletRequestResponseUnwrapper requestResponseUnwrapper)
           
 
Method Summary
 void action(javax.portlet.ActionRequest request, javax.portlet.ActionResponse response)
           
 void activate(org.apache.jetspeed.factory.PortletFactory portletFactory, org.apache.pluto.om.portlet.PortletDefinition portletDefinition, javax.servlet.ServletConfig servletConfig)
          Activating an invoker makes it ready to invoke portlets.
 void activate(org.apache.jetspeed.factory.PortletFactory portletFactory, org.apache.pluto.om.portlet.PortletDefinition portletDefinition, javax.servlet.ServletConfig servletConfig, String servletMappingName)
          Activating an invoker makes it ready to invoke portlets.
protected  void invoke(javax.portlet.PortletRequest portletRequest, javax.portlet.PortletResponse portletResponse, Integer methodID)
          Creates a servlet request dispatcher to dispatch to another web application to render the portlet.
 boolean isActivated()
          Returns true if the state of this invoke is 'activated', and false if it is 'passivated'.
 void load(javax.portlet.PortletRequest request, javax.portlet.RenderResponse response)
           
 void passivate()
          Passivates an invoker, freeing it back to the invoker pool.
 void render(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

portletFactory

protected org.apache.jetspeed.factory.PortletFactory portletFactory

jetspeedContext

protected javax.servlet.ServletContext jetspeedContext

jetspeedConfig

protected javax.servlet.ServletConfig jetspeedConfig

portletDefinition

protected org.apache.pluto.om.portlet.PortletDefinition portletDefinition

activated

protected boolean activated

servletMappingName

protected String servletMappingName

requestResponseUnwrapper

protected org.apache.jetspeed.container.invoker.PortletRequestResponseUnwrapper requestResponseUnwrapper
requestResponseUnwrapper used to unwrap portlet request or portlet response to find the real servlet request or servlet response.

Constructor Detail

ServletPortletInvoker

public ServletPortletInvoker()

ServletPortletInvoker

public ServletPortletInvoker(org.apache.jetspeed.container.invoker.PortletRequestResponseUnwrapper requestResponseUnwrapper)
Method Detail

passivate

public void passivate()
Description copied from interface: JetspeedPortletInvoker
Passivates an invoker, freeing it back to the invoker pool. If an invoker's state is passivated, it cannot be used to invoke portlets.

Specified by:
passivate in interface JetspeedPortletInvoker

isActivated

public boolean isActivated()
Description copied from interface: JetspeedPortletInvoker
Returns true if the state of this invoke is 'activated', and false if it is 'passivated'.

Specified by:
isActivated in interface JetspeedPortletInvoker
Returns:
True if the current state of the invoker is 'activated' otherwise false.

activate

public void activate(org.apache.jetspeed.factory.PortletFactory portletFactory,
                     org.apache.pluto.om.portlet.PortletDefinition portletDefinition,
                     javax.servlet.ServletConfig servletConfig)
Description copied from interface: JetspeedPortletInvoker
Activating an invoker makes it ready to invoke portlets. If an invoker's state is not activated, it can not invoke.

Specified by:
activate in interface JetspeedPortletInvoker
Parameters:
portletFactory - The factory to get access to the portlet being invoked.
portletDefinition - The portlet's definition that is being invoked.
servletConfig - The servlet configuration of the portal.

activate

public void activate(org.apache.jetspeed.factory.PortletFactory portletFactory,
                     org.apache.pluto.om.portlet.PortletDefinition portletDefinition,
                     javax.servlet.ServletConfig servletConfig,
                     String servletMappingName)
Description copied from interface: JetspeedPortletInvoker
Activating an invoker makes it ready to invoke portlets. If an invoker's state is not activated, it can not invoke. This second signature allows for activating with an extra property.

Specified by:
activate in interface JetspeedPortletInvoker
Parameters:
portletFactory - The factory to get access to the portlet being invoked.
portletDefinition - The portlet's definition that is being invoked.
servletConfig - The servlet configuration of the portal.
servletMappingName - Implementation specific property

render

public void render(javax.portlet.RenderRequest request,
                   javax.portlet.RenderResponse response)
            throws javax.portlet.PortletException,
                   IOException
Specified by:
render in interface org.apache.pluto.invoker.PortletInvoker
Parameters:
request -
response -
Throws:
javax.portlet.PortletException
IOException

action

public void action(javax.portlet.ActionRequest request,
                   javax.portlet.ActionResponse response)
            throws javax.portlet.PortletException,
                   IOException
Specified by:
action in interface org.apache.pluto.invoker.PortletInvoker
Throws:
javax.portlet.PortletException
IOException

load

public void load(javax.portlet.PortletRequest request,
                 javax.portlet.RenderResponse response)
          throws javax.portlet.PortletException
Specified by:
load in interface org.apache.pluto.invoker.PortletInvoker
Throws:
javax.portlet.PortletException

invoke

protected void invoke(javax.portlet.PortletRequest portletRequest,
                      javax.portlet.PortletResponse portletResponse,
                      Integer methodID)
               throws javax.portlet.PortletException,
                      IOException
Creates a servlet request dispatcher to dispatch to another web application to render the portlet. NOTE: this method requires that your container supports cross-context dispatching. Cross-context dispatching is known to work on Tomcat, Catalina, Tomcat-5.

Parameters:
portletRequest -
portletResponse -
methodID -
Throws:
javax.portlet.PortletException
IOException


Copyright © 1999-2007 Apache Software Foundation. All Rights Reserved.