Whack

org.jivesoftware.whack.container
Class ComponentServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.jivesoftware.whack.container.ComponentServlet
All Implemented Interfaces:
Serializable, Servlet, ServletConfig

public class ComponentServlet
extends HttpServlet

The component servlet acts as a proxy for web requests (in the web admin) to components. Since components can be dynamically loaded and live in a different place than normal Whack admin console files, it's not possible to have them added to the normal Whack admin console web app directory.

The servlet listens for requests in the form /components/[componentName]/[JSP File] (e.g. /components/foo/example.jsp). It also listens for image requests in the the form /components/[componentName]/images/*.png|gif (e.g. /components/foo/images/example.gif).

JSP files must be compiled and available via the component's class loader. The mapping between JSP name and servlet class files is defined in [componentName]/web/web.xml. Typically, this file is auto-generated by the JSP compiler when packaging the component.

Author:
Matt Tucker, Gaston Dombiak
See Also:
Serialized Form

Constructor Summary
ComponentServlet()
           
 
Method Summary
 void init(ServletConfig config)
           
static void registerServlets(ComponentFinder finder, org.xmpp.component.Component component, File webXML)
          Registers all JSP page servlets for a component.
 void service(HttpServletRequest request, HttpServletResponse response)
           
static void unregisterServlets(File webXML)
          Unregisters all JSP page servlets for a component.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentServlet

public ComponentServlet()
Method Detail

init

public void init(ServletConfig config)
          throws ServletException
Specified by:
init in interface Servlet
Overrides:
init in class GenericServlet
Throws:
ServletException

service

public void service(HttpServletRequest request,
                    HttpServletResponse response)
             throws ServletException,
                    IOException
Overrides:
service in class HttpServlet
Throws:
ServletException
IOException

registerServlets

public static void registerServlets(ComponentFinder finder,
                                    org.xmpp.component.Component component,
                                    File webXML)
Registers all JSP page servlets for a component.

Parameters:
finder - the component finder.
component - the component.
webXML - the web.xml file containing JSP page names to servlet class file mappings.

unregisterServlets

public static void unregisterServlets(File webXML)
Unregisters all JSP page servlets for a component.

Parameters:
webXML - the web.xml file containing JSP page names to servlet class file mappings.

Whack

Copyright © 2003-2008 Jive Software.