org.eclipse.jetty.webapp
Class WebAppContext.Context

java.lang.Object
  extended by org.eclipse.jetty.server.handler.ContextHandler.Context
      extended by org.eclipse.jetty.servlet.ServletContextHandler.Context
          extended by org.eclipse.jetty.webapp.WebAppContext.Context
All Implemented Interfaces:
ServletContext
Enclosing class:
WebAppContext

public class WebAppContext.Context
extends ServletContextHandler.Context


Constructor Summary
WebAppContext.Context()
           
 
Method Summary
 URL getResource(String path)
          Returns a URL to the resource that is mapped to a specified path.
 
Methods inherited from class org.eclipse.jetty.servlet.ServletContextHandler.Context
addFilter, addFilter, addFilter, addListener, addListener, addListener, addServlet, addServlet, addServlet, createFilter, createListener, createServlet, declareRoles, getFilterRegistration, getFilterRegistrations, getNamedDispatcher, getServletRegistration, getServletRegistrations, setInitParameter
 
Methods inherited from class org.eclipse.jetty.server.handler.ContextHandler.Context
getAttribute, getAttributeNames, getContext, getContextHandler, getContextPath, getInitParameter, getInitParameterNames, getMajorVersion, getMimeType, getMinorVersion, getRealPath, getRequestDispatcher, 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

WebAppContext.Context

public WebAppContext.Context()
Method Detail

getResource

public URL getResource(String path)
                throws MalformedURLException
Description copied from interface: ServletContext
Returns a URL to the resource that is mapped to a specified path. The path must begin with a "/" and is interpreted as relative to the current context root.

This method allows the servlet container to make a resource available to servlets from any source. Resources can be located on a local or remote file system, in a database, or in a .war file.

The servlet container must implement the URL handlers and URLConnection objects that are necessary to access the resource.

This method returns null if no resource is mapped to the pathname.

Some containers may allow writing to the URL returned by this method using the methods of the URL class.

The resource content is returned directly, so be aware that requesting a .jsp page returns the JSP source code. Use a RequestDispatcher instead to include results of an execution.

This method has a different purpose than java.lang.Class.getResource, which looks up resources based on a class loader. This method does not use class loaders.

Specified by:
getResource in interface ServletContext
Overrides:
getResource in class ContextHandler.Context
Parameters:
path - a String specifying the path to the resource
Returns:
the resource located at the named path, or null if there is no resource at that path
Throws:
MalformedURLException - if the pathname is not given in the correct form


Copyright © 1995-2010 Mort Bay Consulting. All Rights Reserved.