Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2885 - in development/main/test/components/http/impl: . src/main/net/dpml/http/impl

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT dpml.net
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r2885 - in development/main/test/components/http/impl: . src/main/net/dpml/http/impl
  • Date: Fri, 17 Jun 2005 18:53:56 -0400

Author: mcconnell AT dpml.net
Date: Fri Jun 17 18:53:56 2005
New Revision: 2885

Removed:

development/main/test/components/http/impl/src/main/net/dpml/http/impl/Ajp13Listener.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/ClientCertAuthenticator.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/ConfigurationMimeTypes.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/DumpHandler.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/ErrorPageHandler.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/ExpiryHandler.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/FormAuthenticator.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/ForwardHandler.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/HTAccessHandler.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/HashSessionManager.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/HashUserRealm.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/HttpContextImpl.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/HttpServerImpl.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/IPAccessHandler.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/JaasUserRealm.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/JsseListener.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/ModelHandler.java

development/main/test/components/http/impl/src/main/net/dpml/http/impl/ModelHandler.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/MsieSslHandler.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/NcsaRequestLog.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/NotFoundHandler.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/NullHandler.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/ProxyHandler.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/ResourceHandler.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/RootNotFoundHandler.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/SecurityConstraint.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/SecurityHandler.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/ServletHandler.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/SetResponseHeadersHandler.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/SocketListener.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/SystemMimeTypes.xprofile

development/main/test/components/http/impl/src/main/net/dpml/http/impl/WebApplicationContext.xprofile
Modified:
development/main/test/components/http/impl/build.xml

development/main/test/components/http/impl/src/main/net/dpml/http/impl/NullHandler.java

development/main/test/components/http/impl/src/main/net/dpml/http/impl/ProxyHandler.java

development/main/test/components/http/impl/src/main/net/dpml/http/impl/ResourceHandler.java

development/main/test/components/http/impl/src/main/net/dpml/http/impl/RootNotFoundHandler.java

development/main/test/components/http/impl/src/main/net/dpml/http/impl/SecurityConstraint.java

development/main/test/components/http/impl/src/main/net/dpml/http/impl/SecurityHandler.java

development/main/test/components/http/impl/src/main/net/dpml/http/impl/ServletHandler.java

development/main/test/components/http/impl/src/main/net/dpml/http/impl/SetResponseHeadersHandler.java

development/main/test/components/http/impl/src/main/net/dpml/http/impl/SocketListener.java

development/main/test/components/http/impl/src/main/net/dpml/http/impl/SystemMimeTypes.java
Log:
updating to FTupdating

Modified: development/main/test/components/http/impl/build.xml
==============================================================================
--- development/main/test/components/http/impl/build.xml (original)
+++ development/main/test/components/http/impl/build.xml Fri Jun 17
18:53:56 2005
@@ -25,6 +25,35 @@

<types xmlns="plugin:dpml/composition/dpml-composition-builder">
<type class="net.dpml.http.impl.Ajp13Listener" threadsafe="true"/>
+ <type class="net.dpml.http.impl.ClientCertAuthenticator"
threadsafe="true"/>
+ <type class="net.dpml.http.impl.ConfigurationMimeTypes"
threadsafe="true"/>
+ <type class="net.dpml.http.impl.DumpHandler" threadsafe="true"/>
+ <type class="net.dpml.http.impl.ErrorPageHandler" threadsafe="true"/>
+ <type class="net.dpml.http.impl.ExpiryHandler" threadsafe="true"/>
+ <type class="net.dpml.http.impl.FormAuthenticator" threadsafe="true"/>
+ <type class="net.dpml.http.impl.ForwardHandler" threadsafe="true"/>
+ <type class="net.dpml.http.impl.HashSessionManager" threadsafe="true"/>
+ <type class="net.dpml.http.impl.HashUserRealm" threadsafe="true"/>
+ <type class="net.dpml.http.impl.HttpContextImpl" threadsafe="true"/>
+ <type class="net.dpml.http.impl.HttpServerImpl" threadsafe="true"/>
+ <type class="net.dpml.http.impl.IPAccessHandler" threadsafe="true"/>
+ <type class="net.dpml.http.impl.JassUserRealm" threadsafe="true"/>
+ <type class="net.dpml.http.impl.JsseListener" threadsafe="true"/>
+ <!--<type class="net.dpml.http.impl.ModelHandler"
threadsafe="true"/>-->
+ <type class="net.dpml.http.impl.MsieSslHandler" threadsafe="true"/>
+ <type class="net.dpml.http.impl.NcsaRequestLog" threadsafe="true"/>
+ <type class="net.dpml.http.impl.NotFoundHandler" threadsafe="true"/>
+ <type class="net.dpml.http.impl.NullHandler" threadsafe="true"/>
+ <type class="net.dpml.http.impl.ProxyHandler" threadsafe="true"/>
+ <type class="net.dpml.http.impl.ResourceHandler" threadsafe="true"/>
+ <type class="net.dpml.http.impl.RootNotFoundHandler"
threadsafe="true"/>
+ <type class="net.dpml.http.impl.SecurityConstraint" threadsafe="true"/>
+ <type class="net.dpml.http.impl.SecurityHandler" threadsafe="true"/>
+ <type class="net.dpml.http.impl.ServletHandler" threadsafe="true"/>
+ <type class="net.dpml.http.impl.SetResponseHeadersHandler"
threadsafe="true"/>
+ <type class="net.dpml.http.impl.SocketListener" threadsafe="true"/>
+ <type class="net.dpml.http.impl.SystemMimeTypes" threadsafe="true"/>
+ <type class="net.dpml.http.impl.WebApplicationContext"
threadsafe="true"/>
</types>
</target>


Modified:
development/main/test/components/http/impl/src/main/net/dpml/http/impl/NullHandler.java
==============================================================================
---
development/main/test/components/http/impl/src/main/net/dpml/http/impl/NullHandler.java
(original)
+++
development/main/test/components/http/impl/src/main/net/dpml/http/impl/NullHandler.java
Fri Jun 17 18:53:56 2005
@@ -43,8 +43,7 @@
m_index = context.getHandlerIndex( -1 );
}

- public void start()
- throws Exception
+ public void start() throws Exception
{
if( m_index >= 0 )
{

Modified:
development/main/test/components/http/impl/src/main/net/dpml/http/impl/ProxyHandler.java
==============================================================================
---
development/main/test/components/http/impl/src/main/net/dpml/http/impl/ProxyHandler.java
(original)
+++
development/main/test/components/http/impl/src/main/net/dpml/http/impl/ProxyHandler.java
Fri Jun 17 18:53:56 2005
@@ -16,18 +16,8 @@
package net.dpml.http.impl;

import net.dpml.activity.Startable;
-import net.dpml.context.Context;
-import net.dpml.context.ContextException;
-import net.dpml.context.Contextualizable;
-import net.dpml.logging.LogEnabled;
import net.dpml.logging.Logger;
-import net.dpml.parameters.ParameterException;
-import net.dpml.parameters.Parameterizable;
-import net.dpml.parameters.Parameters;
import net.dpml.http.HttpContextService;
-import net.dpml.service.ServiceException;
-import net.dpml.service.ServiceManager;
-import net.dpml.service.Serviceable;

/**
* @metro.component name="http-proxy-handler" lifestyle="singleton"
@@ -37,35 +27,35 @@
extends org.mortbay.http.handler.ProxyHandler
implements Startable
{
+ public interface Context
+ {
+ String getName();
+ HttpContextService getHttpContext();
+ int getHandlerIndex( int value );
+ String getProxyHostsWhiteList( String value );
+ String getProxyHostsBlackList( String value );
+ }
+
private Logger m_logger;
private HttpContextService m_context;
private int m_index;

- /**
- * @metro.logger name="http"
- * @metro.entry key="urn:metro:name"
- * type="java.lang.String"
- * @metro.dependency type="net.dpml.http.HttpContextService"
- * key="http-context"
- */
- public ProxyHandler( Logger logger, Context ctx, Parameters params,
ServiceManager man )
- throws ContextException, ServiceException
+ public ProxyHandler( Logger logger, Context context )
{
m_logger = logger;
- m_context = (HttpContextService) man.lookup( "http-context" );
- String name = (String) ctx.get( "urn:metro:name" );
+ m_context = context.getHttpContext();
+ String name = context.getName();
setName( name );
-
- m_index = params.getParameterAsInteger( "handler-index", -1 );
+ m_index = context.getHandlerIndex( -1 );

- String whitelist = params.getParameter( "proxy-host-white-list",
null );
+ String whitelist = context.getProxyHostsWhiteList( null );
if( whitelist != null )
{
String[] hosts = StringUtils.tokenize( whitelist );
setProxyHostsWhiteList( hosts );
}

- String blacklist = params.getParameter( "proxy-host-black-list",
null );
+ String blacklist = context.getProxyHostsBlackList( null );
if( blacklist != null )
{
String[] hosts = StringUtils.tokenize( blacklist );
@@ -73,26 +63,36 @@
}
}

- public void start()
- throws Exception
+ public void start() throws Exception
{
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 );
+ }
if( ! isStarted() )
+ {
super.start();
+ }
}

- public void stop()
- throws InterruptedException
+ public void stop() throws InterruptedException
{
if( m_logger.isDebugEnabled() )
+ {
m_logger.debug( "Stopping ProxyHandler: " + this );
+ }
if( isStarted() )
+ {
super.stop();
+ }
m_context.removeHandler( this );
}
}

Modified:
development/main/test/components/http/impl/src/main/net/dpml/http/impl/ResourceHandler.java
==============================================================================
---
development/main/test/components/http/impl/src/main/net/dpml/http/impl/ResourceHandler.java
(original)
+++
development/main/test/components/http/impl/src/main/net/dpml/http/impl/ResourceHandler.java
Fri Jun 17 18:53:56 2005
@@ -16,18 +16,8 @@
package net.dpml.http.impl;

import net.dpml.activity.Startable;
-import net.dpml.context.Context;
-import net.dpml.context.ContextException;
-import net.dpml.context.Contextualizable;
-import net.dpml.logging.LogEnabled;
import net.dpml.logging.Logger;
-import net.dpml.parameters.ParameterException;
-import net.dpml.parameters.Parameterizable;
-import net.dpml.parameters.Parameters;
import net.dpml.http.HttpContextService;
-import net.dpml.service.ServiceException;
-import net.dpml.service.ServiceManager;
-import net.dpml.service.Serviceable;

/**
* @metro.component name="http-resource-handler" lifestyle="singleton"
@@ -37,6 +27,18 @@
extends org.mortbay.http.handler.ResourceHandler
implements Startable
{
+ public interface Context
+ {
+ String getName();
+ HttpContextService getHttpContext();
+ int getHandlerIndex( int value );
+ boolean getAcceptRanges( boolean value );
+ boolean getDirAllowed( boolean value );
+ boolean getRedirectWelcome( boolean value );
+ int getMinGzipLength( int value );
+ String getAllowedMethods( String value );
+ }
+
private Logger m_logger;
private HttpContextService m_context;
private int m_index;
@@ -48,30 +50,30 @@
* @metro.entry key="urn:metro:name"
* type="java.lang.String"
*/
- public ResourceHandler(Logger logger, Context ctx, Parameters params,
ServiceManager man )
- throws ContextException, ServiceException
+ public ResourceHandler(Logger logger, Context context )
{
m_logger = logger;
- m_context = (HttpContextService) man.lookup( "http-context" );
- String name = (String) ctx.get( "urn:metro:name" );
+ m_context = context.getHttpContext();
+ String name = context.getName();
setName( name );
-
- boolean ranges = params.getParameterAsBoolean( "accept-ranges",
false );
+ m_index = context.getHandlerIndex( -1 );
+
+ boolean ranges = context.getAcceptRanges( false );
setAcceptRanges( ranges );

- boolean dirAllowed = params.getParameterAsBoolean(
"allow-directory", false );
+ boolean dirAllowed = context.getDirAllowed( false );
setDirAllowed( dirAllowed );

- boolean redirectWelcome = params.getParameterAsBoolean(
"redirect-welcome", false );
+ boolean redirectWelcome = context.getRedirectWelcome( false );
setRedirectWelcome( redirectWelcome );

- int minGzip = params.getParameterAsInteger( "min-gzip-length", -1 );
+ int minGzip = context.getMinGzipLength( -1 );
if( minGzip > 0 )
+ {
setMinGzipLength( minGzip );
+ }

- m_index = params.getParameterAsInteger( "handler-index", -1 );
-
- String allow = params.getParameter( "allow-methods", null );
+ String allow = context.getAllowedMethods( null );
if( allow != null )
{
String[] methods = StringUtils.tokenize( allow );
@@ -79,26 +81,37 @@
}
}

- public void start()
- throws Exception
+ public void start() throws Exception
{
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 );
+ }
if( ! isStarted() )
+ {
super.start();
+ }
}

public void stop()
throws InterruptedException
{
if( m_logger.isDebugEnabled() )
+ {
m_logger.debug( "Stopping ResourceHandler: " + this );
+ }
if( isStarted() )
+ {
super.stop();
+ }
m_context.removeHandler( this );
}
}

Modified:
development/main/test/components/http/impl/src/main/net/dpml/http/impl/RootNotFoundHandler.java
==============================================================================
---
development/main/test/components/http/impl/src/main/net/dpml/http/impl/RootNotFoundHandler.java
(original)
+++
development/main/test/components/http/impl/src/main/net/dpml/http/impl/RootNotFoundHandler.java
Fri Jun 17 18:53:56 2005
@@ -16,66 +16,64 @@
package net.dpml.http.impl;

import net.dpml.activity.Startable;
-import net.dpml.context.Context;
-import net.dpml.context.ContextException;
import net.dpml.logging.Logger;
-import net.dpml.parameters.ParameterException;
-import net.dpml.parameters.Parameterizable;
-import net.dpml.parameters.Parameters;
import net.dpml.http.HttpContextService;
-import net.dpml.service.ServiceException;
-import net.dpml.service.ServiceManager;

-/**
- * @metro.component name="http-rootnotfound-handler" lifestyle="singleton"
- * @metro.service type="org.mortbay.http.HttpHandler"
- */
public class RootNotFoundHandler
extends org.mortbay.http.handler.RootNotFoundHandler
implements Startable
{
- private Logger m_logger;
- private HttpContextService m_context;
- private int m_index;
-
- /**
- * @metro.logger name="http"
- * @metro.entry key="urn:metro:name"
- * type="java.lang.String"
- * @metro.dependency type="net.dpml.http.HttpContextService"
- * key="http-context"
- */
- public RootNotFoundHandler( Logger logger, Context ctx, Parameters
params, ServiceManager man )
- throws ContextException, ServiceException
+ public interface Context
+ {
+ String getName();
+ HttpContextService getHttpContext();
+ int getHandlerIndex( int value );
+ }
+
+ private Logger m_logger;
+ private HttpContextService m_context;
+ private int m_index;
+
+ public RootNotFoundHandler( Logger logger, Context context )
{
m_logger = logger;
- m_context = (HttpContextService) man.lookup( "http-context" );
-
- String name = (String) ctx.get( "urn:metro:name" );
+ m_context = context.getHttpContext();
+ String name = context.getName();
setName( name );
- m_index = params.getParameterAsInteger( "handler-index", -1 );
+ m_index = context.getHandlerIndex( -1 );
}

- public void start()
- throws Exception
+ public void start() throws Exception
{
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 );
+ }
if( ! isStarted() )
+ {
super.start();
+ }
}

public void stop()
throws InterruptedException
{
if( m_logger.isDebugEnabled() )
+ {
m_logger.debug( "Stopping RootNotFoundHandler: " + this );
+ }
if( isStarted() )
+ {
super.stop();
+ }
m_context.removeHandler( this );
}
}

Modified:
development/main/test/components/http/impl/src/main/net/dpml/http/impl/SecurityConstraint.java
==============================================================================
---
development/main/test/components/http/impl/src/main/net/dpml/http/impl/SecurityConstraint.java
(original)
+++
development/main/test/components/http/impl/src/main/net/dpml/http/impl/SecurityConstraint.java
Fri Jun 17 18:53:56 2005
@@ -18,58 +18,53 @@
import net.dpml.configuration.Configuration;
import net.dpml.configuration.ConfigurationException;

-import net.dpml.context.Context;
-import net.dpml.context.ContextException;
-
import net.dpml.logging.Logger;

-import net.dpml.parameters.ParameterException;
-import net.dpml.parameters.Parameters;
-
import net.dpml.http.HttpContextService;

-import net.dpml.service.ServiceException;
-import net.dpml.service.ServiceManager;
-
-/**
- * @metro.component name="http-security-constraint" lifestyle="singleton"
- */
public class SecurityConstraint
extends org.mortbay.http.SecurityConstraint
{
- private Logger m_logger;
- private HttpContextService m_context;
+ public interface Context
+ {
+ String getName();
+ HttpContextService getHttpContext();
+ }
+
+ private Logger m_logger;
+ private HttpContextService m_context;

- /**
- * @metro.logger name="http"
- * @metro.entry key="urn:metro:name"
- * type="java.lang.String"
- * @metro.dependency type="net.dpml.http.HttpContextService"
- * key="http-context"
- */
- public SecurityConstraint( Logger logger, Context ctx, ServiceManager
man, Configuration conf )
- throws ContextException, ServiceException, ConfigurationException
+ public SecurityConstraint( Logger logger, Context context, Configuration
conf )
+ throws ConfigurationException
{
- m_context = (HttpContextService) man.lookup( "http-context" );
-
m_logger = logger;
- String name = (String) ctx.get( "urn:metro:name" );
+ m_context = context.getHttpContext();
+ String name = context.getName();
setName( name );
+
String path = conf.getChild( "path" ).getValue( "/" );
boolean authenticate = conf.getChild( "authenticate"
).getValueAsBoolean( false );
setAuthenticate( authenticate );
String dcValue = conf.getChild( "data-constraint" ).getValue( "none"
);
int dc = DC_UNSET;
if( "none".equals( dcValue ) )
+ {
dc = DC_NONE;
+ }
else if( "integral".equals( dcValue ) )
+ {
dc = DC_INTEGRAL;
+ }
else if( "confidential".equals( dcValue ) )
+ {
dc = DC_CONFIDENTIAL;
+ }
else
{
- String error = "Illegal value: \"" + dcValue +
- "\". Only \"none\", \"integral\" or \"confidential\" is
allowed.";
+ final String error =
+ "Illegal value: \""
+ + dcValue
+ + "\". Only \"none\", \"integral\" or \"confidential\" is
allowed.";
throw new ConfigurationException( error );
}
Configuration roles = conf.getChild( "roles" );

Modified:
development/main/test/components/http/impl/src/main/net/dpml/http/impl/SecurityHandler.java
==============================================================================
---
development/main/test/components/http/impl/src/main/net/dpml/http/impl/SecurityHandler.java
(original)
+++
development/main/test/components/http/impl/src/main/net/dpml/http/impl/SecurityHandler.java
Fri Jun 17 18:53:56 2005
@@ -16,75 +16,71 @@
package net.dpml.http.impl;

import net.dpml.activity.Startable;
-import net.dpml.context.Context;
-import net.dpml.context.ContextException;
-import net.dpml.context.Contextualizable;
-import net.dpml.logging.LogEnabled;
import net.dpml.logging.Logger;
-import net.dpml.parameters.ParameterException;
-import net.dpml.parameters.Parameterizable;
-import net.dpml.parameters.Parameters;
import net.dpml.http.HttpContextService;
-import net.dpml.service.ServiceException;
-import net.dpml.service.ServiceManager;
-import net.dpml.service.Serviceable;
-
-/**
- * @metro.component name="http-security-handler" lifestyle="singleton"
- * @metro.service type="org.mortbay.http.HttpHandler"
- */
+
+import org.mortbay.http.Authenticator;
+
public class SecurityHandler
extends org.mortbay.http.handler.SecurityHandler
implements Startable
{
- private Logger m_logger;
- private HttpContextService m_context;
- private int m_index;
-
- /**
- * @metro.logger name="http"
- * @metro.entry key="urn:metro:name"
- * type="java.lang.String"
- * @metro.dependency type="net.dpml.http.HttpContextService"
- * key="http-context"
- * @metro.dependency type="org.mortbay.http.Authenticator"
- * key="authenticator"
- */
// The dependency on Authenticator is to ensure that the Authenticator
// has been assigned to the HttpContext before the SecurityHandler
// is being started, since it otherwise will set another Authenticator.
-
- public SecurityHandler( Logger logger, Context ctx, Parameters params,
ServiceManager man )
- throws ContextException, ServiceException
+
+ public interface Context
+ {
+ String getName();
+ HttpContextService getHttpContext();
+ int getHandlerIndex( int value );
+ String getAuthenticator();
+ }
+
+ private Logger m_logger;
+ private HttpContextService m_context;
+ private int m_index;
+
+ public SecurityHandler( Logger logger, Context context )
{
- m_context = (HttpContextService) man.lookup( "http-context" );
-
m_logger = logger;
- String name = (String) ctx.get( "urn:metro:name" );
+ m_context = context.getHttpContext();
+ String name = context.getName();
setName( name );
- m_index = params.getParameterAsInteger( "handler-index", -1 );
+ m_index = context.getHandlerIndex( -1 );
}

- public void start()
- throws Exception
+ public void start() throws Exception
{
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 );
+ }
if( ! isStarted() )
+ {
super.start();
+ }
}

public void stop()
throws InterruptedException
{
if( m_logger.isDebugEnabled() )
+ {
m_logger.debug( "Stopping SecurityHandler: " + this );
+ }
if( isStarted() )
+ {
super.stop();
+ }
m_context.removeHandler( this );
}
}

Modified:
development/main/test/components/http/impl/src/main/net/dpml/http/impl/ServletHandler.java
==============================================================================
---
development/main/test/components/http/impl/src/main/net/dpml/http/impl/ServletHandler.java
(original)
+++
development/main/test/components/http/impl/src/main/net/dpml/http/impl/ServletHandler.java
Fri Jun 17 18:53:56 2005
@@ -38,48 +38,40 @@
* @metro.service type="net.dpml.http.ServletHandler"
*/
public class ServletHandler extends org.mortbay.jetty.servlet.ServletHandler
- implements Configurable, Startable, net.dpml.http.ServletHandler
+ implements Startable, net.dpml.http.ServletHandler
{
+ public interface Context
+ {
+ HttpContextService getHttpContext();
+ SessionManager getSessionManager( SessionManager value );
+ String getName();
+ int getHandlerIndex( int value );
+ boolean getUsingCookies( boolean value );
+ boolean getAutoInitializeServlets( boolean value );
+ }
+
private Logger m_logger;
private HttpContextService m_context;
private int m_index;
- private boolean m_EnableModelInContext;

- /**
- * @metro.logger name="http"
- * @metro.dependency type="net.dpml.http.HttpContextService"
- * key="http-context"
- * @metro.dependency type="org.mortbay.jetty.servlet.SessionManager"
- * key="session-manager" optional="true"
- * @metro.entry key="urn:metro:name"
- * type="java.lang.String"
- */
- public ServletHandler( Logger logger, Context ctx, Parameters params,
ServiceManager man )
- throws ServiceException, ContextException
+ public ServletHandler( Logger logger, Context context, Configuration
conf )
+ throws ConfigurationException
{
m_logger = logger;
- m_context = (HttpContextService) man.lookup( "http-context" );
-
- if( man.hasService( "session-manager" ) )
+ m_context = context.getHttpContext();
+ SessionManager sm = context.getSessionManager( null );
+ if( null != sm )
{
- SessionManager sm = (SessionManager) man.lookup(
"session-manager" );
setSessionManager( sm );
}
- String name = (String) ctx.get( "urn:metro:name" );
+ String name = context.getName();
setName( name );
-
- m_index = params.getParameterAsInteger( "handler-index", -1 );
-
- boolean useCookies = params.getParameterAsBoolean( "using-cookies",
false );
+ m_index = context.getHandlerIndex( -1 );
+ boolean useCookies = context.getUsingCookies( false );
setUsingCookies( useCookies );
-
- boolean autoInitialize = params.getParameterAsBoolean(
"auto-initialize-servlets", true );
+ boolean autoInitialize = context.getAutoInitializeServlets( true );
setAutoInitializeServlets( autoInitialize );
- }

- public void configure( Configuration conf )
- throws ConfigurationException
- {
Configuration child = conf.getChild( "servlets" );
configureServlets( child );
}
@@ -89,7 +81,9 @@
{
Configuration[] children = conf.getChildren( "servlet" );
for( int i = 0 ; i < children.length ; i++ )
+ {
configureServlet( children[i] );
+ }
}

private void configureServlet( Configuration conf )
@@ -99,14 +93,20 @@
String classname = conf.getChild( "classname" ).getValue();
String name = conf.getChild( "name" ).getValue( null );
if( name == null )
+ {
addServlet( path, classname );
+ }
else
{
String forcedPath = conf.getChild( "forced" ).getValue( null );
if( forcedPath == null )
+ {
addServlet( name, path, classname, forcedPath );
+ }
else
+ {
addServlet( name, path, classname );
+ }
}
}

@@ -114,22 +114,34 @@
throws Exception
{
if( m_index >= 0 )
+ {
m_context.addHandler( m_index, this );
+ }
else
+ {
m_context.addHandler( this );
+ }
if( m_logger.isDebugEnabled() )
+ {
m_logger.debug( "Starting ServletHandler: " + this );
+ }
if( ! isStarted() )
+ {
super.doStart();
+ }
}

protected void doStop()
throws Exception
{
if( m_logger.isDebugEnabled() )
+ {
m_logger.debug( "Stopping ServletHandler: " + this );
+ }
if( isStarted() )
+ {
super.doStop();
+ }
m_context.removeHandler( this );
}


Modified:
development/main/test/components/http/impl/src/main/net/dpml/http/impl/SetResponseHeadersHandler.java
==============================================================================
---
development/main/test/components/http/impl/src/main/net/dpml/http/impl/SetResponseHeadersHandler.java
(original)
+++
development/main/test/components/http/impl/src/main/net/dpml/http/impl/SetResponseHeadersHandler.java
Fri Jun 17 18:53:56 2005
@@ -19,52 +19,33 @@
import net.dpml.configuration.Configurable;
import net.dpml.configuration.Configuration;
import net.dpml.configuration.ConfigurationException;
-import net.dpml.context.Context;
-import net.dpml.context.ContextException;
-import net.dpml.context.Contextualizable;
-import net.dpml.logging.LogEnabled;
import net.dpml.logging.Logger;
-import net.dpml.parameters.ParameterException;
-import net.dpml.parameters.Parameterizable;
-import net.dpml.parameters.Parameters;
import net.dpml.http.HttpContextService;
-import net.dpml.service.ServiceException;
-import net.dpml.service.ServiceManager;
-import net.dpml.service.Serviceable;
-
-/**
- * @metro.component name="http-setresponseheaders-handler"
lifestyle="singleton"
- * @metro.service type="org.mortbay.http.HttpHandler"
- */
+
public class SetResponseHeadersHandler
extends org.mortbay.http.handler.SetResponseHeadersHandler
- implements Configurable, Startable
+ implements Startable
{
+ public interface Context
+ {
+ String getName();
+ HttpContextService getHttpContext();
+ int getHandlerIndex( int value );
+ }
+
private Logger m_logger;
private HttpContextService m_context;
private int m_index;

- /**
- * @metro.logger name="http"
- * @metro.entry key="urn:metro:name"
- * type="java.lang.String"
- * @metro.dependency type="net.dpml.http.HttpContextService"
- * key="http-context"
- */
- public SetResponseHeadersHandler( Logger logger, Context ctx, Parameters
params, ServiceManager man )
- throws ContextException, ServiceException
+ public SetResponseHeadersHandler( Logger logger, Context context,
Configuration conf )
+ throws ConfigurationException
{
m_logger = logger;
- m_context = (HttpContextService) man.lookup( "http-context" );
- String name = (String) ctx.get( "urn:metro:name" );
+ m_context = context.getHttpContext();
+ String name = context.getName();
setName( name );
- m_index = params.getParameterAsInteger( "handler-index", -1 );
+ m_index = context.getHandlerIndex( -1 );

- }
-
- public void configure( Configuration conf )
- throws ConfigurationException
- {
Configuration child = conf.getChild( "headers" );
configureHeaders( child );
}
@@ -85,26 +66,36 @@
setHeaderValue( name.getValue(), value.getValue() );
}

- public void start()
- throws Exception
+ public void start() throws Exception
{
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 );
+ }
if( ! isStarted() )
+ {
super.start();
+ }
}

- public void stop()
- throws InterruptedException
+ public void stop() throws InterruptedException
{
if( m_logger.isDebugEnabled() )
+ {
m_logger.debug( "Stopping SetResponseHeadersHandler: " + this );
+ }
if( isStarted() )
+ {
super.stop();
+ }
m_context.removeHandler( this );
}
}

Modified:
development/main/test/components/http/impl/src/main/net/dpml/http/impl/SocketListener.java
==============================================================================
---
development/main/test/components/http/impl/src/main/net/dpml/http/impl/SocketListener.java
(original)
+++
development/main/test/components/http/impl/src/main/net/dpml/http/impl/SocketListener.java
Fri Jun 17 18:53:56 2005
@@ -17,109 +17,121 @@

import net.dpml.activity.Startable;
import net.dpml.logging.Logger;
-import net.dpml.parameters.ParameterException;
-import net.dpml.parameters.Parameterizable;
-import net.dpml.parameters.Parameters;
import net.dpml.http.HttpService;
-import net.dpml.service.ServiceException;
-import net.dpml.service.ServiceManager;
import org.mortbay.http.HttpListener;

-/** Wrapper for the Jetty SocketListener.
- *
- * @metro.component name="http-socket-listener" lifestyle="singleton"
- * @metro.service type="org.mortbay.http.HttpListener"
- */
public class SocketListener extends org.mortbay.http.SocketListener
- implements Parameterizable, HttpListener, Startable
+ implements HttpListener, Startable
{
+ public interface Context
+ {
+ HttpService getHttpServer();
+ int getBufferReserve( int value );
+ int getBufferSize( int value );
+ int getConfidentialPort( int value );
+ String getConfidentialScheme( String value );
+ String getDefaultScheme( String value );
+ int getIntegralPort( int value );
+ String getIntegralScheme( String value );
+ String getHostName( String value );
+ int getPort( int value );
+ int getLowResourcePersistTimeMs( int value );
+ boolean getIdentifyListener( boolean value );
+ }
+
private HttpService m_HttpServer;
private Logger m_logger;

- /**
- * @metro.logger name="http"
- * @metro.dependency type="net.dpml.http.HttpService"
- * key="server"
- *
- */
- public SocketListener(Logger logger, ServiceManager man)
- throws ServiceException
+ public SocketListener(Logger logger, Context context ) throws
java.net.UnknownHostException
{
m_logger = logger;
- m_HttpServer = (HttpService) man.lookup( "server" );
+ m_HttpServer = context.getHttpServer();
m_HttpServer.addListener( this );
- }

- public void parameterize( Parameters params )
- throws ParameterException
- {
- int reserve = params.getParameterAsInteger( "buffer-reserve", -1 );
+ int reserve = context.getBufferReserve( -1 );
if( reserve > 0 )
+ {
setBufferReserve( reserve );
+ }

- int size = params.getParameterAsInteger( "buffer-size", -1 );
+ int size = context.getBufferSize( -1 );
if( size > 0 )
+ {
setBufferSize( size );
+ }

- int confPort = params.getParameterAsInteger( "confidential-port", -1
);
+ int confPort = context.getConfidentialPort( -1 );
if( confPort > 0 )
+ {
setConfidentialPort( confPort );
+ }

- String confScheme = params.getParameter( "confidential-scheme", null
);
+ String confScheme = context.getConfidentialScheme( null );
if( confScheme != null )
+ {
setConfidentialScheme( confScheme );
+ }

- String defScheme = params.getParameter( "default-scheme", null );
+ String defScheme = context.getDefaultScheme( null );
if( defScheme != null )
+ {
setDefaultScheme( defScheme );
+ }

- int integralPort = params.getParameterAsInteger( "integral-port", -1
);
+ int integralPort = context.getIntegralPort( -1 );
if( integralPort > 0 )
+ {
setIntegralPort( integralPort );
+ }

- String integralScheme = params.getParameter( "integral-scheme", null
);
+ String integralScheme = context.getIntegralScheme( null );
if( integralScheme != null )
+ {
setIntegralScheme( integralScheme );
+ }

- String host = params.getParameter( "hostname", null );
- try
- {
- if( host != null )
- setHost( host );
- } catch( java.net.UnknownHostException e )
+ String host = context.getHostName( null );
+ if( host != null )
{
- throw new ParameterException( "Unknown hostname: " + host );
+ setHost( host );
}

- int port = params.getParameterAsInteger( "port", 8080 );
+ int port = context.getPort( 8080 );
setPort( port );

- int lowResMs = params.getParameterAsInteger(
"low-resource-persist-ms", -1 );
+ int lowResMs = context.getLowResourcePersistTimeMs( -1 );
if( lowResMs > 0 )
+ {
setLowResourcePersistTimeMs( lowResMs );
+ }

- boolean identify = params.getParameterAsBoolean(
"identify-listener", false );
+ boolean identify = context.getIdentifyListener( false );
setIdentifyListener( identify );
-
-
}

public void start()
throws Exception
{
if( m_logger.isDebugEnabled() )
+ {
m_logger.debug( "Starting socket: " + this );
+ }
if( ! isStarted() )
+ {
super.start();
+ }
}

- public void stop()
- throws InterruptedException
+ public void stop() throws InterruptedException
{
if( m_logger.isDebugEnabled() )
+ {
m_logger.debug( "Stopping socket: " + this );
+ }
if( isStarted() )
+ {
super.stop();
+ }
m_HttpServer.removeListener( this );
}
}

Modified:
development/main/test/components/http/impl/src/main/net/dpml/http/impl/SystemMimeTypes.java
==============================================================================
---
development/main/test/components/http/impl/src/main/net/dpml/http/impl/SystemMimeTypes.java
(original)
+++
development/main/test/components/http/impl/src/main/net/dpml/http/impl/SystemMimeTypes.java
Fri Jun 17 18:53:56 2005
@@ -22,31 +22,24 @@
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
-import net.dpml.activity.Initializable;
-import net.dpml.parameters.ParameterException;
-import net.dpml.parameters.Parameterizable;
-import net.dpml.parameters.Parameters;
+
import net.dpml.http.MimeTypes;

-/**
- * @metro.component name="mimetypes-system" lifestyle="singleton"
- * @metro.service type="net.dpml.http.MimeTypes"
- */
-public class SystemMimeTypes
- implements Initializable, MimeTypes
+public class SystemMimeTypes implements MimeTypes
{
+ public interface Context
+ {
+ String getFilename( String value );
+ }
+
private String m_Filename;
private HashMap m_MimeTypeToExtMap;
private HashMap m_ExtToMimeTypeMap;

- public SystemMimeTypes(Parameters params)
+ public SystemMimeTypes( Context context )
{
- m_Filename = params.getParameter( "filename", "/etc/mime.types" );
- }
+ m_Filename = context.getFilename( "/etc/mime.types" );

- public void initialize()
- throws Exception
- {
m_MimeTypeToExtMap = new HashMap();
m_ExtToMimeTypeMap = new HashMap();

@@ -64,14 +57,21 @@
{
processLine( line );
}
- } finally
+ }
+ finally
{
if( in != null )
+ {
in.close();
+ }
if( isr != null )
+ {
isr.close();
+ }
if( fis != null )
+ {
fis.close();
+ }
}
}

@@ -89,15 +89,18 @@
{
String[] result = (String[]) m_MimeTypeToExtMap.get( mimetype );
if( result == null )
+ {
result = new String[0];
+ }
return result;
}

private void processLine( String line )
{
if( "".equals( line ) )
+ {
return;
-
+ }
StringTokenizer st = new StringTokenizer( line, " ", false );
String mimetype = st.nextToken();
ArrayList exts = new ArrayList();



  • svn commit: r2885 - in development/main/test/components/http/impl: . src/main/net/dpml/http/impl, mcconnell, 06/17/2005

Archive powered by MHonArc 2.6.24.

Top of Page