|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.directwebremoting.impl.ContainerUtil
public class ContainerUtil
An abstraction of all the common servlet operations that are required to host a DWR service that depends on the servlet spec. It would be good to have a base class for all servlet operations, however lack of MI prevents us from doing this.
| Field Summary | |
|---|---|
static java.lang.String |
ATTRIBUTE_CONTAINER_LIST
The name under which we publish all Containers. |
static java.lang.String |
DEFAULT_SERVERCONTEXT_NAME
We store a single ServerContext in the contextMap under this name. |
static java.lang.String |
INIT_CONFIG
Init parameter: Set a dwr.xml config file. |
static java.lang.String |
INIT_CUSTOM_CONFIGURATOR
Init parameter: If you wish to use a custom configurator, place its class name here |
static java.lang.String |
INIT_LOGLEVEL
Init parameter: If we are doing Servlet.log logging, to what level? |
static java.lang.String |
INIT_SKIP_DEFAULT
Init parameter: Skip reading the default config file if none are specified. |
| Constructor Summary | |
|---|---|
ContainerUtil()
|
|
| Method Summary | |
|---|---|
static void |
configure(Container container,
java.util.List<Configurator> configurators)
Allow all the configurators to have a go at the container in turn |
static void |
configureContainerFully(Container container,
javax.servlet.ServletConfig servletConfig)
Run all the default configuration options on a Container |
static boolean |
configureFromAnnotations(Container container)
Annotations must not break 1.3, so we use reflection to create an org.directwebremoting.annotations.AnnotationsConfigurator
and the catch all sorts of random exceptions for the benefit of
Websphere. |
static void |
configureFromDefaultDwrXml(Container container)
Configure using the users dwr.xml that sits next in WEB-INF |
static boolean |
configureFromInitParams(Container container,
javax.servlet.ServletConfig servletConfig)
Add configurators from init params to the end of the list of configurators. |
static void |
configureFromSystemDwrXml(Container container)
Configure using the system dwr.xml from within the JAR file. |
static Container |
createAndSetupDefaultContainer(javax.servlet.ServletConfig servletConfig)
A combination of createDefaultContainer(ServletConfig) and
setupDefaultContainer(DefaultContainer, ServletConfig). |
static DefaultContainer |
createDefaultContainer(javax.servlet.ServletConfig servletConfig)
Deprecated. Use createAndSetupDefaultContainer(ServletConfig) |
static void |
createUrlMapping(DefaultContainer container,
java.lang.String url,
java.lang.String propertyName,
java.lang.Class<?> handler)
Creates entries in the Container so 2 lookups are possible. |
static void |
debugConfig(Container container)
Create a bunch of debug information about a container |
static java.util.List<Container> |
getAllPublishedContainers(javax.servlet.ServletContext servletContext)
Get a list of all known Containers for the given ServletContext |
static ServerContext |
getSingletonServerContext()
If there is only once instance of DWR defined in a ServletContext then we can get at it using this method. |
static void |
prepareForWebContextFilter(javax.servlet.ServletContext context,
javax.servlet.ServletConfig config,
Container container,
WebContextFactory.WebContextBuilder webContextBuilder,
javax.servlet.http.HttpServlet servlet)
Make some changes to the ServletContext so DwrWebContextFilter
can find the Container etc. |
static void |
publishContainer(Container container,
javax.servlet.ServletConfig servletConfig)
If helps some situations if people can get at the container by looking in the servlet context, under some name. |
static void |
resolveContainerAbstraction(DefaultContainer container,
javax.servlet.ServletConfig servletConfig)
We need to decide which ContainerAbstraction should be the
default for this Container, also we should prepare the default
ServerLoadMonitor. |
static void |
setupDefaultContainer(DefaultContainer container,
javax.servlet.ServletConfig servletConfig)
Setup a DefaultContainer. |
static void |
setupDefaults(DefaultContainer container)
Take a DefaultContainer and setup the default beans |
static void |
setupFromServletConfig(DefaultContainer container,
javax.servlet.ServletConfig servletConfig)
Take a DefaultContainer and setup the default beans |
static void |
shutdownServerLoadMonitorsInContainerList(java.util.List<Container> containers,
java.lang.String title)
Internal use only. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String INIT_CONFIG
public static final java.lang.String INIT_SKIP_DEFAULT
public static final java.lang.String INIT_LOGLEVEL
public static final java.lang.String INIT_CUSTOM_CONFIGURATOR
public static final java.lang.String ATTRIBUTE_CONTAINER_LIST
Containers.
public static final java.lang.String DEFAULT_SERVERCONTEXT_NAME
| Constructor Detail |
|---|
public ContainerUtil()
| Method Detail |
|---|
public static Container createAndSetupDefaultContainer(javax.servlet.ServletConfig servletConfig)
throws ContainerConfigurationException
createDefaultContainer(ServletConfig) and
setupDefaultContainer(DefaultContainer, ServletConfig).
servletConfig - The source of init parameters
ContainerConfigurationException - If the specified class could not be found or instantiated
@Deprecated
public static DefaultContainer createDefaultContainer(javax.servlet.ServletConfig servletConfig)
throws ContainerConfigurationException
createAndSetupDefaultContainer(ServletConfig)
DefaultContainer, allowing users to upgrade to a child
of DefaultContainer using an ServletConfig init parameter of
org.directwebremoting.Container. Note that while the
parameter name is the classname of Container, currently the only
this can only be used to create children that inherit from
DefaultContainer. This restriction may be relaxed in the future.
Unlike setupDefaultContainer(DefaultContainer, ServletConfig),
this method does not call any setup methods.
servletConfig - The source of init parameters
ContainerConfigurationException - If the specified class could not be foundServletConfig.getInitParameter(String)
public static void setupDefaultContainer(DefaultContainer container,
javax.servlet.ServletConfig servletConfig)
throws ContainerConfigurationException
DefaultContainer.
Using createDefaultContainer(ServletConfig) followed by
setupFromServletConfig(DefaultContainer, ServletConfig) before
calling DefaultContainer.setupFinished().
container - The container to configureservletConfig - The source of init parameters
ContainerConfigurationException - If we can't use a bean
public static void resolveContainerAbstraction(DefaultContainer container,
javax.servlet.ServletConfig servletConfig)
throws ContainerConfigurationException
ContainerAbstraction should be the
default for this Container, also we should prepare the default
ServerLoadMonitor.
container - The container to configureservletConfig - Information about the environment
ContainerConfigurationException - If we can't use a bean
public static void setupDefaults(DefaultContainer container)
throws ContainerConfigurationException
container - The container to configure
ContainerConfigurationException - If we can't use a bean
public static void createUrlMapping(DefaultContainer container,
java.lang.String url,
java.lang.String propertyName,
java.lang.Class<?> handler)
throws ContainerConfigurationException
Container so 2 lookups are possible.
Handler for a URL. Used by UrlProcessor
Handler
container - The container to create the entries inurl - The URL of the new HandlerpropertyName - The property name (for injection and lookup)handler - The class of Handler
ContainerConfigurationException - From DefaultContainer.addParameter(String, Object)
public static void setupFromServletConfig(DefaultContainer container,
javax.servlet.ServletConfig servletConfig)
throws ContainerConfigurationException
container - The container to configureservletConfig - The servlet configuration (null to ignore)
ContainerConfigurationException - If we can't use a bean
public static void prepareForWebContextFilter(javax.servlet.ServletContext context,
javax.servlet.ServletConfig config,
Container container,
WebContextFactory.WebContextBuilder webContextBuilder,
javax.servlet.http.HttpServlet servlet)
DwrWebContextFilter
can find the Container etc.
context - The servlet contextconfig - The servlet configurationcontainer - The container to save in the ServletContextwebContextBuilder - The WebContextBuilder to saveservlet - The Servlet to save
public static void configureFromSystemDwrXml(Container container)
throws java.io.IOException,
javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException
container - The container to configure
javax.xml.parsers.ParserConfigurationException - If the config file parse fails
java.io.IOException - If the config file read fails
org.xml.sax.SAXException - If the config file parse fails
public static void configureFromDefaultDwrXml(Container container)
throws java.io.IOException,
javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException
container - The container to configure
javax.xml.parsers.ParserConfigurationException - If the config file parse fails
java.io.IOException - If the config file read fails
org.xml.sax.SAXException - If the config file parse fails
public static boolean configureFromInitParams(Container container,
javax.servlet.ServletConfig servletConfig)
throws java.io.IOException,
javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException
container - The container to configureservletConfig - The source of init parameters
org.xml.sax.SAXException - If the config file parse fails
javax.xml.parsers.ParserConfigurationException - If the config file parse fails
java.io.IOException - If the config file read failspublic static boolean configureFromAnnotations(Container container)
org.directwebremoting.annotations.AnnotationsConfigurator
and the catch all sorts of random exceptions for the benefit of
Websphere.
container - The container to configure
public static void configure(Container container,
java.util.List<Configurator> configurators)
container - The container to configureconfigurators - A list of configurators to run against the container
public static void configureContainerFully(Container container,
javax.servlet.ServletConfig servletConfig)
throws java.io.IOException,
javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException
container - The container to configureservletConfig - The source of init parameters
org.xml.sax.SAXException - If the config file parse fails
javax.xml.parsers.ParserConfigurationException - If the config file parse fails
java.io.IOException - If the config file read fails
public static void publishContainer(Container container,
javax.servlet.ServletConfig servletConfig)
container - The container to publishservletConfig - Source of initParams to dictate publishing and contexts to publish topublic static ServerContext getSingletonServerContext()
public static java.util.List<Container> getAllPublishedContainers(javax.servlet.ServletContext servletContext)
ServletContext
servletContext - The context in which Containers are stored.
Containers.
public static void shutdownServerLoadMonitorsInContainerList(java.util.List<Container> containers,
java.lang.String title)
If we detect that the server is being shutdown then we want to kill any reverse ajax threads.
containers - The list of containers to look for ServerLoadMonitors intitle - What causes this (for debug purposes)public static void debugConfig(Container container)
container - The container to print debug information about
|
Copyright ¬ 2005 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||