Skip to Content.
Sympa Menu

notify-dpml - r1043 - in trunk/main/planet/web/server: . src/main/net/dpml/web/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: r1043 - in trunk/main/planet/web/server: . src/main/net/dpml/web/server
  • Date: Mon, 6 Feb 2006 02:31:28 +0100

Author: mcconnell
Date: 2006-02-06 02:31:19 +0100 (Mon, 06 Feb 2006)
New Revision: 1043

Added:

trunk/main/planet/web/server/src/main/net/dpml/web/server/WebAppContextHandler.java
Modified:
trunk/main/planet/web/server/build.xml
Log:
add a webapp context handler with support for artifact-based war files

Modified: trunk/main/planet/web/server/build.xml
===================================================================
--- trunk/main/planet/web/server/build.xml 2006-02-05 19:37:57 UTC (rev
1042)
+++ trunk/main/planet/web/server/build.xml 2006-02-06 01:31:19 UTC (rev
1043)
@@ -48,6 +48,12 @@
</services>
</type>

+ <type xmlns="metro" name="apps"
class="net.dpml.web.server.WebAppContextHandler" threadsafe="true" >
+ <services>
+ <service class="net.dpml.web.server.WebAppContextHandler"/>
+ </services>
+ </type>
+
<type xmlns="metro" name="server" class="net.dpml.web.server.Server"
threadsafe="true" collection="hard">
<services>
<service class="net.dpml.web.server.Server"/>
@@ -87,6 +93,16 @@
<component xmlns="metro" type="net.dpml.web.server.Server"
lifestyle="singleton">
<parts>
<!--
+ Add an experimental web app.
+ -->
+ <component key="apps"
type="net.dpml.web.server.WebAppContextHandler">
+ <context>
+ <entry key="server" validate="false"/>
+ <entry key="contextPath" value="/"/>
+ <entry key="war" value="link:war:dpml/planet/web/dpml-web-app"/>
+ </context>
+ </component>
+ <!--
Creation of a HTTP server configured to present static content in
the ${dpml.share}/docs directory.
-->
@@ -99,12 +115,15 @@
</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.web.server.ServletContextHandler">
<context>
<entry key="server" validate="false"/>
<entry key="resourceBase" value="$${dpml.data}"/>
- <entry key="contextPath" value="/"/>
+ <entry key="contextPath" value="/demo"/>
</context>
<configuration>
<servlets>

Added:
trunk/main/planet/web/server/src/main/net/dpml/web/server/WebAppContextHandler.java
===================================================================
---
trunk/main/planet/web/server/src/main/net/dpml/web/server/WebAppContextHandler.java
2006-02-05 19:37:57 UTC (rev 1042)
+++
trunk/main/planet/web/server/src/main/net/dpml/web/server/WebAppContextHandler.java
2006-02-06 01:31:19 UTC (rev 1043)
@@ -0,0 +1,79 @@
+/*
+ * 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.web.server;
+
+import java.net.URI;
+import java.util.ArrayList;
+
+import net.dpml.transit.util.PropertyResolver;
+
+import net.dpml.logging.Logger;
+
+import net.dpml.configuration.Configuration;
+import net.dpml.configuration.ConfigurationException;
+
+import org.mortbay.jetty.Handler;
+
+/**
+ * Servlet context handler.
+ */
+public class WebAppContextHandler extends
org.mortbay.jetty.webapp.WebAppContext
+{
+ /**
+ * HTTP static resource vontext handler parameters.
+ */
+ public interface Context
+ {
+ /**
+ * Get the required HTTP server.
+ * @return the assigned http server
+ */
+ Server getServer();
+
+ /**
+ * Get the context path under which the http context instance will
+ * be associated.
+ *
+ * @return the assigned context path
+ */
+ String getContextPath();
+
+ /**
+ * Get the war artifact uri.
+ * @return the uri identifying the war artifact
+ */
+ URI getWar();
+ }
+
+ private final Logger m_logger;
+
+ private int m_priority = 0;
+
+ public WebAppContextHandler( Logger logger, Context context ) throws
Exception
+ {
+ m_logger = logger;
+
+ String path = context.getContextPath();
+ setContextPath( path );
+ getSessionHandler().setSessionManager( new
org.mortbay.jetty.servlet.HashSessionManager() );
+ setWar( context.getWar().toString() );
+ }
+
+ private Logger getLogger()
+ {
+ return m_logger;
+ }
+}




  • r1043 - in trunk/main/planet/web/server: . src/main/net/dpml/web/server, mcconnell at BerliOS, 02/05/2006

Archive powered by MHonArc 2.6.24.

Top of Page