Skip to Content.
Sympa Menu

notify-dpml - r1004 - in trunk/main/planet/web/server: etc/prefs etc/prefs/xmls 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: r1004 - in trunk/main/planet/web/server: etc/prefs etc/prefs/xmls src/main/net/dpml/web/server
  • Date: Tue, 31 Jan 2006 14:59:38 +0100

Author: mcconnell
Date: 2006-01-31 14:59:27 +0100 (Tue, 31 Jan 2006)
New Revision: 1004

Added:
trunk/main/planet/web/server/etc/prefs/keystores/

trunk/main/planet/web/server/src/main/net/dpml/web/server/HashUserRealm.java

trunk/main/planet/web/server/src/main/net/dpml/web/server/SslSocketConnector.java
Removed:
trunk/main/planet/web/server/etc/prefs/keystore/
Modified:
trunk/main/planet/web/server/etc/prefs/xmls/jetty.xml

trunk/main/planet/web/server/src/main/net/dpml/web/server/ContextHandler.java
Log:
add support for keystore and user realm resolution via local uri and fix a
error in prefs packaging

Copied: trunk/main/planet/web/server/etc/prefs/keystores (from rev 1002,
trunk/main/planet/web/server/etc/prefs/keystore)

Modified: trunk/main/planet/web/server/etc/prefs/xmls/jetty.xml
===================================================================
--- trunk/main/planet/web/server/etc/prefs/xmls/jetty.xml 2006-01-31
12:30:02 UTC (rev 1003)
+++ trunk/main/planet/web/server/etc/prefs/xmls/jetty.xml 2006-01-31
13:59:27 UTC (rev 1004)
@@ -63,12 +63,13 @@
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-->
<!-- Add a HTTPS SSL listener on port 8443
-->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-->
+ <!-- DISABLED: something wrong with bundled certificates -->
<!--
<Item>
- <New class="org.mortbay.jetty.security.SslSocketConnector">
+ <New class="net.dpml.web.server.SslSocketConnector">
<Set name="Port">8443</Set>
<Set name="maxIdleTime">30000</Set>
- <Set name="Keystore"><SystemProperty name="jetty.home"
default="." />/etc/keystore</Set>
+ <Set name="Keystore">local:keystore:dpml/planet/web/jetty</Set>
<Set name="Password">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
<Set name="KeyPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
</New>
@@ -87,7 +88,6 @@
<!-- Configure a test web application with web.xml -->
<!-- ======================================================= -->

- <!-- REMOVED PENDING PROPER SETUP -->
<Item>
<New id="testWebAppContext"
class="org.mortbay.jetty.webapp.WebAppContext">
<Set name="contextPath">/test</Set>
@@ -98,8 +98,6 @@
</Get>
</New>
</Item>
- <!--
- -->

<!-- ======================================================= -->
<!-- Configure a context directly - no XML parser required -->
@@ -138,8 +136,6 @@
</Set>


- <!-- REMOVED PENDING PROPER SETUP -->
-
<!-- =========================================================== -->
<!-- Additional contexts not defined above -->
<!-- =========================================================== -->
@@ -150,25 +146,20 @@
<Arg type="boolean">True</Arg>
<Arg type="boolean">True</Arg>
</Call>
- <!--
- -->

- <!-- REMOVED PENDING PROPER SETUP -->
<!-- =========================================================== -->
<!-- Configure Realms -->
<!-- =========================================================== -->
- <!--
<Set name="UserRealms">
<Array type="org.mortbay.jetty.security.UserRealm">
<Item>
- <New class="org.mortbay.jetty.security.HashUserRealm">
+ <New class="net.dpml.web.server.HashUserRealm">
<Set name="name">Test Realm</Set>
- <Set name="config">etc/realm.properties</Set>
+ <Set name="config">local:properties:dpml/planet/web/realm</Set>
</New>
</Item>
</Array>
</Set>
- -->

<!-- =========================================================== -->
<!-- Configure Request Log -->

Modified:
trunk/main/planet/web/server/src/main/net/dpml/web/server/ContextHandler.java
===================================================================
---
trunk/main/planet/web/server/src/main/net/dpml/web/server/ContextHandler.java
2006-01-31 12:30:02 UTC (rev 1003)
+++
trunk/main/planet/web/server/src/main/net/dpml/web/server/ContextHandler.java
2006-01-31 13:59:27 UTC (rev 1004)
@@ -18,18 +18,16 @@
import net.dpml.transit.util.PropertyResolver;

/**
- * HTTP server implementation.
+ * Context handler.
*/
public class ContextHandler extends org.mortbay.jetty.handler.ContextHandler
{
/**
- * @param resourceBase The base resource as a string.
+ * @param path The base resource as a string.
*/
- public void setResourceBase( String resourceBase )
+ public void setResourceBase( String path )
{
- String resolved = PropertyResolver.resolve( resourceBase );
- System.out.println( "## RESOURCE BASE: " + resolved );
+ String resolved = PropertyResolver.resolve( path );
super.setResourceBase( resolved );
- }
-
+ }
}

Added:
trunk/main/planet/web/server/src/main/net/dpml/web/server/HashUserRealm.java
===================================================================
---
trunk/main/planet/web/server/src/main/net/dpml/web/server/HashUserRealm.java
2006-01-31 12:30:02 UTC (rev 1003)
+++
trunk/main/planet/web/server/src/main/net/dpml/web/server/HashUserRealm.java
2006-01-31 13:59:27 UTC (rev 1004)
@@ -0,0 +1,62 @@
+/*
+ * 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.io.File;
+import java.io.IOException;
+import java.net.URI;
+
+import net.dpml.transit.util.PropertyResolver;
+
+/**
+ * Hash user realm.
+ */
+public class HashUserRealm extends org.mortbay.jetty.security.HashUserRealm
+{
+ /** Load realm users from properties file.
+ * The property file maps usernames to password specs followed by
+ * an optional comma separated list of role names.
+ *
+ * @param config Filename or url of user properties file.
+ * @exception IOException
+ */
+ public void setConfig( String config )
+ throws IOException
+ {
+ String resolved = PropertyResolver.resolve( config );
+ if( resolved.startsWith( "local:" ) )
+ {
+ try
+ {
+ URI uri = new URI( resolved );
+ File file = (File) uri.toURL().getContent( new Class[]{
File.class } );
+ super.setConfig( file.getCanonicalPath() );
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Invalid local resource specification: " + resolved;
+ IOException ioe = new IOException( error );
+ ioe.initCause( e );
+ throw ioe;
+ }
+ }
+ else
+ {
+ super.setConfig( resolved );
+ }
+ }
+}

Added:
trunk/main/planet/web/server/src/main/net/dpml/web/server/SslSocketConnector.java
===================================================================
---
trunk/main/planet/web/server/src/main/net/dpml/web/server/SslSocketConnector.java
2006-01-31 12:30:02 UTC (rev 1003)
+++
trunk/main/planet/web/server/src/main/net/dpml/web/server/SslSocketConnector.java
2006-01-31 13:59:27 UTC (rev 1004)
@@ -0,0 +1,52 @@
+/*
+ * 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.io.File;
+import java.io.IOException;
+import java.net.URI;
+
+import net.dpml.transit.util.PropertyResolver;
+
+/**
+ * SSL socket connector.
+ */
+public class SslSocketConnector extends
org.mortbay.jetty.security.SslSocketConnector
+{
+ public void setKeystore( String keystore )
+ {
+ String resolved = PropertyResolver.resolve( keystore );
+ if( resolved.startsWith( "local:" ) )
+ {
+ try
+ {
+ URI uri = new URI( resolved );
+ File file = (File) uri.toURL().getContent( new Class[]{
File.class } );
+ super.setKeystore( file.getCanonicalPath() );
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Invalid local keystore specification: " + resolved;
+ throw new RuntimeException( error, e );
+ }
+ }
+ else
+ {
+ super.setKeystore( resolved );
+ }
+ }
+}




  • r1004 - in trunk/main/planet/web/server: etc/prefs etc/prefs/xmls src/main/net/dpml/web/server, mcconnell at BerliOS, 01/31/2006

Archive powered by MHonArc 2.6.24.

Top of Page