org.mortbay.jetty.servlet
Class Context.SContext

java.lang.Object
  extended by org.mortbay.jetty.handler.ContextHandler.SContext
      extended by org.mortbay.jetty.servlet.Context.SContext
All Implemented Interfaces:
ServletContext
Enclosing class:
Context

public class Context.SContext
extends ContextHandler.SContext


Constructor Summary
Context.SContext()
           
 
Method Summary
 void addFilter(String filterName, String description, String className, Map<String,String> initParameters)
          Adds the filter with the given name, description, and class name to this servlet context.
 void addFilterMapping(String filterName, String[] urlPatterns, String[] servletNames, EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter)
          Adds a filter mapping with the given url patterns, servlet names, and dispatcher types for the filter with the given filter name to this servlet context.
 void addServlet(String servletName, String description, String className, Map<String,String> initParameters, int loadOnStartup)
          Adds the servlet with the given name, description, and class name to this servlet context.
 void addServletMapping(String servletName, String[] urlPattern)
          Adds a servlet mapping with the given url patterns for the servlet with the given servlet name to this servlet context.
 RequestDispatcher getNamedDispatcher(String name)
          Returns a RequestDispatcher object that acts as a wrapper for the named servlet.
 RequestDispatcher getRequestDispatcher(String uriInContext)
          Returns a RequestDispatcher object that acts as a wrapper for the resource located at the given path.
 
Methods inherited from class org.mortbay.jetty.handler.ContextHandler.SContext
getAttribute, getAttributeNames, getContext, getContextHandler, getContextPath, getInitParameter, getInitParameterNames, getMajorVersion, getMimeType, getMinorVersion, getRealPath, getResource, getResourceAsStream, getResourcePaths, getServerInfo, getServlet, getServletContextName, getServletNames, getServlets, log, log, log, removeAttribute, setAttribute, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Context.SContext

public Context.SContext()
Method Detail

getNamedDispatcher

public RequestDispatcher getNamedDispatcher(String name)
Description copied from interface: javax.servlet.ServletContext
Returns a RequestDispatcher object that acts as a wrapper for the named servlet.

Servlets (and JSP pages also) may be given names via server administration or via a web application deployment descriptor. A servlet instance can determine its name using ServletConfig.getServletName().

This method returns null if the ServletContext cannot return a RequestDispatcher for any reason.

Specified by:
getNamedDispatcher in interface ServletContext
Overrides:
getNamedDispatcher in class ContextHandler.SContext
Parameters:
name - a String specifying the name of a servlet to wrap
Returns:
a RequestDispatcher object that acts as a wrapper for the named servlet, or null if the ServletContext cannot return a RequestDispatcher
See Also:
RequestDispatcher, ServletContext.getContext(java.lang.String), ServletConfig.getServletName()

getRequestDispatcher

public RequestDispatcher getRequestDispatcher(String uriInContext)
Description copied from interface: javax.servlet.ServletContext
Returns a RequestDispatcher object that acts as a wrapper for the resource located at the given path. A RequestDispatcher object can be used to forward a request to the resource or to include the resource in a response. The resource can be dynamic or static.

The pathname must begin with a "/" and is interpreted as relative to the current context root. Use getContext to obtain a RequestDispatcher for resources in foreign contexts. This method returns null if the ServletContext cannot return a RequestDispatcher.

Specified by:
getRequestDispatcher in interface ServletContext
Overrides:
getRequestDispatcher in class ContextHandler.SContext
Parameters:
uriInContext - a String specifying the pathname to the resource
Returns:
a RequestDispatcher object that acts as a wrapper for the resource at the specified path, or null if the ServletContext cannot return a RequestDispatcher
See Also:
RequestDispatcher, ServletContext.getContext(java.lang.String)

addFilter

public void addFilter(String filterName,
                      String description,
                      String className,
                      Map<String,String> initParameters)
Description copied from interface: javax.servlet.ServletContext
Adds the filter with the given name, description, and class name to this servlet context.

Specified by:
addFilter in interface ServletContext
Overrides:
addFilter in class ContextHandler.SContext
Parameters:
filterName - the name of the filter
description - the description of the filter
className - the fully qualified class name of the filter
initParameters - the initialization parameters of the filter, or null if the filter does not need any

addFilterMapping

public void addFilterMapping(String filterName,
                             String[] urlPatterns,
                             String[] servletNames,
                             EnumSet<DispatcherType> dispatcherTypes,
                             boolean isMatchAfter)
Description copied from interface: javax.servlet.ServletContext
Adds a filter mapping with the given url patterns, servlet names, and dispatcher types for the filter with the given filter name to this servlet context.

The filter with the given name may have been declared in the deployment descriptor or one of the web fragments of this servlet context, or may be added using addFilter. It is legal to add a filter mapping for a filter that has not yet been added.

Filter mappings added via this method will be matched against requests in the same order in which they were added.

Depending on the value of the isMatchAfter parameter, the given filter mapping will be considered after or before any declared filter mappings of this servlet context.

Specified by:
addFilterMapping in interface ServletContext
Overrides:
addFilterMapping in class ContextHandler.SContext
Parameters:
filterName - the name of the filter for which the filter mapping is added
urlPatterns - the url patterns of the filter mapping
servletNames - the servlet names of the filter mapping
dispatcherTypes - the dispatcher types of the filter mapping, or null if the default DispatcherType.REQUEST is to be used
isMatchAfter - true if the given filter mapping should be matched against requests after any declared filter mappings of this servlet context, and false if it is supposed to be matched before any declared filter mappings of this servlet context

addServlet

public void addServlet(String servletName,
                       String description,
                       String className,
                       Map<String,String> initParameters,
                       int loadOnStartup)
Description copied from interface: javax.servlet.ServletContext
Adds the servlet with the given name, description, and class name to this servlet context.

If loadOnStartup is a positive integer or zero, it indicates to the container the initialization priority of the servlet. In this case, the container must instantiate and initialize the servlet during the initialization phase of this servlet context, that is, after it has invoked all of the ServletContextListeners configured for this servlet context at their ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent) method.

If loadOnStartup is a negative integer, the container is free to instantiate and initialize the servlet lazily.

Specified by:
addServlet in interface ServletContext
Overrides:
addServlet in class ContextHandler.SContext
Parameters:
servletName - the name of the servlet
description - the description of the servlet
className - the fully qualified class name of the servlet
initParameters - the initialization parameters of the servlet, or null if the servlet does not need any
loadOnStartup - the initialization priority of the servlet

addServletMapping

public void addServletMapping(String servletName,
                              String[] urlPattern)
Description copied from interface: javax.servlet.ServletContext
Adds a servlet mapping with the given url patterns for the servlet with the given servlet name to this servlet context.

The servlet with the given name may have been declared in the deployment descriptor or one of the web fragments of this servlet context, or may be added using addServlet. It is legal to add a servlet mapping for a servlet that has not yet been added.

Specified by:
addServletMapping in interface ServletContext
Overrides:
addServletMapping in class ContextHandler.SContext
Parameters:
servletName - the name of the servlet for which the servlet mapping is added
urlPattern - the url patterns of the servlet mapping


Copyright © 2008 Mort Bay Consulting. All Rights Reserved.