org.mortbay.jetty.servlet

Class ServletHttpContext

public class ServletHttpContext extends HttpContext

ServletHttpContext. Extends HttpContext with conveniance methods for adding servlets. Enforces a single ServletHandler per context.

Version: $Id: ServletHttpContext.java,v 1.27 2005/04/13 16:30:47 janb Exp $

Author: Greg Wilkins (gregw)

Constructor Summary
ServletHttpContext()
Constructor.
Method Summary
voidaddLocaleEncoding(String locale, String encoding)
ServletHolderaddServlet(String pathSpec, String className)
Add a servlet to the context.
ServletHolderaddServlet(String name, String pathSpec, String className)
Add a servlet to the context.
booleancheckSecurityConstraints(String pathInContext, HttpRequest request, HttpResponse response)
voiddestroy()
protected voiddoStop()
ObjectenterContextScope(HttpRequest request, HttpResponse response)
StringgetLocaleEncoding(Locale locale)
Get the character encoding for a locale.
ServletContextgetServletContext()
ServletHandlergetServletHandler()
Get the context ServletHandler.
protected booleanjSecurityCheck(String pathInContext, HttpRequest request, HttpResponse response)
voidsendError(HttpResponse response, int code, String msg)
StringtoString()

Constructor Detail

ServletHttpContext

public ServletHttpContext()
Constructor.

Method Detail

addLocaleEncoding

public void addLocaleEncoding(String locale, String encoding)

addServlet

public ServletHolder addServlet(String pathSpec, String className)
Add a servlet to the context. Conveniance method. If no ServletHandler is found in the context, a new one is added.

Parameters: pathSpec The pathspec within the context className The classname of the servlet.

Returns: The ServletHolder.

Throws: ClassNotFoundException InstantiationException IllegalAccessException

addServlet

public ServletHolder addServlet(String name, String pathSpec, String className)
Add a servlet to the context. If no ServletHandler is found in the context, a new one is added.

Parameters: name The name of the servlet. pathSpec The pathspec within the context className The classname of the servlet.

Returns: The ServletHolder.

Throws: ClassNotFoundException InstantiationException IllegalAccessException

checkSecurityConstraints

public boolean checkSecurityConstraints(String pathInContext, HttpRequest request, HttpResponse response)

destroy

public void destroy()

doStop

protected void doStop()

enterContextScope

public Object enterContextScope(HttpRequest request, HttpResponse response)

getLocaleEncoding

public String getLocaleEncoding(Locale locale)
Get the character encoding for a locale. The full locale name is first looked up in the map of encodings. If no encoding is found, then the locale language is looked up.

Parameters: locale a Locale value

Returns: a String representing the character encoding for the locale or null if none found.

getServletContext

public ServletContext getServletContext()

Returns: The ServletContext.

getServletHandler

public ServletHandler getServletHandler()
Get the context ServletHandler. Conveniance method. If no ServletHandler exists, a new one is added to the context.

Returns: ServletHandler

jSecurityCheck

protected boolean jSecurityCheck(String pathInContext, HttpRequest request, HttpResponse response)

sendError

public void sendError(HttpResponse response, int code, String msg)

toString

public String toString()
Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.