You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by ni...@apache.org on 2004/08/09 13:30:01 UTC
svn commit: rev 36106 - in avalon/trunk/planet/facilities/http: blocks blocks/webappserver blocks/webappserver/etc impl/src/main/org/apache/avalon/http/impl spi/src/main/org/apache/avalon/http
Author: niclas
Date: Mon Aug 9 04:30:01 2004
New Revision: 36106
Added:
avalon/trunk/planet/facilities/http/blocks/webappserver/
avalon/trunk/planet/facilities/http/blocks/webappserver/etc/
avalon/trunk/planet/facilities/http/blocks/webappserver/etc/config.xml (contents, props changed)
avalon/trunk/planet/facilities/http/blocks/webappserver/etc/webapp-server.block (contents, props changed)
avalon/trunk/planet/facilities/http/blocks/webappserver/etc/webdefaults.xml (contents, props changed)
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/WebApplicationContext.java (contents, props changed)
Modified:
avalon/trunk/planet/facilities/http/blocks/index.xml
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/DumpHandler.java
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ErrorPageHandler.java
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ExpiryHandler.java
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ForwardHandler.java
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/HTAccessHandler.java
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/HttpContextImpl.java
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/IPAccessHandler.java
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/MsieSslHandler.java
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/NotFoundHandler.java
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/NullHandler.java
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ProxyHandler.java
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ResourceHandler.java
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/RootNotFoundHandler.java
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/SecurityHandler.java
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ServletHandler.java
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/SetResponseHeadersHandler.java
avalon/trunk/planet/facilities/http/spi/src/main/org/apache/avalon/http/HttpContextService.java
Log:
First cut at having the WebApp functionality in place.
Modified: avalon/trunk/planet/facilities/http/blocks/index.xml
==============================================================================
--- avalon/trunk/planet/facilities/http/blocks/index.xml (original)
+++ avalon/trunk/planet/facilities/http/blocks/index.xml Mon Aug 9 04:30:01 2004
@@ -5,33 +5,6 @@
<import index="../../index.xml"
href="http://svn.apache.org/repos/asf/avalon/trunk/planet/facilities/index.xml"/>
- <resource>
- <info>
- <group>jetty</group>
- <name>org.mortbay.jetty</name>
- <version>SNAPSHOT</version>
- <type>jar</type>
- </info>
- </resource>
-
- <resource>
- <info>
- <group>jetty</group>
- <name>org.mortbay.jaas</name>
- <version>5.0.RC0</version>
- <type>jar</type>
- </info>
- </resource>
-
- <resource>
- <info>
- <group>commons-logging</group>
- <name>commons-logging</name>
- <version>SNAPSHOT</version>
- <type>jar</type>
- </info>
- </resource>
-
<project basedir="context">
<info>
<group>avalon/http</group>
Added: avalon/trunk/planet/facilities/http/blocks/webappserver/etc/config.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/planet/facilities/http/blocks/webappserver/etc/config.xml Mon Aug 9 04:30:01 2004
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<targets>
+
+ <target path="/webapp-server/context">
+ <configuration>
+ <web-application>/home/niclas/struts-documentation.war</web-application>
+ <context-path>/struts-docs</context-path>
+ <defaults-descriptor>blocks/webappserver/etc/webdefaults.xml</defaults-descriptor>
+ </configuration>
+ </target>
+
+</targets>
Added: avalon/trunk/planet/facilities/http/blocks/webappserver/etc/webapp-server.block
==============================================================================
--- (empty file)
+++ avalon/trunk/planet/facilities/http/blocks/webappserver/etc/webapp-server.block Mon Aug 9 04:30:01 2004
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<container name="webapp-server">
+
+ <classloader>
+ <classpath>
+ <artifact>jar:avalon/http/avalon-http-api#SNAPSHOT</artifact>
+ <artifact>jar:jetty/org.mortbay.jetty#SNAPSHOT</artifact>
+ <artifact>jar:avalon/http/avalon-http-impl#SNAPSHOT</artifact>
+ <artifact>jar:avalon/http/avalon-http-spi#SNAPSHOT</artifact>
+ <artifact>jar:avalon/http/avalon-http-util#SNAPSHOT</artifact>
+ <artifact>jar:avalon/util/avalon-util-configuration#1.0.0</artifact>
+ <artifact>jar:avalon/framework/avalon-framework-api#SNAPSHOT</artifact>
+ <artifact>jar:avalon/framework/avalon-framework-impl#SNAPSHOT</artifact>
+ <artifact>jar:avalon/framework/avalon-framework-legacy#SNAPSHOT</artifact>
+ <artifact>jar:avalon/logkit/avalon-logkit#SNAPSHOT</artifact>
+ <artifact>jar:jetty/org.mortbay.jaas#5.0.RC0</artifact>
+ <artifact>jar:commons-logging/commons-logging#1.0</artifact>
+ <artifact>jar:servletapi/servletapi#2.3</artifact>
+ <artifact>jar:avalon/http/avalon-http-context#SNAPSHOT</artifact>
+ <artifact>jar:tomcat/jasper-runtime#5.0.25</artifact>
+ <artifact>jar:tomcat/jasper-compiler#5.0.25</artifact>
+ <artifact>jar:tomcat/jsp-api#5.0.18</artifact>
+ </classpath>
+ </classloader>
+
+ <component name="socketlistener" class="org.apache.avalon.http.impl.SocketListener" >
+ <!-- Defaults
+ <parameters>
+ <parameter name="port" value="8080" />
+ <parameter name="hostname" value="0.0.0.0" />
+ </parameters>
+ -->
+ </component>
+
+ <component name="httpserver" class="org.apache.avalon.http.impl.HttpServerImpl"/>
+
+ <component name="context" class="org.apache.avalon.http.impl.WebApplicationContext" />
+
+ <component name="request-log" class="org.apache.avalon.http.impl.NcsaRequestLog">
+ <parameters>
+ <parameter name="filename" value="access_log"/>
+ <parameter name="append" value="true"/>
+ <parameter name="extended" value="true"/>
+ </parameters>
+ </component>
+
+</container>
Added: avalon/trunk/planet/facilities/http/blocks/webappserver/etc/webdefaults.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/planet/facilities/http/blocks/webappserver/etc/webdefaults.xml Mon Aug 9 04:30:01 2004
@@ -0,0 +1,258 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<!-- ===================================================================== -->
+<!-- This file contains the default descriptor for web applications. -->
+<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+<!-- The original of this file is included as a resource in the -->
+<!-- org.mortbay.jetty.jar file and is loaded by default for all web -->
+<!-- applications before there own WEB-INF/web.xml file is loaded -->
+<!-- -->
+<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+<!-- THE COPY OF THIS FILE in $JETTY_HOME/etc IS NOT USED BY DEFAULT! -->
+<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+<!-- If the version in $JETTY_HOME/etc/ is to be used, then the -->
+<!-- setDefaultsDescriptor method must be called on each context, -->
+<!-- giving the location of the default web.xml file to use. -->
+<!-- eg of setting the defaultsDescriptor in jetty.xml:
+
+ <Call name="addWebApplication">
+ <Arg>/mycontext</Arg>
+ <Arg><SystemProperty name="jetty.home" default=".">/webapps/mywebapp</Arg>
+ <Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
+ </Call>
+ -->
+<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+
+
+<!-- ===================================================================== -->
+<web-app>
+ <description>
+ Default web.xml file.
+ This file is applied to a Web application before it's own WEB_INF/web.xml file
+ </description>
+
+
+
+ <!-- ==================================================================== -->
+ <!-- Context params to control Session Cookies -->
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+ <!-- UNCOMMENT TO ACTIVATE
+ <context-param>
+ <param-name>org.mortbay.jetty.servlet.SessionDomain</param-name>
+ <param-value>127.0.0.1</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.mortbay.jetty.servlet.SessionPath</param-name>
+ <param-value>/</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.mortbay.jetty.servlet.MaxAge</param-name>
+ <param-value>-1</param-value>
+ </context-param>
+ -->
+
+
+
+ <!-- ==================================================================== -->
+ <!-- The default servlet. -->
+ <!-- This servlet, normally mapped to /, provides the handling for static -->
+ <!-- content, OPTION and TRACE methods for the context. -->
+ <!-- The following initParameters are supported: -->
+ <!-- -->
+ <!-- acceptRanges If true, range requests and responses are -->
+ <!-- supported -->
+ <!-- -->
+ <!-- dirAllowed If true, directory listings are returned if no -->
+ <!-- welcome file is found. Else 403 Forbidden. -->
+ <!-- -->
+ <!-- putAllowed If true, the PUT method is allowed -->
+ <!-- -->
+ <!-- delAllowed If true, the DELETE method is allowed -->
+ <!-- -->
+ <!-- redirectWelcome If true, redirect welcome file requests -->
+ <!-- else use request dispatcher forwards -->
+ <!-- -->
+ <!-- minGzipLength If set to a positive integer, then static content -->
+ <!-- larger than this will be served as gzip content -->
+ <!-- encoded if a matching resource is found ending -->
+ <!-- with ".gz" -->
+ <!-- -->
+ <!-- resoureBase Can be set to replace the context resource base -->
+ <!-- -->
+ <!-- The MOVE method is allowed if PUT and DELETE are allowed -->
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+ <servlet>
+ <servlet-name>default</servlet-name>
+ <servlet-class>org.mortbay.jetty.servlet.Default</servlet-class>
+ <init-param>
+ <param-name>acceptRanges</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ <init-param>
+ <param-name>dirAllowed</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ <init-param>
+ <param-name>putAllowed</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <init-param>
+ <param-name>delAllowed</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <init-param>
+ <param-name>redirectWelcome</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <init-param>
+ <param-name>minGzipLength</param-name>
+ <param-value>8192</param-value>
+ </init-param>
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+
+ <!-- ==================================================================== -->
+ <!-- JSP Servlet -->
+ <!-- This is the jasper JSP servlet from the jakarta project -->
+ <!-- The following initParameters are supported: -->
+ <!-- -->
+ <!-- classpath What class path should I use while compiling -->
+ <!-- generated servlets? [Created dynamically -->
+ <!-- based on the current web application] -->
+ <!-- -->
+ <!-- classdebuginfo Should the class file be compiled with -->
+ <!-- debugging information? [false] -->
+ <!-- -->
+ <!-- ieClassId The class-id value to be sent to Internet -->
+ <!-- Explorer when using <jsp:plugin> tags. -->
+ <!-- [clsid:8AD9C840-044E-11D1-B3E9-00805F499D93] -->
+ <!-- -->
+ <!-- jspCompilerPlugin The fully qualified class name of the JSP -->
+ <!-- compiler plug-in to be used. See below for -->
+ <!-- more information. -->
+ <!-- [Use internal JDK compiler] -->
+ <!-- -->
+ <!-- keepgenerated Should we keep the generated Java source code -->
+ <!-- for each page instead of deleting it? [true] -->
+ <!-- -->
+ <!-- largefile Should we store the static content of JSP -->
+ <!-- pages in external data files, to reduce the -->
+ <!-- size of the generated servlets? [false] -->
+ <!-- -->
+ <!-- logVerbosityLevel The level of detailed messages to be produced -->
+ <!-- by this servlet. Increasing levels cause the -->
+ <!-- generation of more messages. Valid values are -->
+ <!-- FATAL, ERROR, WARNING, INFORMATION, and DEBUG. -->
+ <!-- [WARNING] -->
+ <!-- -->
+ <!-- mappedfile Should we generate static content with one -->
+ <!-- print statement per input line, to ease -->
+ <!-- debugging? [false] -->
+ <!-- -->
+ <!-- scratchdir What scratch directory should we use when -->
+ <!-- compiling JSP pages? [default work directory -->
+ <!-- for the current web application] -->
+ <!-- -->
+ <!-- If you wish to use Jikes to compile JSP pages: -->
+ <!-- * Set the "classpath" initialization parameter appropriately -->
+ <!-- for this web application. -->
+ <!-- * Set the "jspCompilerPlugin" initialization parameter to -->
+ <!-- "org.apache.jasper.compiler.JikesJavaCompiler". -->
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+ <servlet>
+ <servlet-name>jsp</servlet-name>
+ <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+
+ <!-- ==================================================================== -->
+ <!-- Dynamic Servlet Invoker. -->
+ <!-- This servlet invokes anonymous servlets that have not been defined -->
+ <!-- in the web.xml or by other means. The first element of the pathInfo -->
+ <!-- of a request passed to the envoker is treated as a servlet name for -->
+ <!-- an existing servlet, or as a class name of a new servlet. -->
+ <!-- This servlet is normally mapped to /servlet/* -->
+ <!-- This servlet support the following initParams: -->
+ <!-- -->
+ <!-- nonContextServlets If false, the invoker can only load -->
+ <!-- servlets from the contexts classloader. -->
+ <!-- This is false by default and setting this -->
+ <!-- to true may have security implications. -->
+ <!-- -->
+ <!-- verbose If true, log dynamic loads -->
+ <!-- -->
+ <!-- * All other parameters are copied to the -->
+ <!-- each dynamic servlet as init parameters -->
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+ <servlet>
+ <servlet-name>invoker</servlet-name>
+ <servlet-class>org.mortbay.jetty.servlet.Invoker</servlet-class>
+ <init-param>
+ <param-name>verbose</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <init-param>
+ <param-name>nonContextServlets</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <init-param>
+ <param-name>dynamicParam</param-name>
+ <param-value>anyValue</param-value>
+ </init-param>
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+
+ <!-- ==================================================================== -->
+ <servlet-mapping>
+ <servlet-name>default</servlet-name>
+ <url-pattern>/</url-pattern>
+ </servlet-mapping>
+
+ <!-- ==================================================================== -->
+ <servlet-mapping>
+ <servlet-name>jsp</servlet-name>
+ <url-pattern>*.jsp</url-pattern>
+ </servlet-mapping>
+
+ <!-- ==================================================================== -->
+ <servlet-mapping>
+ <servlet-name>jsp</servlet-name>
+ <url-pattern>*.jspf</url-pattern>
+ </servlet-mapping>
+
+ <!-- ==================================================================== -->
+ <servlet-mapping>
+ <servlet-name>invoker</servlet-name>
+ <url-pattern>/servlet/*</url-pattern>
+ </servlet-mapping>
+
+
+ <!-- ==================================================================== -->
+ <session-config>
+ <session-timeout>30</session-timeout>
+ </session-config>
+
+ <!-- ==================================================================== -->
+ <!-- Default MIME mappings -->
+ <!-- The default MIME mappings are provided by the mime.properties -->
+ <!-- resource in the org.mortbay.jetty.jar file. Additional or modified -->
+ <!-- mappings may be specified here -->
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+ <!-- UNCOMMENT TO ACTIVATE
+ <mime-mapping>
+ <extension>mysuffix</extension>
+ <mime-type>mymime/type</mime-type>
+ </mime-mapping>
+ -->
+
+ <!-- ==================================================================== -->
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ <welcome-file>index.htm</welcome-file>
+ <welcome-file>index.jsp</welcome-file>
+ </welcome-file-list>
+
+</web-app>
Modified: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/DumpHandler.java
==============================================================================
--- avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/DumpHandler.java (original)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/DumpHandler.java Mon Aug 9 04:30:01 2004
@@ -45,9 +45,9 @@
implements Startable, Parameterizable, LogEnabled,
Serviceable, Contextualizable
{
- private Logger m_Logger;
+ private Logger m_Logger;
private HttpContextService m_Context;
- private int m_Index;
+ private int m_Index;
public DumpHandler()
{
Modified: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ErrorPageHandler.java
==============================================================================
--- avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ErrorPageHandler.java (original)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ErrorPageHandler.java Mon Aug 9 04:30:01 2004
@@ -45,9 +45,9 @@
implements Startable, Parameterizable, LogEnabled,
Serviceable, Contextualizable
{
- private Logger m_Logger;
+ private Logger m_Logger;
private HttpContextService m_Context;
- private int m_Index;
+ private int m_Index;
public ErrorPageHandler()
{
Modified: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ExpiryHandler.java
==============================================================================
--- avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ExpiryHandler.java (original)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ExpiryHandler.java Mon Aug 9 04:30:01 2004
@@ -45,9 +45,9 @@
implements Startable, Parameterizable, LogEnabled,
Serviceable, Contextualizable
{
- private Logger m_Logger;
+ private Logger m_Logger;
private HttpContextService m_Context;
- private int m_Index;
+ private int m_Index;
public ExpiryHandler()
{
Modified: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ForwardHandler.java
==============================================================================
--- avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ForwardHandler.java (original)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ForwardHandler.java Mon Aug 9 04:30:01 2004
@@ -49,9 +49,9 @@
implements Startable, Parameterizable, LogEnabled,
Serviceable, Contextualizable, Configurable
{
- private Logger m_Logger;
+ private Logger m_Logger;
private HttpContextService m_Context;
- private int m_Index;
+ private int m_Index;
public ForwardHandler()
{
Modified: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/HTAccessHandler.java
==============================================================================
--- avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/HTAccessHandler.java (original)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/HTAccessHandler.java Mon Aug 9 04:30:01 2004
@@ -45,9 +45,9 @@
implements Startable, Parameterizable, LogEnabled,
Serviceable, Contextualizable
{
- private Logger m_Logger;
+ private Logger m_Logger;
private HttpContextService m_Context;
- private int m_Index;
+ private int m_Index;
public HTAccessHandler()
{
Modified: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/HttpContextImpl.java
==============================================================================
--- avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/HttpContextImpl.java (original)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/HttpContextImpl.java Mon Aug 9 04:30:01 2004
@@ -34,10 +34,6 @@
import org.apache.avalon.framework.logger.LogEnabled;
import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.parameters.ParameterException;
-import org.apache.avalon.framework.parameters.Parameterizable;
-import org.apache.avalon.framework.parameters.Parameters;
-
import org.apache.avalon.framework.service.Serviceable;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
@@ -57,48 +53,26 @@
* @avalon.component name="http-context" lifestyle="singleton"
* @avalon.service type="org.apache.avalon.http.HttpContextService"
*/
-public class HttpContextImpl
+public class HttpContextImpl extends org.mortbay.http.HttpContext
implements LogEnabled, Contextualizable, Serviceable, Startable,
- Disposable, Configurable, HttpContextService, Initializable
+ Disposable, Configurable, HttpContextService
{
private HttpService m_HttpServer;
- private HttpContext m_HttpContext;
- private Logger m_Logger;
private boolean m_Graceful;
- private File m_TemporaryDir;
- private File m_ResourceBase;
- private int m_MaxCacheSize;
- private int m_MaxCachedFilesize;
-
- private ClassLoader m_ClassLoader;
- private RequestLog m_RequestLog;
- private MimeTypes m_MimeTypes;
- private UserRealm m_UserRealm;
- private Authenticator m_Authenticator;
-
- public HttpContextImpl()
- {
- }
+ private Logger m_Logger;
+
public HttpContext getHttpContext()
{
- return m_HttpContext;
+ return this;
}
-
- public void setAuthenticator( Authenticator authenticator )
- {
- m_HttpContext.setAuthenticator( authenticator );
- }
-
- public Authenticator getAuthenticator()
+
+ public Logger getLogger()
{
- return m_HttpContext.getAuthenticator();
+ return m_Logger;
}
-
/**
- * Enable the logging system.
- *
* @avalon.logger name="http"
*/
public void enableLogging( Logger logger )
@@ -106,11 +80,6 @@
m_Logger = logger;
}
- public Logger getLogger()
- {
- return m_Logger;
- }
-
/**
* @avalon.entry key="urn:avalon:temp"
* type="java.io.File"
@@ -120,10 +89,12 @@
public void contextualize( Context ctx )
throws ContextException
{
- m_TemporaryDir = (File) ctx.get( "urn:avalon:temp" );
- m_TemporaryDir.mkdirs();
+ File tmpDir = (File) ctx.get( "urn:avalon:temp" );
+ tmpDir.mkdirs();
+ setTempDirectory( tmpDir );
- m_ClassLoader = (ClassLoader) ctx.get( "urn:avalon:classloader" );
+ ClassLoader cl = (ClassLoader) ctx.get( "urn:avalon:classloader" );
+ setClassLoader( cl );
}
/**
@@ -144,53 +115,67 @@
m_HttpServer = (HttpService) man.lookup( "server" );
if( man.hasService( "authenticator" ) )
- m_Authenticator = (Authenticator) man.lookup( "authenticator" );
+ {
+ Authenticator authenticator = (Authenticator) man.lookup( "authenticator" );
+ if( authenticator != null )
+ setAuthenticator( authenticator );
+ }
if( man.hasService( "realm" ) )
- m_UserRealm = (UserRealm) man.lookup( "realm" );
+ {
+ UserRealm userRealm = (UserRealm) man.lookup( "realm" );
+ if( userRealm != null )
+ {
+ setRealm( userRealm );
+ setRealmName( userRealm.getName() ); // Is this necessary?
+ }
- m_RequestLog = (RequestLog) man.lookup( "request-log" );
+ }
+
+ RequestLog requestLog = (RequestLog) man.lookup( "request-log" );
+ setRequestLog( requestLog );
if( man.hasService( "mimetypes" ) )
- m_MimeTypes = (MimeTypes) man.lookup( "mimetypes" );
- }
-
- public void parameterize( Parameters params )
- throws ParameterException
- {
- String[] names = params.getNames();
- for( int i=0 ; i < names.length ; i++ )
{
- String value = params.getParameter( names[i] );
- m_HttpContext.setInitParameter( names[i], value );
+ MimeTypes mimeTypes = (MimeTypes) man.lookup( "mimetypes" );
+ if( mimeTypes != null )
+ setMimeMap( mimeTypes.getExtensionMap() );
}
}
-
+
public void configure( Configuration conf )
throws ConfigurationException
{
Configuration virtualHostConf = conf.getChild( "virtual-host" );
String virtualHost = virtualHostConf.getValue( null );
+ addVirtualHost( virtualHost );
Configuration contextConf = conf.getChild( "context-path" );
String contextPath = contextConf.getValue( "/" );
-
- m_HttpContext = m_HttpServer.getContext( virtualHost, contextPath );
+ setContextPath( contextPath );
m_Graceful = conf.getChild( "graceful-stop" ).getValueAsBoolean( false );
Configuration attributes = conf.getChild( "attributes" );
configureAttributes( attributes );
+ Configuration initParams = conf.getChild( "init-parameters" );
+ configureInitParameters( initParams );
+
Configuration welcomeFiles = conf.getChild( "welcome-files" );
configureWelcomeFiles( welcomeFiles );
String resourceBase = conf.getChild( "resource-base").getValue( "." );
- m_ResourceBase = new File( resourceBase );
+ File rsrc = new File( resourceBase );
+ setResourceBase( rsrc.getAbsolutePath() );
- m_MaxCachedFilesize = conf.getChild( "max-cached-filesize" ).getValueAsInteger( -1 );
-
- m_MaxCacheSize = conf.getChild( "max-cache-size" ).getValueAsInteger( -1 );
+ int maxCachedFilesize = conf.getChild( "max-cached-filesize" ).getValueAsInteger( -1 );
+ if( maxCachedFilesize > 0 )
+ setMaxCachedFileSize( maxCachedFilesize );
+
+ int maxCacheSize = conf.getChild( "max-cache-size" ).getValueAsInteger( -1 );
+ if( maxCacheSize > 0 )
+ setMaxCacheSize( maxCacheSize );
}
private void configureAttributes( Configuration conf )
@@ -210,7 +195,19 @@
// TODO: setAttribute() support Object as a value.
// need to figure out what that could be and introduce
// support for it.
- m_HttpContext.setAttribute( name, value );
+ setAttribute( name, value );
+ }
+
+ private void configureInitParameters( Configuration conf )
+ throws ConfigurationException
+ {
+ Configuration[] inits = conf.getChildren( "parameter" );
+ for( int i=0 ; i < inits.length ; i++ )
+ {
+ String name = inits[i].getAttribute( "name" );
+ String value = inits[i].getAttribute( "value" );
+ setInitParameter( name, value );
+ }
}
private void configureVirtualHosts( Configuration conf )
@@ -218,7 +215,7 @@
{
Configuration[] hosts = conf.getChildren( "host" );
for( int i=0 ; i < hosts.length ; i++ )
- m_HttpContext.addVirtualHost( hosts[i].getValue() );
+ addVirtualHost( hosts[i].getValue() );
}
private void configureWelcomeFiles( Configuration conf )
@@ -226,79 +223,39 @@
{
Configuration[] files = conf.getChildren( "file" );
for( int i=0 ; i < files.length ; i++ )
- m_HttpContext.addWelcomeFile( files[i].getValue() );
+ addWelcomeFile( files[i].getValue() );
}
- public void initialize()
- throws ConfigurationException
- {
- m_HttpContext.setClassLoader( m_ClassLoader );
- m_HttpContext.setTempDirectory( m_TemporaryDir );
- m_HttpContext.setRequestLog( m_RequestLog );
- m_HttpContext.setResourceBase( m_ResourceBase.getAbsolutePath() );
- if( m_Authenticator != null )
- m_HttpContext.setAuthenticator( m_Authenticator );
- if( m_UserRealm != null )
- {
- m_HttpContext.setRealm( m_UserRealm );
- m_HttpContext.setRealmName( m_UserRealm.getName() ); // Is this necessary?
- }
-
- if( m_MaxCacheSize > 0 )
- m_HttpContext.setMaxCacheSize( m_MaxCacheSize );
- if( m_MaxCachedFilesize > 0 )
- m_HttpContext.setMaxCachedFileSize( m_MaxCachedFilesize );
- if( m_MimeTypes != null )
- m_HttpContext.setMimeMap( m_MimeTypes.getExtensionMap() );
- }
-
public void start()
throws Exception
{
if( m_Logger.isDebugEnabled() )
- m_Logger.debug( "Starting context: " + m_HttpContext );
- m_HttpServer.addContext( m_HttpContext );
- m_HttpContext.start();
+ m_Logger.debug( "Starting context: " + this );
+ m_HttpServer.addContext( this );
+ super.start();
}
public void stop()
- throws Exception
+ throws InterruptedException
{
if( m_Logger.isDebugEnabled() )
- m_Logger.debug( "Stopping context: " + m_HttpContext );
- m_HttpContext.stop( m_Graceful );
- m_HttpServer.removeContext( m_HttpContext );
+ m_Logger.debug( "Stopping context: " + this );
+
+ // The following is need due to strange delegation between the
+ // methods stop() and stop( boolean ) in the superclasses are
+ // inaccurately implemented, and an endless loop will result
+ // unless the isStarted() method is checked.
+ if( isStarted() )
+ super.stop( m_Graceful );
+
+ m_HttpServer.removeContext( this );
}
public void dispose()
{
if( m_Logger.isDebugEnabled() )
- m_Logger.debug( "Disposing context: " + m_HttpContext );
- m_HttpContext.destroy();
+ m_Logger.debug( "Disposing context: " + this );
+ destroy();
m_HttpServer = null;
- m_HttpContext = null;
- }
-
- /* Service Interface */
-
- public void addHandler( HttpHandler handler )
- {
- if( m_Logger.isDebugEnabled() )
- m_Logger.debug( "Adding handler: " + handler );
- m_HttpContext.addHandler( handler );
- }
-
- public void addHandler( int index, HttpHandler handler )
- {
- if( m_Logger.isDebugEnabled() )
- m_Logger.debug( "Adding handler: " + handler );
- m_HttpContext.addHandler( handler );
- }
-
- public void removeHandler( HttpHandler handler )
- {
- if( m_Logger.isDebugEnabled() )
- m_Logger.debug( "Removing handler: " + handler );
- m_HttpContext.removeHandler( handler );
}
}
Modified: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/IPAccessHandler.java
==============================================================================
--- avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/IPAccessHandler.java (original)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/IPAccessHandler.java Mon Aug 9 04:30:01 2004
@@ -49,9 +49,9 @@
implements Startable, Parameterizable, LogEnabled,
Serviceable, Contextualizable
{
- private Logger m_Logger;
+ private Logger m_Logger;
private HttpContextService m_Context;
- private int m_Index;
+ private int m_Index;
public IPAccessHandler()
{
Modified: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/MsieSslHandler.java
==============================================================================
--- avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/MsieSslHandler.java (original)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/MsieSslHandler.java Mon Aug 9 04:30:01 2004
@@ -45,9 +45,9 @@
implements Startable, Parameterizable, LogEnabled,
Serviceable, Contextualizable
{
- private Logger m_Logger;
- private HttpContextService m_Context;
- private int m_Index;
+ private Logger m_Logger;
+ private HttpContextService m_Context;
+ private int m_Index;
public MsieSslHandler()
{
Modified: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/NotFoundHandler.java
==============================================================================
--- avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/NotFoundHandler.java (original)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/NotFoundHandler.java Mon Aug 9 04:30:01 2004
@@ -45,9 +45,9 @@
implements Startable, Parameterizable, LogEnabled,
Serviceable, Contextualizable
{
- private Logger m_Logger;
+ private Logger m_Logger;
private HttpContextService m_Context;
- private int m_Index;
+ private int m_Index;
public NotFoundHandler()
{
Modified: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/NullHandler.java
==============================================================================
--- avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/NullHandler.java (original)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/NullHandler.java Mon Aug 9 04:30:01 2004
@@ -45,9 +45,9 @@
implements Startable, Parameterizable, LogEnabled,
Serviceable, Contextualizable
{
- private Logger m_Logger;
+ private Logger m_Logger;
private HttpContextService m_Context;
- private int m_Index;
+ private int m_Index;
public NullHandler()
{
Modified: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ProxyHandler.java
==============================================================================
--- avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ProxyHandler.java (original)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ProxyHandler.java Mon Aug 9 04:30:01 2004
@@ -45,9 +45,9 @@
implements Startable, Parameterizable, LogEnabled,
Serviceable, Contextualizable
{
- private Logger m_Logger;
+ private Logger m_Logger;
private HttpContextService m_Context;
- private int m_Index;
+ private int m_Index;
public ProxyHandler()
{
Modified: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ResourceHandler.java
==============================================================================
--- avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ResourceHandler.java (original)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ResourceHandler.java Mon Aug 9 04:30:01 2004
@@ -52,9 +52,9 @@
implements Startable, Parameterizable, LogEnabled,
Serviceable, Contextualizable
{
- private Logger m_Logger;
+ private Logger m_Logger;
private HttpContextService m_Context;
- private int m_Index;
+ private int m_Index;
public ResourceHandler()
{
Modified: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/RootNotFoundHandler.java
==============================================================================
--- avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/RootNotFoundHandler.java (original)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/RootNotFoundHandler.java Mon Aug 9 04:30:01 2004
@@ -45,9 +45,9 @@
implements Startable, Parameterizable, LogEnabled,
Serviceable, Contextualizable
{
- private Logger m_Logger;
+ private Logger m_Logger;
private HttpContextService m_Context;
- private int m_Index;
+ private int m_Index;
public RootNotFoundHandler()
{
Modified: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/SecurityHandler.java
==============================================================================
--- avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/SecurityHandler.java (original)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/SecurityHandler.java Mon Aug 9 04:30:01 2004
@@ -45,9 +45,9 @@
implements Startable, Parameterizable, LogEnabled,
Serviceable, Contextualizable
{
- private Logger m_Logger;
+ private Logger m_Logger;
private HttpContextService m_Context;
- private int m_Index;
+ private int m_Index;
public SecurityHandler()
{
Modified: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ServletHandler.java
==============================================================================
--- avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ServletHandler.java (original)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ServletHandler.java Mon Aug 9 04:30:01 2004
@@ -51,9 +51,9 @@
implements Startable, Parameterizable, LogEnabled,
Serviceable, Contextualizable, Configurable
{
- private Logger m_Logger;
+ private Logger m_Logger;
private HttpContextService m_Context;
- private int m_Index;
+ private int m_Index;
public ServletHandler()
{
Modified: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/SetResponseHeadersHandler.java
==============================================================================
--- avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/SetResponseHeadersHandler.java (original)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/SetResponseHeadersHandler.java Mon Aug 9 04:30:01 2004
@@ -49,9 +49,9 @@
implements Startable, Parameterizable, LogEnabled,
Serviceable, Contextualizable
{
- private Logger m_Logger;
+ private Logger m_Logger;
private HttpContextService m_Context;
- private int m_Index;
+ private int m_Index;
public SetResponseHeadersHandler()
{
Added: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/WebApplicationContext.java
==============================================================================
--- (empty file)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/WebApplicationContext.java Mon Aug 9 04:30:01 2004
@@ -0,0 +1,284 @@
+/*
+ * Copyright 2004 Apache Software Foundation
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.avalon.http.impl;
+
+import java.io.File;
+
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.activity.Startable;
+import org.apache.avalon.framework.activity.Initializable;
+
+import org.apache.avalon.framework.configuration.Configurable;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.context.Contextualizable;
+
+import org.apache.avalon.framework.logger.LogEnabled;
+import org.apache.avalon.framework.logger.Logger;
+
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+
+import org.apache.avalon.http.HttpContextService;
+import org.apache.avalon.http.HttpService;
+import org.apache.avalon.http.MimeTypes;
+
+import org.mortbay.http.Authenticator;
+import org.mortbay.http.HttpContext;
+import org.mortbay.http.HttpHandler;
+import org.mortbay.http.RequestLog;
+import org.mortbay.http.UserRealm;
+
+/**
+ * @avalon.component name="http-web-context" lifestyle="singleton"
+ * @avalon.service type="org.apache.avalon.http.HttpContextService"
+ */
+public class WebApplicationContext
+ extends org.mortbay.jetty.servlet.WebApplicationContext
+ implements LogEnabled, Contextualizable, Serviceable, Startable,
+ Disposable, Configurable, HttpContextService
+{
+ private HttpService m_HttpServer;
+ private boolean m_Graceful;
+ private Logger m_Logger;
+
+
+ public HttpContext getHttpContext()
+ {
+ return this;
+ }
+
+ public Logger getLogger()
+ {
+ return m_Logger;
+ }
+
+ /**
+ * @avalon.logger name="http"
+ */
+ public void enableLogging( Logger logger )
+ {
+ m_Logger = logger;
+ }
+
+ /**
+ * @avalon.entry key="urn:avalon:temp"
+ * type="java.io.File"
+ * @avalon.entry key="urn:avalon:classloader"
+ * type="java.lang.ClassLoader"
+ */
+ public void contextualize( Context ctx )
+ throws ContextException
+ {
+ File tmpDir = (File) ctx.get( "urn:avalon:temp" );
+ tmpDir.mkdirs();
+ setTempDirectory( tmpDir );
+
+ ClassLoader cl = (ClassLoader) ctx.get( "urn:avalon:classloader" );
+ setClassLoader( cl );
+ }
+
+ /**
+ * @avalon.dependency type="org.apache.avalon.http.HttpService"
+ * key="server"
+ * @avalon.dependency type="org.apache.avalon.http.MimeTypes"
+ * key="mimetypes" optional="true"
+ * @avalon.dependency type="org.mortbay.http.Authenticator"
+ * key="authenticator" optional="true"
+ * @avalon.dependency type="org.mortbay.http.UserRealm"
+ * key="realm" optional="true"
+ * @avalon.dependency type="org.mortbay.http.RequestLog"
+ * key="request-log"
+ */
+ public void service( ServiceManager man )
+ throws ServiceException
+ {
+ m_HttpServer = (HttpService) man.lookup( "server" );
+
+ if( man.hasService( "authenticator" ) )
+ {
+ Authenticator authenticator = (Authenticator) man.lookup( "authenticator" );
+ if( authenticator != null )
+ setAuthenticator( authenticator );
+ }
+
+ if( man.hasService( "realm" ) )
+ {
+ UserRealm userRealm = (UserRealm) man.lookup( "realm" );
+ if( userRealm != null )
+ {
+ setRealm( userRealm );
+ setRealmName( userRealm.getName() ); // Is this necessary?
+ }
+
+ }
+
+ RequestLog requestLog = (RequestLog) man.lookup( "request-log" );
+ setRequestLog( requestLog );
+
+ if( man.hasService( "mimetypes" ) )
+ {
+ MimeTypes mimeTypes = (MimeTypes) man.lookup( "mimetypes" );
+ if( mimeTypes != null )
+ setMimeMap( mimeTypes.getExtensionMap() );
+ }
+ }
+
+ public void configure( org.apache.avalon.framework.configuration.Configuration conf )
+ throws ConfigurationException
+ {
+ setIgnoreWebJetty( true );
+ setExtractWAR( false );
+
+ String displayName = conf.getChild( "display-name" ).getValue( null );
+ if( displayName != null )
+ setDisplayName( displayName );
+
+ String webApp = conf.getChild( "web-application" ).getValue();
+ setWAR( webApp );
+
+ String defDescr = conf.getChild( "defaults-descriptor" ).getValue( "etc/webdefaults.xml" );
+ setDefaultsDescriptor( defDescr );
+
+ org.apache.avalon.framework.configuration.Configuration errorPageConf = conf.getChild( "error-page" );
+ String uri = errorPageConf.getValue( null );
+ if( uri != null )
+ {
+ String error = errorPageConf.getAttribute( "error" );
+ setErrorPage( error, uri );
+ }
+
+ org.apache.avalon.framework.configuration.Configuration virtualHostConf = conf.getChild( "virtual-host" );
+ String virtualHost = virtualHostConf.getValue( null );
+ addVirtualHost( virtualHost );
+
+ org.apache.avalon.framework.configuration.Configuration contextConf = conf.getChild( "context-path" );
+ String contextPath = contextConf.getValue( "/" );
+ setContextPath( contextPath );
+
+ m_Graceful = conf.getChild( "graceful-stop" ).getValueAsBoolean( false );
+
+ org.apache.avalon.framework.configuration.Configuration attributes = conf.getChild( "attributes" );
+ configureAttributes( attributes );
+
+ org.apache.avalon.framework.configuration.Configuration initParams = conf.getChild( "init-parameters" );
+ configureInitParameters( initParams );
+
+ org.apache.avalon.framework.configuration.Configuration welcomeFiles = conf.getChild( "welcome-files" );
+ configureWelcomeFiles( welcomeFiles );
+
+ String resourceBase = conf.getChild( "resource-base").getValue( "." );
+ File rsrc = new File( resourceBase );
+ setResourceBase( rsrc.getAbsolutePath() );
+
+ int maxCachedFilesize = conf.getChild( "max-cached-filesize" ).getValueAsInteger( -1 );
+ if( maxCachedFilesize > 0 )
+ setMaxCachedFileSize( maxCachedFilesize );
+
+ int maxCacheSize = conf.getChild( "max-cache-size" ).getValueAsInteger( -1 );
+ if( maxCacheSize > 0 )
+ setMaxCacheSize( maxCacheSize );
+ }
+
+ private void configureAttributes( org.apache.avalon.framework.configuration.Configuration conf )
+ throws ConfigurationException
+ {
+ org.apache.avalon.framework.configuration.Configuration[] children = conf.getChildren( "attribute" );
+ for( int i = 0 ; i < children.length ; i++ )
+ configureAttribute( children[i] );
+ }
+
+ private void configureAttribute( org.apache.avalon.framework.configuration.Configuration conf )
+ throws ConfigurationException
+ {
+ String name = conf.getAttribute( "name" );
+ String value = conf.getValue();
+
+ // TODO: setAttribute() support Object as a value.
+ // need to figure out what that could be and introduce
+ // support for it.
+ setAttribute( name, value );
+ }
+
+ private void configureInitParameters( org.apache.avalon.framework.configuration.Configuration conf )
+ throws ConfigurationException
+ {
+ org.apache.avalon.framework.configuration.Configuration[] inits = conf.getChildren( "parameter" );
+ for( int i=0 ; i < inits.length ; i++ )
+ {
+ String name = inits[i].getAttribute( "name" );
+ String value = inits[i].getAttribute( "value" );
+ setInitParameter( name, value );
+ }
+ }
+
+ private void configureVirtualHosts( org.apache.avalon.framework.configuration.Configuration conf )
+ throws ConfigurationException
+ {
+ org.apache.avalon.framework.configuration.Configuration[] hosts = conf.getChildren( "host" );
+ for( int i=0 ; i < hosts.length ; i++ )
+ addVirtualHost( hosts[i].getValue() );
+ }
+
+ private void configureWelcomeFiles( org.apache.avalon.framework.configuration.Configuration conf )
+ throws ConfigurationException
+ {
+ org.apache.avalon.framework.configuration.Configuration[] files = conf.getChildren( "file" );
+ for( int i=0 ; i < files.length ; i++ )
+ addWelcomeFile( files[i].getValue() );
+ }
+
+ public void start()
+ throws Exception
+ {
+ if( m_Logger.isDebugEnabled() )
+ m_Logger.debug( "Starting context: " + this );
+ m_HttpServer.addContext( this );
+ super.start();
+ }
+
+ public void stop()
+ throws InterruptedException
+ {
+ if( m_Logger.isDebugEnabled() )
+ m_Logger.debug( "Stopping context: " + this );
+
+
+ // The following is need due to strange delegation between the
+ // methods stop() and stop( boolean ) in the superclasses are
+ // inaccurately implemented, and an endless loop will result
+ // unless the isStarted() method is checked.
+ if( isStarted() )
+ super.stop( m_Graceful );
+
+ m_HttpServer.removeContext( this );
+ }
+
+ public void dispose()
+ {
+ if( m_Logger.isDebugEnabled() )
+ m_Logger.debug( "Disposing context: " + this );
+ destroy();
+ m_HttpServer = null;
+ }
+}
+
Modified: avalon/trunk/planet/facilities/http/spi/src/main/org/apache/avalon/http/HttpContextService.java
==============================================================================
--- avalon/trunk/planet/facilities/http/spi/src/main/org/apache/avalon/http/HttpContextService.java (original)
+++ avalon/trunk/planet/facilities/http/spi/src/main/org/apache/avalon/http/HttpContextService.java Mon Aug 9 04:30:01 2004
@@ -26,6 +26,7 @@
*/
public interface HttpContextService
{
+ HttpContext getHttpContext();
void addHandler( HttpHandler handler );
@@ -33,7 +34,7 @@
void removeHandler( HttpHandler handler );
- HttpContext getHttpContext();
-
void setAuthenticator( Authenticator authenticator );
+
+ Authenticator getAuthenticator();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org