org.jboss.portal.web.command
Class CommandServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.jboss.portal.web.command.CommandServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
PortletContainerBootstrapServlet

public class CommandServlet
extends javax.servlet.http.HttpServlet

This servlet is used to execute command coming from another context through a dispatching request. The invocation is detyped in order to allow redeployment and avoid class cast exception.

Version:
$Revision: 1.1 $
Author:
Julien Viet
See Also:
Serialized Form

Constructor Summary
CommandServlet()
           
 
Method Summary
protected  void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
protected  void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
static java.lang.Object include(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object callback, javax.servlet.ServletContext targetContext)
          Execute a command after having performed a request dispatch in the target servlet context.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandServlet

public CommandServlet()
Method Detail

include

public static java.lang.Object include(javax.servlet.http.HttpServletRequest request,
                                       javax.servlet.http.HttpServletResponse response,
                                       java.lang.Object callback,
                                       javax.servlet.ServletContext targetContext)
                                throws javax.servlet.ServletException,
                                       java.io.IOException

Execute a command after having performed a request dispatch in the target servlet context.

The provided callback argment must expose a public non static and non abstract method with the signature execute(HttpServletRequest,HttpServletResponse). This method must return an object and can declare any exception. This method will be invoked after the request dispatch operation is done.

Any throwable thrown by the callback invocation will be wrapped in a ServletException and rethrown, unless it is an instance of ServletException or IOException.

Parameters:
callback - the callback to invoke after the inclusion is done
targetContext - the target servlet context
Throws:
java.io.IOException - likely thrown by the request dispatch operation
javax.servlet.ServletException - wraps any exception thrown by the callback

doGet

protected void doGet(javax.servlet.http.HttpServletRequest req,
                     javax.servlet.http.HttpServletResponse resp)
              throws javax.servlet.ServletException,
                     java.io.IOException
Overrides:
doGet in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException

doPost

protected void doPost(javax.servlet.http.HttpServletRequest req,
                      javax.servlet.http.HttpServletResponse resp)
               throws javax.servlet.ServletException,
                      java.io.IOException
Overrides:
doPost in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException