avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject svn commit: rev 30711 - in avalon/trunk/planet/facilities/http: impl/src/etc impl/src/main/org/apache/avalon/http/impl spi/src/main/org/apache/avalon/http
Date Mon, 26 Jul 2004 10:09:12 GMT
Author: niclas
Date: Mon Jul 26 03:09:11 2004
New Revision: 30711

Modified:
   avalon/trunk/planet/facilities/http/impl/src/etc/default-server.xml
   avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/HttpContextImpl.java
   avalon/trunk/planet/facilities/http/spi/src/main/org/apache/avalon/http/HttpService.java
Log:
Change the way the HttpContext is created.

Modified: avalon/trunk/planet/facilities/http/impl/src/etc/default-server.xml
==============================================================================
--- avalon/trunk/planet/facilities/http/impl/src/etc/default-server.xml	(original)
+++ avalon/trunk/planet/facilities/http/impl/src/etc/default-server.xml	Mon Jul 26 03:09:11
2004
@@ -33,22 +33,19 @@
       <context-path>/niclas/testing</context-path>
     </configuration>
   </component>
-  
+<!--  
   <component name="security-handler" class="org.apache.avalon.http.impl.SecurityHandler"
>
     <parameters>
-      <parameter name="handler-index" value="1" />
     </parameters>
   </component>
   
   <component name="model-handler"    class="org.apache.avalon.http.impl.ModelHandler"
>
     <parameters>
-      <parameter name="handler-index" value="2" />
     </parameters>
   </component>
-  
+-->  
   <component name="resource-handler" class="org.apache.avalon.http.impl.ResourceHandler"
>
     <parameters>
-      <parameter name="handler-index" value="3" />
       <parameter name="allow-directory" value="true" />
       <parameter name="allow-methods" value="GET" />
     </parameters>
@@ -56,16 +53,14 @@
 <!--  
   <component name="notfound-handler" class="org.apache.avalon.http.impl.NotFoundHandler"
>
     <parameters>
-      <parameter name="handler-index" value="4" />
     </parameters>
   </component>
--->  
+
   <component name="errorpage-handler" class="org.apache.avalon.http.impl.ErrorPageHandler"
>
     <parameters>
-      <parameter name="handler-index" value="4" />
     </parameters>
   </component>
-  
+-->    
   <component name="request-log" class="org.apache.avalon.http.impl.NcsaRequestLog" >
     <parameters>
       <parameter name="filename" value="request.log" />

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 Jul 26 03:09:11 2004
@@ -21,6 +21,7 @@
 
 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;
@@ -57,16 +58,18 @@
  */
 public class HttpContextImpl
     implements LogEnabled, Contextualizable, Serviceable, Startable, 
-               Disposable, Configurable, HttpContextService
+               Disposable, Configurable, HttpContextService, Initializable
 {
     private HttpService m_HttpServer;
     private HttpContext m_HttpContext;
     private Logger      m_Logger;
     private boolean     m_Graceful;
-        
+    private File        m_TemporaryDir;
+    private ClassLoader m_ClassLoader;
+    private RequestLog  m_RequestLog;
+    
     public HttpContextImpl()
     {
-        m_HttpContext = new HttpContext();
     }
     
     public HttpContext getHttpContext()
@@ -98,12 +101,10 @@
     public void contextualize( Context ctx )
         throws ContextException
     {
-        File tmpDir = (File) ctx.get( "urn:avalon:temp" );
-        tmpDir.mkdirs();
-        m_HttpContext.setTempDirectory( tmpDir );
+        m_TemporaryDir = (File) ctx.get( "urn:avalon:temp" );
+        m_TemporaryDir.mkdirs();
     
-        ClassLoader cl = (ClassLoader) ctx.get( "urn:avalon:classloader" );
-        m_HttpContext.setClassLoader( cl );
+        m_ClassLoader = (ClassLoader) ctx.get( "urn:avalon:classloader" );
     }
     
     /**
@@ -134,8 +135,7 @@
             m_HttpContext.setRealmName( realm.getName() ); // Is this necessary?
         } 
         
-        RequestLog log = (RequestLog) man.lookup( "request-log" );
-        m_HttpContext.setRequestLog( log );
+        m_RequestLog = (RequestLog) man.lookup( "request-log" );
     }
 
     public void parameterize( Parameters params )
@@ -152,16 +152,18 @@
     public void configure( Configuration conf )
         throws ConfigurationException
     {
+        Configuration virtualHostConf = conf.getChild( "virtual-host" );
+        String virtualHost = virtualHostConf.getValue( null );
+        
+        Configuration contextConf = conf.getChild( "context-path" );
+        String contextPath = contextConf.getValue( "/" );
+        
+        m_HttpContext = m_HttpServer.getContext( virtualHost, contextPath );
+        
         m_Graceful = conf.getChild( "graceful-stop" ).getValueAsBoolean( false );
         
         Configuration attributes = conf.getChild( "attributes" );
         configureAttributes( attributes );
-        
-        Configuration contextPath = conf.getChild( "context-path" );
-        m_HttpContext.setContextPath( contextPath.getValue( "/" ) );
-        
-        Configuration virtualHosts = conf.getChild( "virtual-hosts" );
-        configureVirtualHosts( virtualHosts );
     
         Configuration welcomeFiles = conf.getChild( "welcome-files" );
         configureWelcomeFiles( welcomeFiles );
@@ -202,7 +204,14 @@
         for( int i=0 ; i < files.length ; i++ )
             m_HttpContext.addWelcomeFile( files[i].getValue() );
     }
-    
+
+    public void initialize()
+    {
+        m_HttpContext.setClassLoader( m_ClassLoader );
+        m_HttpContext.setTempDirectory( m_TemporaryDir );
+        m_HttpContext.setRequestLog( m_RequestLog );
+    }
+        
     public void start()
         throws Exception
     {

Modified: avalon/trunk/planet/facilities/http/spi/src/main/org/apache/avalon/http/HttpService.java
==============================================================================
--- avalon/trunk/planet/facilities/http/spi/src/main/org/apache/avalon/http/HttpService.java
(original)
+++ avalon/trunk/planet/facilities/http/spi/src/main/org/apache/avalon/http/HttpService.java
Mon Jul 26 03:09:11 2004
@@ -36,6 +36,8 @@
     
     boolean removeContext( HttpContext context );
     
+    HttpContext getContext( String virtualhost, String contextPath );
+    
     HttpListener addListener( HttpListener listener );
     
     void removeListener( HttpListener listener );

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message