avalon-cvs mailing list archives

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

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/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/ModelHandler.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/SetResponseHeadersHandler.java
   avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/SocketListenerComponent.java
Log:
Forgot to start the handlers + other smaller fixes.

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 01:48:07
2004
@@ -34,15 +34,43 @@
     </configuration>
   </component>
   
-  <component name="model-handler" class="org.apache.avalon.http.impl.ModelHandler" >
-    <configuration>
-      <index>5</index>
-    </configuration>
+  <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>
+  </component>
+<!--  
+  <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" />
+      <parameter name="append" value="true" />
+      <parameter name="extended" value="true" />
     </parameters>
   </component>
   

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 Jul 26 01:48:07 2004
@@ -102,19 +102,23 @@
     }
  
     public void start()
+        throws Exception
     {
-        if( m_Logger.isDebugEnabled() )
-            m_Logger.debug( "Starting DumpHandler: " + this );
         if( m_Index >= 0 )
             m_Context.addHandler( m_Index, this );
         else
             m_Context.addHandler( this );
+        if( m_Logger.isDebugEnabled() )
+            m_Logger.debug( "Starting DumpHandler: " + this );
+        super.start();
     }
     
     public void stop()
+        throws InterruptedException
     {
         if( m_Logger.isDebugEnabled() )
             m_Logger.debug( "Stopping DumpHandler: " + this );
+        super.stop();
         m_Context.removeHandler( this );
     }
 } 

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 Jul 26 01:48:07 2004
@@ -102,19 +102,23 @@
     }
  
     public void start()
+        throws Exception
     {
-        if( m_Logger.isDebugEnabled() )
-            m_Logger.debug( "Starting ErrorPageHandler: " + this );
         if( m_Index >= 0 )
             m_Context.addHandler( m_Index, this );
         else
             m_Context.addHandler( this );
+        if( m_Logger.isDebugEnabled() )
+            m_Logger.debug( "Starting ErrorPageHandler: " + this );
+        super.start();
     }
     
     public void stop()
+        throws InterruptedException
     {
         if( m_Logger.isDebugEnabled() )
             m_Logger.debug( "Stopping ErrorPageHandler: " + this );
+        super.stop();
         m_Context.removeHandler( this );
     }
 } 

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 Jul 26 01:48:07 2004
@@ -106,19 +106,23 @@
     }
  
     public void start()
+        throws Exception
     {
-        if( m_Logger.isDebugEnabled() )
-            m_Logger.debug( "Starting ExpiryHandler: " + this );
         if( m_Index >= 0 )
             m_Context.addHandler( m_Index, this );
         else
             m_Context.addHandler( this );
+        if( m_Logger.isDebugEnabled() )
+            m_Logger.debug( "Starting ExpiryHandler: " + this );
+        super.start();
     }
     
     public void stop()
+        throws InterruptedException
     {
         if( m_Logger.isDebugEnabled() )
             m_Logger.debug( "Stopping ExpiryHandler: " + this );
+        super.stop();
         m_Context.removeHandler( this );
     }
 } 

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 Jul 26 01:48:07 2004
@@ -136,19 +136,23 @@
     }
  
     public void start()
+        throws Exception
     {
-        if( m_Logger.isDebugEnabled() )
-            m_Logger.debug( "Starting ForwardHandler: " + this );
         if( m_Index >= 0 )
             m_Context.addHandler( m_Index, this );
         else
             m_Context.addHandler( this );
+        if( m_Logger.isDebugEnabled() )
+            m_Logger.debug( "Starting ForwardHandler: " + this );
+        super.start();
     }
     
     public void stop()
+        throws InterruptedException
     {
         if( m_Logger.isDebugEnabled() )
             m_Logger.debug( "Stopping ForwardHandler: " + this );
+        super.stop();
         m_Context.removeHandler( this );
     }
 } 

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 Jul 26 01:48:07 2004
@@ -110,19 +110,23 @@
     }
  
     public void start()
+        throws Exception
     {
-        if( m_Logger.isDebugEnabled() )
-            m_Logger.debug( "Starting HTAccessHandler: " + this );
         if( m_Index >= 0 )
             m_Context.addHandler( m_Index, this );
         else
             m_Context.addHandler( this );
+        if( m_Logger.isDebugEnabled() )
+            m_Logger.debug( "Starting HTAccessHandler: " + this );
+        super.start();
     }
     
     public void stop()
+        throws InterruptedException
     {
         if( m_Logger.isDebugEnabled() )
             m_Logger.debug( "Stopping HTAccessHandler: " + this );
+        super.stop();
         m_Context.removeHandler( this );
     }
 } 

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 01:48:07 2004
@@ -90,7 +90,10 @@
     }
     
     /** 
-     * @avalon.entry key="urn:avalon:temp" type="java.io.File"
+     * @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
@@ -98,6 +101,9 @@
         File tmpDir = (File) ctx.get( "urn:avalon:temp" );
         tmpDir.mkdirs();
         m_HttpContext.setTempDirectory( tmpDir );
+    
+        ClassLoader cl = (ClassLoader) ctx.get( "urn:avalon:classloader" );
+        m_HttpContext.setClassLoader( cl );
     }
     
     /**

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 Jul 26 01:48:07 2004
@@ -129,19 +129,23 @@
     }
  
     public void start()
+        throws Exception
     {
-        if( m_Logger.isDebugEnabled() )
-            m_Logger.debug( "Starting IPAccessHandler: " + this );
         if( m_Index >= 0 )
             m_Context.addHandler( m_Index, this );
         else
             m_Context.addHandler( this );
+        if( m_Logger.isDebugEnabled() )
+            m_Logger.debug( "Starting IPAccessHandler: " + this );
+        super.start();
     }
     
     public void stop()
+        throws InterruptedException
     {
         if( m_Logger.isDebugEnabled() )
             m_Logger.debug( "Stopping IPAccessHandler: " + this );
+        super.stop();
         m_Context.removeHandler( this );
     }
 } 

Modified: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ModelHandler.java
==============================================================================
--- avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ModelHandler.java
(original)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ModelHandler.java
Mon Jul 26 01:48:07 2004
@@ -44,6 +44,7 @@
 import org.apache.avalon.http.HttpContextService;
 
 import org.mortbay.http.HttpContext;
+import org.mortbay.http.HttpException;
 import org.mortbay.http.HttpHandler;
 import org.mortbay.http.HttpRequest;
 import org.mortbay.http.HttpResponse;
@@ -136,6 +137,7 @@
 
     public void handle( String pathInContext, String pathParams, 
                         HttpRequest request, HttpResponse response ) 
+        throws HttpException
     {
         getLogger().info( "Request: " + pathInContext + ", " + pathParams );
     }

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 Jul 26 01:48:07 2004
@@ -106,19 +106,23 @@
     }
  
     public void start()
+        throws Exception
     {
-        if( m_Logger.isDebugEnabled() )
-            m_Logger.debug( "Starting MsieSslHandler: " + this );
         if( m_Index >= 0 )
             m_Context.addHandler( m_Index, this );
         else
             m_Context.addHandler( this );
+        if( m_Logger.isDebugEnabled() )
+            m_Logger.debug( "Starting MsieSslHandler: " + this );
+        super.start();
     }
     
     public void stop()
+        throws InterruptedException
     {
         if( m_Logger.isDebugEnabled() )
             m_Logger.debug( "Stopping MsieSslHandler: " + this );
+        super.stop();
         m_Context.removeHandler( this );
     }
 } 

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 Jul 26 01:48:07 2004
@@ -102,19 +102,23 @@
     }
  
     public void start()
+        throws Exception
     {
-        if( m_Logger.isDebugEnabled() )
-            m_Logger.debug( "Starting NotFoundHandler: " + this );
         if( m_Index >= 0 )
             m_Context.addHandler( m_Index, this );
         else
             m_Context.addHandler( this );
+        if( m_Logger.isDebugEnabled() )
+            m_Logger.debug( "Starting NotFoundHandler: " + this );
+        super.start();
     }
     
     public void stop()
+        throws InterruptedException
     {
         if( m_Logger.isDebugEnabled() )
             m_Logger.debug( "Stopping NotFoundHandler: " + this );
+        super.stop();
         m_Context.removeHandler( this );
     }
 } 

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 Jul 26 01:48:07 2004
@@ -102,19 +102,23 @@
     }
  
     public void start()
+        throws Exception
     {
-        if( m_Logger.isDebugEnabled() )
-            m_Logger.debug( "Starting NullHandler: " + this );
         if( m_Index >= 0 )
             m_Context.addHandler( m_Index, this );
         else
             m_Context.addHandler( this );
+        if( m_Logger.isDebugEnabled() )
+            m_Logger.debug( "Starting NullHandler: " + this );
+        super.start();
     }
     
     public void stop()
+        throws InterruptedException
     {
         if( m_Logger.isDebugEnabled() )
             m_Logger.debug( "Stopping NullHandler: " + this );
+        super.stop();
         m_Context.removeHandler( this );
     }
 } 

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 Jul 26 01:48:07 2004
@@ -116,19 +116,23 @@
     }
  
     public void start()
+        throws Exception
     {
-        if( m_Logger.isDebugEnabled() )
-            m_Logger.debug( "Starting ProxyHandler: " + this );
         if( m_Index >= 0 )
             m_Context.addHandler( m_Index, this );
         else
             m_Context.addHandler( this );
+        if( m_Logger.isDebugEnabled() )
+            m_Logger.debug( "Starting ProxyHandler: " + this );
+        super.start();
     }
     
     public void stop()
+        throws InterruptedException
     {
         if( m_Logger.isDebugEnabled() )
             m_Logger.debug( "Stopping ProxyHandler: " + this );
+        super.stop();
         m_Context.removeHandler( this );
     }
 } 

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 Jul 26 01:48:07 2004
@@ -17,6 +17,8 @@
 
 package org.apache.avalon.http.impl;
 
+import java.io.IOException;
+
 import org.apache.avalon.framework.activity.Startable;
 
 import org.apache.avalon.framework.context.Context;
@@ -36,6 +38,11 @@
 
 import org.apache.avalon.http.HttpContextService;
 
+import org.mortbay.http.HttpException;
+import org.mortbay.http.HttpRequest;
+import org.mortbay.http.HttpResponse;
+import org.mortbay.util.Resource;
+
 /**
  * @avalon.component name="http-resource-handler" lifestyle="singleton"
  * @avalon.server    type="org.mortbay.http.HttpHandler"
@@ -122,21 +129,42 @@
     }
  
     public void start()
+        throws Exception
     {
-        if( m_Logger.isDebugEnabled() )
-            m_Logger.debug( "Starting ResourceHandler: " + this );
         if( m_Index >= 0 )
             m_Context.addHandler( m_Index, this );
         else
             m_Context.addHandler( this );
+        if( m_Logger.isDebugEnabled() )
+            m_Logger.debug( "Starting ResourceHandler: " + this );
+        super.start();
     }
     
     public void stop()
+        throws InterruptedException
     {
         if( m_Logger.isDebugEnabled() )
             m_Logger.debug( "Stopping ResourceHandler: " + this );
+        super.stop();
         m_Context.removeHandler( this );
     }
    
+    public void handle( String pathInContext, String pathParams, 
+                        HttpRequest request, HttpResponse response ) 
+        throws HttpException, IOException
+    {
+        getLogger().info( "(ResourceHandler): " + pathInContext + ", " + pathParams );
+        super.handle( pathInContext, pathParams, request, response );
+    }
+
+    public void handleGet( HttpRequest request, HttpResponse response,
+                           String pathInContext, String pathParams,
+                           Resource resource 
+                         ) 
+        throws IOException
+    {
+        getLogger().info( "(ResourceHandler)/GET: " + pathInContext + ", " + pathParams +
", " + resource);
+        super.handleGet( request, response, pathInContext, pathParams, resource );
+    }
 
 }

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 Jul 26 01:48:07 2004
@@ -102,19 +102,23 @@
     }
  
     public void start()
+        throws Exception
     {
-        if( m_Logger.isDebugEnabled() )
-            m_Logger.debug( "Starting RootNotFoundHandler: " + this );
         if( m_Index >= 0 )
             m_Context.addHandler( m_Index, this );
         else
             m_Context.addHandler( this );
+        if( m_Logger.isDebugEnabled() )
+            m_Logger.debug( "Starting RootNotFoundHandler: " + this );
+        super.start();
     }
     
     public void stop()
+        throws InterruptedException
     {
         if( m_Logger.isDebugEnabled() )
             m_Logger.debug( "Stopping RootNotFoundHandler: " + this );
+        super.stop();
         m_Context.removeHandler( this );
     }
 } 

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 Jul 26 01:48:07 2004
@@ -106,19 +106,23 @@
     }
  
     public void start()
+        throws Exception
     {
-        if( m_Logger.isDebugEnabled() )
-            m_Logger.debug( "Starting SecurityHandler: " + this );
         if( m_Index >= 0 )
             m_Context.addHandler( m_Index, this );
         else
             m_Context.addHandler( this );
+        if( m_Logger.isDebugEnabled() )
+            m_Logger.debug( "Starting SecurityHandler: " + this );
+        super.start();
     }
     
     public void stop()
+        throws InterruptedException
     {
         if( m_Logger.isDebugEnabled() )
             m_Logger.debug( "Stopping SecurityHandler: " + this );
+        super.stop();
         m_Context.removeHandler( this );
     }
 } 

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 Jul 26 01:48:07 2004
@@ -130,19 +130,23 @@
     }
  
     public void start()
+        throws Exception
     {
-        if( m_Logger.isDebugEnabled() )
-            m_Logger.debug( "Starting SetResponseHeadersHandler: " + this );
         if( m_Index >= 0 )
             m_Context.addHandler( m_Index, this );
         else
             m_Context.addHandler( this );
+        if( m_Logger.isDebugEnabled() )
+            m_Logger.debug( "Starting SetResponseHeadersHandler: " + this );
+        super.start();
     }
     
     public void stop()
+        throws InterruptedException
     {
         if( m_Logger.isDebugEnabled() )
             m_Logger.debug( "Stopping SetResponseHeadersHandler: " + this );
+        super.stop();
         m_Context.removeHandler( this );
     }
 } 

Modified: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/SocketListenerComponent.java
==============================================================================
--- avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/SocketListenerComponent.java
(original)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/SocketListenerComponent.java
Mon Jul 26 01:48:07 2004
@@ -32,23 +32,22 @@
 
 import org.apache.avalon.http.HttpService;
 
+import org.mortbay.http.HttpListener;
 import org.mortbay.http.SocketListener;
 
 /** Wrapper for the Jetty SocketListener.
  *
  * @avalon.component name="http-socket-listener" lifestyle="singleton"
+ * @avalon.service type="org.mortbay.http.HttpListener"
  */
-public class SocketListenerComponent
-    implements Parameterizable, Startable, Serviceable, LogEnabled
+public class SocketListenerComponent extends SocketListener
+    implements Parameterizable, Startable, Serviceable, LogEnabled, HttpListener
 {
-    private SocketListener m_SocketListener;
-    
     private HttpService m_HttpServer;
     private Logger      m_Logger;
     
     public SocketListenerComponent()
     {
-        m_SocketListener = new SocketListener();
     }
     
     /**
@@ -71,51 +70,51 @@
     {
         int reserve = params.getParameterAsInteger( "buffer-reserve", -1 );
         if( reserve > 0 )
-            m_SocketListener.setBufferReserve( reserve );
+            setBufferReserve( reserve );
         
         int size = params.getParameterAsInteger( "buffer-size", -1 );
         if( size > 0 )
-            m_SocketListener.setBufferSize( size );
+            setBufferSize( size );
     
         int confPort = params.getParameterAsInteger( "confidential-port", -1 );
         if( confPort > 0 )
-            m_SocketListener.setConfidentialPort( confPort );
+            setConfidentialPort( confPort );
         
         String confScheme = params.getParameter( "confidential-scheme", null );
         if( confScheme != null )
-            m_SocketListener.setConfidentialScheme( confScheme );
+            setConfidentialScheme( confScheme );
     
         String defScheme = params.getParameter( "default-scheme", null );
         if( defScheme != null )
-            m_SocketListener.setDefaultScheme( defScheme );
+            setDefaultScheme( defScheme );
         
         int integralPort = params.getParameterAsInteger( "integral-port", -1 );
         if( integralPort > 0 )
-            m_SocketListener.setIntegralPort( integralPort );
+            setIntegralPort( integralPort );
         
         String integralScheme = params.getParameter( "integral-scheme", null );
         if( integralScheme != null )
-            m_SocketListener.setIntegralScheme( integralScheme );
+            setIntegralScheme( integralScheme );
     
         String host = params.getParameter( "hostname", null );
         try
         {
             if( host != null )
-                m_SocketListener.setHost( host );
+                setHost( host );
         } catch( java.net.UnknownHostException e )
         {
             throw new ParameterException( "Unknown hostname: " + host );
         }
         
         int port = params.getParameterAsInteger( "port", 8080 );
-        m_SocketListener.setPort( port );
+        setPort( port );
         
         int lowResMs = params.getParameterAsInteger( "low-resource-persist-ms", -1 );
         if( lowResMs > 0 )
-            m_SocketListener.setLowResourcePersistTimeMs( lowResMs );
+            setLowResourcePersistTimeMs( lowResMs );
         
         boolean identify = params.getParameterAsBoolean( "identify-listener", false );
-        m_SocketListener.setIdentifyListener( identify );
+        setIdentifyListener( identify );
         
         
     }
@@ -134,17 +133,17 @@
         throws Exception
     {
         if( m_Logger.isDebugEnabled() )
-            m_Logger.debug( "Starting socket: " + m_SocketListener );
-        m_HttpServer.addListener( m_SocketListener );
-        m_SocketListener.start();
+            m_Logger.debug( "Starting socket: " + this );
+        m_HttpServer.addListener( this );
+        super.start();
     }
     
     public void stop()
-        throws Exception
+        throws InterruptedException
     {
         if( m_Logger.isDebugEnabled() )
-            m_Logger.debug( "Stopping socket: " + m_SocketListener );
-        m_SocketListener.stop();
-        m_HttpServer.removeListener( m_SocketListener );
+            m_Logger.debug( "Stopping socket: " + this );
+        super.stop();
+        m_HttpServer.removeListener( this );
     }
 } 

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


Mime
View raw message