org.directwebremoting.impl
Class StartupUtil

java.lang.Object
  extended by org.directwebremoting.impl.StartupUtil

public class StartupUtil
extends java.lang.Object

Some utilities to help get DWR up and running

Author:
Joe Walker [joe at getahead dot ltd dot uk]

Constructor Summary
StartupUtil()
           
 
Method Summary
static ServerContextFactory.ServerContextBuilder initServerContext(ServletConfig servletConfig, ServletContext servletContext, Container container)
          Get the ServerContextFactory.ServerContextBuilder out of the Container, configure it and use it to configure the ServerContextFactory
static WebContextFactory.WebContextBuilder initWebContext(ServletConfig servletConfig, ServletContext servletContext, Container container)
          Get the WebContextFactory.WebContextBuilder out of the Container, configure it (call WebContextBuilder#set()) and use it to configure the WebContextFactory.
static void logStartup(ServletConfig config)
          Some logging so we have a good clue what we are working with.
 void outOfContainerDestroy(Container container)
          Clean up the current thread when outOfContainerInit() has been called.
 Container outOfContainerInit()
          A way to setup DWR outside of any Containers.
static void setupLogging(ServletConfig servletConfig, HttpServlet servlet)
          We have some special logging classes to maintain an optional dependence on commons-logging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StartupUtil

public StartupUtil()
Method Detail

outOfContainerInit

public Container outOfContainerInit()
                             throws ServletException
A way to setup DWR outside of any Containers. This method can also serve as a template for in container code wanting to get DWR setup. Callers of this method should clean up after themselves by calling outOfContainerDestroy(Container)

Returns:
A new initialized container.
Throws:
ServletException - If the setup fails.

outOfContainerDestroy

public void outOfContainerDestroy(Container container)
Clean up the current thread when outOfContainerInit() has been called.

Parameters:
container - The container created by outOfContainerInit().

logStartup

public static void logStartup(ServletConfig config)
Some logging so we have a good clue what we are working with.

Parameters:
config - The servlet config

initWebContext

public static WebContextFactory.WebContextBuilder initWebContext(ServletConfig servletConfig,
                                                                 ServletContext servletContext,
                                                                 Container container)
Get the WebContextFactory.WebContextBuilder out of the Container, configure it (call WebContextBuilder#set()) and use it to configure the WebContextFactory.

Parameters:
servletConfig - The servlet configuration
servletContext - The servlet context
servlet - The servlet that we are running under
container - The container to save in the ServletContext
Returns:
a new WebContextBuilder

initServerContext

public static ServerContextFactory.ServerContextBuilder initServerContext(ServletConfig servletConfig,
                                                                          ServletContext servletContext,
                                                                          Container container)
Get the ServerContextFactory.ServerContextBuilder out of the Container, configure it and use it to configure the ServerContextFactory

Parameters:
servletConfig - The servlet configuration
servletContext - The servlet context
container - The container to save in the ServletContext
Returns:
The newly created ServerContextBuilder

setupLogging

public static void setupLogging(ServletConfig servletConfig,
                                HttpServlet servlet)
We have some special logging classes to maintain an optional dependence on commons-logging. This sets the servlet for when this is not available.

Parameters:
servletConfig - The servlet configuration
servlet - The servlet that we are running under