Skip to Content.
Sympa Menu

notify-dpml - r1486 - in trunk/main/planet/http: impl impl/src/main/net/dpml/http server

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: r1486 - in trunk/main/planet/http: impl impl/src/main/net/dpml/http server
  • Date: Fri, 2 Jun 2006 09:25:58 +0200

Author: mcconnell
Date: 2006-06-02 09:25:42 +0200 (Fri, 02 Jun 2006)
New Revision: 1486

Added:
trunk/main/planet/http/impl/src/main/net/dpml/http/HandlerCollection.java
Modified:
trunk/main/planet/http/impl/build.xml

trunk/main/planet/http/impl/src/main/net/dpml/http/ContextHandlerCollection.java

trunk/main/planet/http/impl/src/main/net/dpml/http/NCSARequestLogHandler.java
trunk/main/planet/http/impl/src/main/net/dpml/http/Server.java
trunk/main/planet/http/server/project.xml
Log:
resolve http request log issue

Modified: trunk/main/planet/http/impl/build.xml
===================================================================
--- trunk/main/planet/http/impl/build.xml 2006-06-02 04:27:22 UTC (rev
1485)
+++ trunk/main/planet/http/impl/build.xml 2006-06-02 07:25:42 UTC (rev
1486)
@@ -73,12 +73,18 @@
</services>
</type>

- <type xmlns="metro" class="net.dpml.http.ContextHandlerCollection"
threadsafe="true" name="handlers">
+ <type xmlns="metro" class="net.dpml.http.HandlerCollection"
threadsafe="true" name="handlers">
<services>
<service class="org.mortbay.jetty.handler.HandlerCollection"/>
</services>
</type>

+ <type xmlns="metro" class="net.dpml.http.ContextHandlerCollection"
threadsafe="true" name="context">
+ <services>
+ <service class="org.mortbay.jetty.handler.ContextHandlerCollection"/>
+ </services>
+ </type>
+
<type xmlns="metro" name="server" class="net.dpml.http.Server"
threadsafe="true" collection="hard">
<services>
<service class="net.dpml.http.Server"/>

Modified:
trunk/main/planet/http/impl/src/main/net/dpml/http/ContextHandlerCollection.java
===================================================================
---
trunk/main/planet/http/impl/src/main/net/dpml/http/ContextHandlerCollection.java
2006-06-02 04:27:22 UTC (rev 1485)
+++
trunk/main/planet/http/impl/src/main/net/dpml/http/ContextHandlerCollection.java
2006-06-02 07:25:42 UTC (rev 1486)
@@ -22,7 +22,7 @@
import net.dpml.component.Provider;

/**
- * HTTP server implementation.
+ * Context handler collection.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/

Added:
trunk/main/planet/http/impl/src/main/net/dpml/http/HandlerCollection.java
===================================================================
--- trunk/main/planet/http/impl/src/main/net/dpml/http/HandlerCollection.java
2006-06-02 04:27:22 UTC (rev 1485)
+++ trunk/main/planet/http/impl/src/main/net/dpml/http/HandlerCollection.java
2006-06-02 07:25:42 UTC (rev 1486)
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2006 Stephen McConnell.
+ *
+ * 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 net.dpml.http;
+
+import net.dpml.logging.Logger;
+
+import net.dpml.metro.PartsManager;
+import net.dpml.metro.ComponentHandler;
+import net.dpml.component.Provider;
+
+/**
+ * A collection of handlers.
+ * For each request, all handler are called, regardless of
+ * the response status or exceptions.
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class HandlerCollection extends
org.mortbay.jetty.handler.HandlerCollection
+{
+ /**
+ * Internal parts management interface.
+ */
+ public interface Parts extends PartsManager
+ {
+ }
+
+ private final Logger m_logger;
+ private final Parts m_parts;
+
+ /**
+ * Creation of a new handler collection.
+ * @param logger the assigned logging channel
+ * @param parts the parts manager
+ * @exception Exception if an instantiation error occurs
+ */
+ public HandlerCollection( Logger logger, Parts parts ) throws Exception
+ {
+ super();
+
+ m_logger = logger;
+ m_parts = parts;
+
+ getLogger().debug( "commencing handler addition" );
+ String[] keys = parts.getKeys();
+ getLogger().debug( "handler count: " + keys.length );
+ for( int i=0; i<keys.length; i++ )
+ {
+ String key = keys[i];
+ ComponentHandler handler = parts.getComponentHandler( key );
+ getLogger().info( "adding handler: " + handler );
+ try
+ {
+ Provider provider = handler.getProvider();
+ org.mortbay.jetty.Handler ch =
+ (org.mortbay.jetty.Handler) provider.getValue( false );
+ super.addHandler( ch );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Failed to deploy handler: " + handler;
+ throw new Exception( error, e );
+ }
+ }
+ }
+
+ private Logger getLogger()
+ {
+ return m_logger;
+ }
+}

Modified:
trunk/main/planet/http/impl/src/main/net/dpml/http/NCSARequestLogHandler.java
===================================================================
---
trunk/main/planet/http/impl/src/main/net/dpml/http/NCSARequestLogHandler.java
2006-06-02 04:27:22 UTC (rev 1485)
+++
trunk/main/planet/http/impl/src/main/net/dpml/http/NCSARequestLogHandler.java
2006-06-02 07:25:42 UTC (rev 1486)
@@ -21,6 +21,8 @@

import org.mortbay.jetty.handler.RequestLogHandler;
import org.mortbay.jetty.NCSARequestLog;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.RequestLog;

/**
* Wrapper for the Jetty NCSA request logger.

Modified: trunk/main/planet/http/impl/src/main/net/dpml/http/Server.java
===================================================================
--- trunk/main/planet/http/impl/src/main/net/dpml/http/Server.java
2006-06-02 04:27:22 UTC (rev 1485)
+++ trunk/main/planet/http/impl/src/main/net/dpml/http/Server.java
2006-06-02 07:25:42 UTC (rev 1486)
@@ -77,10 +77,10 @@
ThreadPool getThreadPool();

/**
- * Return the context handler collection.
- * @return the configured context handler collection.
+ * Return the handler collection.
+ * @return the configured handler collection.
*/
- ContextHandlerCollection getContextHandlerCollection();
+ HandlerCollection getHandlerCollection();
}

private final Logger m_logger;
@@ -137,7 +137,7 @@
addConnectors( parts );
addUserRealms( parts );

- ContextHandlerCollection collection =
parts.getContextHandlerCollection();
+ HandlerCollection collection = parts.getHandlerCollection();
setHandler( collection );

getLogger().debug( "server established" );

Modified: trunk/main/planet/http/server/project.xml
===================================================================
--- trunk/main/planet/http/server/project.xml 2006-06-02 04:27:22 UTC (rev
1485)
+++ trunk/main/planet/http/server/project.xml 2006-06-02 07:25:42 UTC (rev
1486)
@@ -46,58 +46,71 @@
</context>
</component>
<!--
- Add context handler collection.
+ Add handler collection.
-->
- <component key="contextHandlerCollection"
type="net.dpml.http.ContextHandlerCollection"
+ <component key="handlerCollection"
type="net.dpml.http.HandlerCollection"
lifestyle="singleton"
collection="hard">
+
<parts>
- <!--
- Creation of a HTTP server configured to present static content
in
- the ${dpml.share}/docs directory.
- -->
- <component key="docs" type="net.dpml.http.ResourceContextHandler"
- collection="hard" lifestyle="singleton">
- <context>
- <entry key="resourceBase" value="${dpml.share}/docs"/>
- <entry key="contextPath" value="/docs"/>
- </context>
+
+ <component key="contextHandlerCollection"
type="net.dpml.http.ContextHandlerCollection"
+ lifestyle="singleton"
+ collection="hard">
+
+ <parts>
+ <!--
+ Creation of a HTTP server configured to present static
content in
+ the ${dpml.share}/docs directory.
+ -->
+ <component key="docs"
type="net.dpml.http.ResourceContextHandler"
+ collection="hard" lifestyle="singleton">
+ <context>
+ <entry key="resourceBase" value="${dpml.share}/docs"/>
+ <entry key="contextPath" value="/docs"/>
+ </context>
+ </component>
+ <!--
+ Add an experimental servlet context.
+ (Need to add context cloassloader configuration but this
requires
+ per-component threads - currently limited to classes
declared within
+ the part classloader).
+ -->
+ <component key="servlets"
type="net.dpml.http.ServletContextHandler"
+ collection="hard" lifestyle="singleton">
+ <context>
+ <entry key="resourceBase" value="${dpml.data}"/>
+ <entry key="contextPath" value="/data"/>
+ <entry key="servletHolders">
+ <param class="net.dpml.http.ServletHolder">
+ <param value="data"/>
+ <param
value="org.mortbay.jetty.servlet.DefaultServlet"/>
+ </param>
+ </entry>
+ <entry key="servletEntries">
+ <param class="net.dpml.http.ServletEntry">
+ <param value="data"/>
+ <param value="/"/>
+ </param>
+ </entry>
+ </context>
+ </component>
+
+ <!--
+ Add a web application.
+ -->
+ <component key="webapp"
type="net.dpml.http.WebAppContextHandler"
+ collection="hard" lifestyle="singleton">
+ <context>
+ <entry key="contextPath" value="/"/>
+ <entry key="war"
value="link:war:dpml/planet/http/dpml-http-app"/>
+ </context>
+ </component>
+
+ </parts>
+
</component>
- <!--
- Add an experimental servlet context.
- (Need to add context cloassloader configuration but this
requires
- per-component threads - currently limited to classes declared
within
- the part classloader).
- -->
- <component key="servlets"
type="net.dpml.http.ServletContextHandler"
- collection="hard" lifestyle="singleton">
- <context>
- <entry key="resourceBase" value="${dpml.data}"/>
- <entry key="contextPath" value="/data"/>
- <entry key="servletHolders">
- <param class="net.dpml.http.ServletHolder">
- <param value="data"/>
- <param value="org.mortbay.jetty.servlet.DefaultServlet"/>
- </param>
- </entry>
- <entry key="servletEntries">
- <param class="net.dpml.http.ServletEntry">
- <param value="data"/>
- <param value="/"/>
- </param>
- </entry>
- </context>
- </component>
- <!--
- Add a web application.
- -->
- <component key="webapp" type="net.dpml.http.WebAppContextHandler"
- collection="hard" lifestyle="singleton">
- <context>
- <entry key="contextPath" value="/"/>
- <entry key="war"
value="link:war:dpml/planet/http/dpml-http-app"/>
- </context>
- </component>
+
<!--
NCSA Request log.
-->
@@ -110,10 +123,15 @@
<entry key="extended" value="true"/>
</context>
</component>
+
</parts>
+
</component>
+
</parts>
+
</component>
+
</types>

<dependencies>




  • r1486 - in trunk/main/planet/http: impl impl/src/main/net/dpml/http server, mcconnell at BerliOS, 06/02/2006

Archive powered by MHonArc 2.6.24.

Top of Page