Author: niclas
Date: Sun Jul 25 03:09:22 2004
New Revision: 23230
Added:
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/HttpContextImpl.java (contents, props changed)
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/HttpServerImpl.java (contents, props changed)
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ModelHandler.java (contents, props changed)
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/NcsaRequestLog.java (contents, props changed)
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/SocketListenerComponent.java (contents, props changed)
avalon/trunk/planet/facilities/http/spi/src/main/org/apache/avalon/http/HttpContextService.java (contents, props changed)
Removed:
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/AvalonLogSink.java
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ComponentModelHolder.java
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ContainmentModelHandler.java
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/DefaultModelListener.java
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/DefaultServer.java
avalon/trunk/planet/facilities/http/spi/src/main/org/apache/avalon/http/HttpException.java
avalon/trunk/planet/facilities/http/spi/src/main/org/apache/avalon/http/HttpRuntimeException.java
Modified:
avalon/trunk/planet/facilities/http/spi/src/main/org/apache/avalon/http/HttpService.java
Log:
Scrapped the old Http Facility in its entirety and started one that basically componentize the Jetty server.
Added: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/HttpContextImpl.java
==============================================================================
--- (empty file)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/HttpContextImpl.java Sun Jul 25 03:09:22 2004
@@ -0,0 +1,219 @@
+/*
+ * 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.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.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;
+
+import org.apache.avalon.http.HttpContextService;
+import org.apache.avalon.http.HttpService;
+
+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;
+
+/** Wrapper for the Jetty HttpContext.
+ *
+ * @avalon.component name="http-context" lifestyle="singleton"
+ */
+public class HttpContextImpl
+ implements LogEnabled, Contextualizable, Serviceable, Startable,
+ Disposable, Configurable, HttpContextService
+{
+ private HttpService m_HttpServer;
+ private HttpContext m_HttpContext;
+ private Logger m_Logger;
+ private boolean m_Graceful;
+
+ public HttpContextImpl()
+ {
+ m_HttpContext = new HttpContext();
+ }
+
+ /**
+ * Enable the logging system.
+ *
+ * @avalon.logger name="http"
+ */
+ public void enableLogging( Logger logger )
+ {
+ m_Logger = logger;
+ }
+
+ public Logger getLogger()
+ {
+ return m_Logger;
+ }
+
+ /**
+ * @avalon.entry key="urn:avalon:temp" type="java.io.File"
+ */
+ public void contextualize( Context ctx )
+ throws ContextException
+ {
+ File tmpDir = (File) ctx.get( "urn:avalon:temp" );
+ m_HttpContext.setTempDirectory( tmpDir );
+ }
+
+ /**
+ * @avalon.dependency type="org.apache.avalon.http.HttpService"
+ * key="server"
+ * @avalon.dependency type="org.mortbay.http.Authenticator"
+ * key="authenticator"
+ * @avalon.dependency type="org.mortbay.http.UserRealm"
+ * key="realm"
+ * @avalon.dependency type="org.mortbay.http.RequestLog"
+ * key="request-log"
+ */
+ public void service( ServiceManager man )
+ throws ServiceException
+ {
+ m_HttpServer = (HttpService) man.lookup( "server" );
+
+ Authenticator auth = (Authenticator) man.lookup( "authenticator" );
+ m_HttpContext.setAuthenticator( auth );
+
+ UserRealm realm = (UserRealm) man.lookup( "realm" );
+ m_HttpContext.setRealm( realm );
+ m_HttpContext.setRealmName( realm.getName() ); // Is this necessary?
+
+ RequestLog log = (RequestLog) man.lookup( "request-log" );
+ m_HttpContext.setRequestLog( log );
+ }
+
+ 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 );
+ }
+ }
+
+ public void configure( Configuration conf )
+ throws ConfigurationException
+ {
+ 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 );
+ }
+
+ private void configureAttributes( Configuration conf )
+ throws ConfigurationException
+ {
+ Configuration[] children = conf.getChildren( "attribute" );
+ for( int i = 0 ; i < children.length ; i++ )
+ configureAttribute( children[i] );
+ }
+
+ private void configureAttribute( 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.
+ m_HttpContext.setAttribute( name, value );
+ }
+
+ private void configureVirtualHosts( Configuration conf )
+ throws ConfigurationException
+ {
+ Configuration[] hosts = conf.getChildren( "host" );
+ for( int i=0 ; i < hosts.length ; i++ )
+ m_HttpContext.addVirtualHost( hosts[i].getValue() );
+ }
+
+ private void configureWelcomeFiles( Configuration conf )
+ throws ConfigurationException
+ {
+ Configuration[] files = conf.getChildren( "file" );
+ for( int i=0 ; i < files.length ; i++ )
+ m_HttpContext.addWelcomeFile( files[i].getValue() );
+ }
+
+ public void start()
+ throws Exception
+ {
+ m_HttpServer.addContext( m_HttpContext );
+ m_HttpContext.start();
+ }
+
+ public void stop()
+ throws Exception
+ {
+ m_HttpContext.stop( m_Graceful );
+ m_HttpServer.removeContext( m_HttpContext );
+ }
+
+ public void dispose()
+ {
+ m_HttpContext.destroy();
+ m_HttpServer = null;
+ m_HttpContext = null;
+ }
+
+ /* Service Interface */
+
+ public void addHandler( HttpHandler handler )
+ {
+ m_HttpContext.addHandler( handler );
+ }
+
+ public void removeHandler( HttpHandler handler )
+ {
+ m_HttpContext.removeHandler( handler );
+ }
+}
Added: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/HttpServerImpl.java
==============================================================================
--- (empty file)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/HttpServerImpl.java Sun Jul 25 03:09:22 2004
@@ -0,0 +1,97 @@
+/*
+ * 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 org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.activity.Startable;
+
+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.http.HttpService;
+
+import org.mortbay.http.HttpServer;
+import org.mortbay.util.MultiException;
+
+/** Wrapper for the Jetty HttpServer
+ *
+ * @avalon.component name="http-server" lifestyle="singleton"
+ */
+public class HttpServerImpl extends HttpServer
+ implements LogEnabled, Parameterizable, Startable, Disposable, HttpService
+{
+ private Logger m_Logger;
+ private boolean m_Graceful;
+
+
+ public HttpServerImpl()
+ {
+ }
+
+ /**
+ * Enable the logging system.
+ *
+ * @avalon.logger name="http"
+ */
+ public void enableLogging( Logger logger )
+ {
+ m_Logger = logger;
+ }
+
+ public Logger getLogger()
+ {
+ return m_Logger;
+ }
+
+ public void parameterize( Parameters params )
+ throws ParameterException
+ {
+ boolean trace = params.getParameterAsBoolean( "trace", false );
+ setTrace( trace );
+
+ boolean anonymous = params.getParameterAsBoolean( "anonymous", false );
+ setAnonymous( anonymous );
+
+ m_Graceful = params.getParameterAsBoolean( "graceful-stop", false );
+
+ int reqs = params.getParameterAsInteger( "request-gc", -1 );
+ if( reqs > 0 )
+ setRequestsPerGC( reqs );
+ }
+
+ public void start()
+ throws MultiException
+ {
+ super.start();
+ }
+
+ public void stop()
+ throws InterruptedException
+ {
+ super.stop( m_Graceful );
+ }
+
+ public void dispose()
+ {
+ super.destroy();
+ }
+}
Added: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ModelHandler.java
==============================================================================
--- (empty file)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ModelHandler.java Sun Jul 25 03:09:22 2004
@@ -0,0 +1,164 @@
+/*
+ * 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 org.apache.avalon.composition.event.CompositionEvent;
+import org.apache.avalon.composition.event.CompositionListener;
+import org.apache.avalon.composition.model.ContainmentModel;
+import org.apache.avalon.composition.model.ComponentModel;
+import org.apache.avalon.composition.model.DeploymentModel;
+
+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.HttpRequestHandler;
+
+import org.mortbay.http.HttpContext;
+import org.mortbay.http.HttpHandler;
+import org.mortbay.http.HttpRequest;
+import org.mortbay.http.HttpResponse;
+
+/** Wrapper for the Jetty HttpContext.
+ *
+ * @avalon.component name="http-model-handler" lifestyle="singleton"
+ * @avalon.service type="org.mortbay.http.HttpHandler"
+ */
+public class ModelHandler
+ implements Serviceable, Configurable, Contextualizable,
+ HttpHandler, CompositionListener
+{
+ private ContainmentModel m_Model;
+ private HttpContext m_Context;
+ private String m_Name;
+ private boolean m_Started;
+
+ public ModelHandler()
+ {
+ m_Started = false;
+ }
+
+ /**
+ * Contextulaization of the listener by the container during
+ * which we are supplied with the root composition model for
+ * the application.
+ *
+ * @param context the supplied listener context
+ *
+ * @exception ContextException if a contextualization error occurs
+ *
+ * @avalon.entry key="urn:composition:containment.model"
+ * type="org.apache.avalon.composition.model.ContainmentModel"
+ *
+ * @avalon.entry key="urn:avalon:name"
+ * type="java.lang.String"
+ */
+ public void contextualize( Context ctx )
+ throws ContextException
+ {
+ m_Model = (ContainmentModel) ctx.get( "urn:composition:containment.model" );
+ m_Name = (String) ctx.get( "urn:avalon:name" );
+ }
+
+ public void service( ServiceManager man )
+ throws ServiceException
+ {
+ }
+
+ public void configure( Configuration conf )
+ throws ConfigurationException
+ {
+ }
+
+ /* HttpHandler interface */
+
+ public HttpContext getHttpContext()
+ {
+ return m_Context;
+ }
+
+ public String getName()
+ {
+ return m_Name;
+ }
+
+ public void handle( String pathInContext, String pathParams,
+ HttpRequest request, HttpResponse response )
+ {
+
+ }
+
+ public void initialize( HttpContext context )
+ {
+ m_Context = context;
+ }
+
+ /* Jetty LifeCycle interface */
+
+ public boolean isStarted()
+ {
+ return m_Started;
+ }
+
+ public void start()
+ {
+ m_Started = true;
+ }
+
+ public void stop()
+ {
+ m_Started = false;
+ }
+
+ /* CompositionListener interface */
+
+ /**
+ * Model addition.
+ */
+ public void modelAdded( CompositionEvent event )
+ {
+ DeploymentModel model = event.getChild();
+ if( ! ( model instanceof HttpRequestHandler ) )
+ return;
+
+ // TODO:
+ }
+
+ /**
+ * Model removal.
+ */
+ public void modelRemoved( CompositionEvent event )
+ {
+ DeploymentModel model = event.getChild();
+ if( ! ( model instanceof HttpRequestHandler ) )
+ return;
+
+ // TODO:
+ }
+}
Added: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/NcsaRequestLog.java
==============================================================================
--- (empty file)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/NcsaRequestLog.java Sun Jul 25 03:09:22 2004
@@ -0,0 +1,109 @@
+/*
+ * 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.util.ArrayList;
+import java.util.StringTokenizer;
+
+import org.apache.avalon.framework.activity.Startable;
+
+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.mortbay.http.NCSARequestLog;
+import org.mortbay.http.RequestLog;
+
+
+/** Wrapper for the Jetty NCSA request logger.
+ *
+ * @avalon.component name="http-ncsa-log" lifestyle="singleton"
+ */
+public class NcsaRequestLog extends NCSARequestLog
+ implements RequestLog, Parameterizable, Startable
+{
+ public NcsaRequestLog()
+ {
+ }
+
+ public void parameterize( Parameters params )
+ throws ParameterException
+ {
+ boolean append = params.getParameterAsBoolean( "append", false );
+ setAppend( append );
+
+ boolean buffered = params.getParameterAsBoolean( "buffered", false );
+ setBuffered( buffered );
+
+ boolean extended = params.getParameterAsBoolean( "extended", false );
+ setExtended( extended );
+
+ boolean preferProxiedFor = params.getParameterAsBoolean( "prefer-proxied-for", false );
+ setPreferProxiedForAddress( preferProxiedFor );
+
+ String filename = params.getParameter( "filename", null );
+ if( filename != null )
+ setFilename( filename );
+
+ String dateformat = params.getParameter( "dateformat", null );
+ if( dateformat != null )
+ setLogDateFormat( dateformat );
+
+ String ignorepaths = params.getParameter( "ignore-paths", null );
+ if( filename != null )
+ {
+ String[] paths = tokenize( ignorepaths );
+ setIgnorePaths( paths );
+ }
+
+ String timezone = params.getParameter( "timezone", null );
+ if( timezone != null )
+ setLogTimeZone( timezone );
+
+ int retain = params.getParameterAsInteger( "retain-days", -1 );
+ if( retain > 0 )
+ setRetainDays( retain );
+ }
+
+ private String[] tokenize( String string )
+ {
+ ArrayList result = new ArrayList();
+ StringTokenizer st = new StringTokenizer( string, " ,", false );
+ while( st.hasMoreTokens() )
+ {
+ result.add( st.nextToken() );
+ }
+ String[] retVal = new String[ result.size() ];
+ result.toArray( retVal );
+ return retVal;
+ }
+
+ public void start()
+ throws Exception
+ {
+ super.start();
+ }
+
+ public void stop()
+ {
+ super.stop();
+ }
+}
Added: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/SocketListenerComponent.java
==============================================================================
--- (empty file)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/SocketListenerComponent.java Sun Jul 25 03:09:22 2004
@@ -0,0 +1,133 @@
+/*
+ * 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 org.apache.avalon.framework.activity.Startable;
+
+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;
+
+import org.apache.avalon.http.HttpService;
+
+import org.mortbay.http.SocketListener;
+
+/** Wrapper for the Jetty SocketListener.
+ *
+ * @avalon.component name="http-socket-listener" lifestyle="singleton"
+ */
+public class SocketListenerComponent
+ implements Parameterizable, Startable, Serviceable, LogEnabled
+{
+ private SocketListener m_SocketListener;
+
+ private HttpService m_HttpServer;
+ private Logger m_Logger;
+
+ public SocketListenerComponent()
+ {
+ m_SocketListener = new SocketListener();
+ }
+
+ /**
+ * Enable the logging system.
+ *
+ * @avalon.logger name="http"
+ */
+ public void enableLogging( Logger logger )
+ {
+ m_Logger = logger;
+ }
+
+ public Logger getLogger()
+ {
+ return m_Logger;
+ }
+
+ public void parameterize( Parameters params )
+ throws ParameterException
+ {
+ int reserve = params.getParameterAsInteger( "buffer-reserve", -1 );
+ if( reserve > 0 )
+ m_SocketListener.setBufferReserve( reserve );
+
+ int size = params.getParameterAsInteger( "buffer-size", -1 );
+ if( size > 0 )
+ m_SocketListener.setBufferSize( size );
+
+ int confPort = params.getParameterAsInteger( "confidential-port", -1 );
+ if( confPort > 0 )
+ m_SocketListener.setConfidentialPort( confPort );
+
+ String confScheme = params.getParameter( "confidential-scheme", null );
+ if( confScheme != null )
+ m_SocketListener.setConfidentialScheme( confScheme );
+
+ String defScheme = params.getParameter( "default-scheme", null );
+ if( defScheme != null )
+ m_SocketListener.setDefaultScheme( defScheme );
+
+ int integralPort = params.getParameterAsInteger( "integral-port", -1 );
+ if( integralPort > 0 )
+ m_SocketListener.setIntegralPort( integralPort );
+
+ String integralScheme = params.getParameter( "integral-scheme", null );
+ if( integralScheme != null )
+ m_SocketListener.setIntegralScheme( integralScheme );
+
+ int lowResMs = params.getParameterAsInteger( "low-resource-persist-ms", -1 );
+ if( lowResMs > 0 )
+ m_SocketListener.setLowResourcePersistTimeMs( lowResMs );
+
+ boolean identify = params.getParameterAsBoolean( "identify-listener", false );
+ m_SocketListener.setIdentifyListener( identify );
+
+
+ }
+
+ /**
+ * @avalon.dependency type="org.apache.avalon.http.HttpService"
+ * key="server"
+ */
+ public void service( ServiceManager man )
+ throws ServiceException
+ {
+ m_HttpServer = (HttpService) man.lookup( "server" );
+ }
+
+ public void start()
+ throws Exception
+ {
+ m_HttpServer.addListener( m_SocketListener );
+ m_SocketListener.start();
+ }
+
+ public void stop()
+ throws Exception
+ {
+ m_SocketListener.stop();
+ m_HttpServer.removeListener( m_SocketListener );
+ }
+}
Added: avalon/trunk/planet/facilities/http/spi/src/main/org/apache/avalon/http/HttpContextService.java
==============================================================================
--- (empty file)
+++ avalon/trunk/planet/facilities/http/spi/src/main/org/apache/avalon/http/HttpContextService.java Sun Jul 25 03:09:22 2004
@@ -0,0 +1,32 @@
+/*
+ * 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;
+
+import org.mortbay.http.HttpHandler;
+
+/**
+ * avalon.service version="1.0"
+ */
+public interface HttpContextService
+{
+
+ void addHandler( HttpHandler handler );
+
+ void removeHandler( HttpHandler handler );
+
+}
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 Sun Jul 25 03:09:22 2004
@@ -17,22 +17,35 @@
package org.apache.avalon.http;
-import org.apache.avalon.composition.model.ComponentModel;
+
+import org.mortbay.http.HttpContext;
+import org.mortbay.http.HttpListener;
+import org.mortbay.http.HttpServer;
+import org.mortbay.http.RequestLog;
+import org.mortbay.http.UserRealm;
/**
* Defintion of the HttpService service contract.
+ *
+ * @avalon.service version="1.0"
*/
public interface HttpService
{
- /**
- * Register a component model under a context.
- * @param model the component model
- */
- void register( ComponentModel model );
- /**
- * Unregister the component model under the context.
- * @param model the component model
- */
- void unregister( ComponentModel model );
+ HttpContext addContext( HttpContext context );
+
+ boolean removeContext( HttpContext context );
+
+ HttpListener addListener( HttpListener listener );
+
+ void removeListener( HttpListener listener );
+
+ UserRealm addRealm( UserRealm realm );
+
+ UserRealm removeRealm( String realmname );
+
+ RequestLog getRequestLog();
+
+ void setRequestLog( RequestLog log );
+
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.