Skip to Content.
Sympa Menu

notify-dpml - r1011 - in trunk/main: depot/tools/builder/src/main/net/dpml/tools/tasks planet/web planet/web/server planet/web/server/etc/prefs/keystores planet/web/server/etc/prefs/xmls planet/web/server/src/main/net/dpml/web/server planet/web/test/src/test/net/dpml/web/test

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: r1011 - in trunk/main: depot/tools/builder/src/main/net/dpml/tools/tasks planet/web planet/web/server planet/web/server/etc/prefs/keystores planet/web/server/etc/prefs/xmls planet/web/server/src/main/net/dpml/web/server planet/web/test/src/test/net/dpml/web/test
  • Date: Thu, 2 Feb 2006 19:20:26 +0100

Author: mcconnell
Date: 2006-02-02 19:20:09 +0100 (Thu, 02 Feb 2006)
New Revision: 1011

Added:
trunk/main/planet/web/server/etc/prefs/keystores/demo.keystore
Modified:

trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PrepareTask.java
trunk/main/planet/web/module.xml
trunk/main/planet/web/server/build.xml
trunk/main/planet/web/server/etc/prefs/xmls/jetty.xml

trunk/main/planet/web/server/src/main/net/dpml/web/server/ContextHandler.java
trunk/main/planet/web/server/src/main/net/dpml/web/server/Server.java

trunk/main/planet/web/server/src/main/net/dpml/web/server/SslSocketConnector.java
trunk/main/planet/web/test/src/test/net/dpml/web/test/ServerTestCase.java
Log:
resolve keystore issue (but we don't have demonstratable SSL just yet)

Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PrepareTask.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PrepareTask.java
2006-02-01 19:15:01 UTC (rev 1010)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PrepareTask.java
2006-02-02 18:20:09 UTC (rev 1011)
@@ -49,7 +49,7 @@
private static final String ETC_FILTERED_EXCLUDES_KEY =
"project.prepare.etc.filtered.excludes";
private static final String ETC_FILTERED_EXCLUDES_VALUE =
-
"**/*.exe,**/*.jar*,**/*.dll,**/*.gif,**/*.jpeg,**/*.jpg,**/*.ico,**/*.png";
+
"**/*.exe,**/*.jar*,**/*.dll,**/*.gif,**/*.jpeg,**/*.jpg,**/*.ico,**/*.png,**/*.keystore";

private boolean m_init = false;


Modified: trunk/main/planet/web/module.xml
===================================================================
--- trunk/main/planet/web/module.xml 2006-02-01 19:15:01 UTC (rev 1010)
+++ trunk/main/planet/web/module.xml 2006-02-02 18:20:09 UTC (rev 1011)
@@ -9,7 +9,7 @@
<project name="dpml-web-server" basedir="server">
<types>
<type id="jar"/>
- <type id="part"/>
+ <type id="part" alias="true"/>
</types>
<dependencies>
<include ref="dpml/util/dpml-logging-api"/>

Modified: trunk/main/planet/web/server/build.xml
===================================================================
--- trunk/main/planet/web/server/build.xml 2006-02-01 19:15:01 UTC (rev
1010)
+++ trunk/main/planet/web/server/build.xml 2006-02-02 18:20:09 UTC (rev
1011)
@@ -59,7 +59,7 @@
<target name="install" depends="standard.install">
<property name="prefs" location="${dpml.prefs}/dpml/planet/web"/>
<mkdir dir="${prefs}"/>
- <copy toDir="${prefs}">
+ <copy toDir="${prefs}" filtering="false">
<fileset dir="target/prefs">
<include name="**/*"/>
</fileset>

Added: trunk/main/planet/web/server/etc/prefs/keystores/demo.keystore
===================================================================
(Binary files differ)


Property changes on:
trunk/main/planet/web/server/etc/prefs/keystores/demo.keystore
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Modified: trunk/main/planet/web/server/etc/prefs/xmls/jetty.xml
===================================================================
--- trunk/main/planet/web/server/etc/prefs/xmls/jetty.xml 2006-02-01
19:15:01 UTC (rev 1010)
+++ trunk/main/planet/web/server/etc/prefs/xmls/jetty.xml 2006-02-02
18:20:09 UTC (rev 1011)
@@ -63,8 +63,6 @@
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-->
<!-- Add a HTTPS SSL listener on port 8443
-->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-->
- <!-- DISABLED: something wrong with bundled certificates -->
- <!--
<Item>
<New class="net.dpml.web.server.SslSocketConnector">
<Set name="Port">8443</Set>
@@ -74,7 +72,6 @@
<Set name="KeyPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
</New>
</Item>
- -->
</Array>
</Set>

@@ -85,27 +82,13 @@
<Array type="org.mortbay.jetty.Handler">

<!-- ======================================================= -->
- <!-- Configure a test web application with web.xml -->
- <!-- ======================================================= -->
-
- <Item>
- <New id="testWebAppContext"
class="org.mortbay.jetty.webapp.WebAppContext">
- <Set name="contextPath">/test</Set>
- <Set name="war">./webapps/test</Set>
- <Set name="VirtualHosts"><Array
type="java.lang.String"></Array></Set>
- <Get name="SessionHandler">
- <Set name="SessionManager"><New
class="org.mortbay.jetty.servlet.HashSessionManager"/></Set>
- </Get>
- </New>
- </Item>
-
- <!-- ======================================================= -->
<!-- Configure a context directly - no XML parser required -->
<!-- ======================================================= -->
<Item>
<New id="docsContext" class="net.dpml.web.server.ContextHandler">
<Set name="contextPath">/docs</Set>
<Set name="resourceBase">${dpml.data}/docs</Set>
+ <Set name="priority">100</Set>
<Set name="handler">
<New id="docsServletHandler"
class="org.mortbay.jetty.servlet.ServletHandler">
<Set name="servlets">
@@ -132,6 +115,23 @@
</Set>
</New>
</Item>
+
+ <!-- ======================================================= -->
+ <!-- Configure a test web application with web.xml -->
+ <!-- ======================================================= -->
+
+ <Item>
+ <New id="testWebAppContext"
class="org.mortbay.jetty.webapp.WebAppContext">
+ <!--<Set name="contextPath">/test</Set>-->
+ <Set name="contextPath">/</Set>
+ <Set name="war">./webapps/test</Set>
+ <Set name="VirtualHosts"><Array
type="java.lang.String"></Array></Set>
+ <Get name="SessionHandler">
+ <Set name="SessionManager"><New
class="org.mortbay.jetty.servlet.HashSessionManager"/></Set>
+ </Get>
+ </New>
+ </Item>
+
</Array>
</Set>


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-02-01 19:15:01 UTC (rev 1010)
+++
trunk/main/planet/web/server/src/main/net/dpml/web/server/ContextHandler.java
2006-02-02 18:20:09 UTC (rev 1011)
@@ -20,8 +20,10 @@
/**
* Context handler with enhanced support for symbolic property
dereferencing.
*/
-public class ContextHandler extends org.mortbay.jetty.handler.ContextHandler
+public class ContextHandler extends org.mortbay.jetty.handler.ContextHandler
implements Comparable
{
+ private int m_priority = 0;
+
/**
* Set the context reosurce base. The supplied path argument
* may contain system property references as symbolic references in the
@@ -34,4 +36,52 @@
String resolved = PropertyResolver.resolve( path );
super.setResourceBase( resolved );
}
+
+ /**
+ * Set the handler priority.
+ * @param priority the priority value
+ */
+ public void setPriority( int priority )
+ {
+ m_priority = priority;
+ }
+
+ /**
+ * Return the relative ordering of this object relative to the supplied
object.
+ * If the supplied object is a ContextHandler evaluation will be based on
the
+ * associated priority otherwise evaluation will be based on a default 0
priority
+ * implied on the supplied object.
+ *
+ * @param other the other object
+ * @return the comparative value
+ */
+ public int compareTo( Object other )
+ {
+ if( other instanceof ContextHandler )
+ {
+ ContextHandler handler = (ContextHandler) other;
+ int priority = handler.m_priority;
+ return compare( m_priority, priority );
+ }
+ else
+ {
+ return compare( m_priority, 0 );
+ }
+ }
+
+ int compare( int a, int b )
+ {
+ if( a < b )
+ {
+ return -1;
+ }
+ else if( a == b )
+ {
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+ }
}

Modified:
trunk/main/planet/web/server/src/main/net/dpml/web/server/Server.java
===================================================================
--- trunk/main/planet/web/server/src/main/net/dpml/web/server/Server.java
2006-02-01 19:15:01 UTC (rev 1010)
+++ trunk/main/planet/web/server/src/main/net/dpml/web/server/Server.java
2006-02-02 18:20:09 UTC (rev 1011)
@@ -17,6 +17,7 @@

import java.net.URI;
import java.net.URL;
+import java.util.Arrays;

import net.dpml.logging.Logger;

@@ -24,6 +25,7 @@
import org.mortbay.jetty.RequestLog;
import org.mortbay.jetty.Handler;
import org.mortbay.xml.XmlConfiguration;
+import org.mortbay.util.LazyList;

/**
* HTTP server implementation.
@@ -72,6 +74,23 @@
getLogger().debug( "http server is configured" );
}

+ /*
+ public void addHandler( Handler handler )
+ throws Exception
+ {
+ Handler[] handlers = getHandlers();
+ Handler[] newHandlers = (Handler[]) LazyList.addToArray( handlers,
handler );
+ Arrays.sort( newHandlers );
+ super.setHandlers( newHandlers );
+ }
+
+ public void setHandlers( Handler[] handlers )
+ {
+ Arrays.sort( handlers );
+ super.setHandlers( handlers );
+ }
+ */
+
private Logger getLogger()
{
return m_logger;

Modified:
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-02-01 19:15:01 UTC (rev 1010)
+++
trunk/main/planet/web/server/src/main/net/dpml/web/server/SslSocketConnector.java
2006-02-02 18:20:09 UTC (rev 1011)
@@ -22,6 +22,7 @@
import net.dpml.transit.util.PropertyResolver;

import org.mortbay.log.Log;
+import org.mortbay.resource.Resource;

/**
* SSL socket connector with enhanced keystore resolution semantics.
@@ -37,10 +38,11 @@
*
* @param keystore the keystore value
*/
+ /*
public void setKeystore( String keystore )
{
String resolved = PropertyResolver.resolve( keystore );
- Log.info( "# resolved keystore argument: [" + resolved + "]" );
+ Log.info( "# resolved keystore argument: [" + resolved + "]" );
if( resolved.startsWith( "local:" ) )
{
Log.info( "# argument is a local value" );
@@ -57,7 +59,7 @@
throw new IllegalArgumentException( error );
}
String path = file.getCanonicalPath();
- Log.info( "# validated keystore exists\npath: " + path );
+ Log.info( "# keystore\npath: " + path );
super.setKeystore( path );
}
catch( Exception e )
@@ -73,4 +75,5 @@
super.setKeystore( resolved );
}
}
+ */
}

Modified:
trunk/main/planet/web/test/src/test/net/dpml/web/test/ServerTestCase.java
===================================================================
--- trunk/main/planet/web/test/src/test/net/dpml/web/test/ServerTestCase.java
2006-02-01 19:15:01 UTC (rev 1010)
+++ trunk/main/planet/web/test/src/test/net/dpml/web/test/ServerTestCase.java
2006-02-02 18:20:09 UTC (rev 1011)
@@ -21,6 +21,8 @@

import java.io.File;
import java.net.URI;
+import java.net.URL;
+import java.security.KeyStore;

import junit.framework.TestCase;

@@ -30,6 +32,8 @@

import org.mortbay.jetty.Server;
import org.mortbay.jetty.Handler;
+import org.mortbay.jetty.security.Password;
+import org.mortbay.resource.Resource;

/**
* Test a simple component case.
@@ -46,6 +50,29 @@
* Test the deployment of the Jetty server.
* @exception Exception if an error occurs
*/
+ public void testPassword() throws Exception
+ {
+ Password password = new Password(
"OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4" );
+ System.out.println( "# PASSWORD: :" + password.toString() );
+ }
+
+ /**
+ * Test keystroe loading
+ */
+ public void testKeystore() throws Exception
+ {
+ KeyStore keyStore = KeyStore.getInstance( "JKS" );
+ String password = "password";
+ //URL url = new URL( "local:keystore:dpml/planet/web/demo" );
+ //keyStore.load( url.openStream(), password.toCharArray() );
+ Resource resource = Resource.newResource(
"local:keystore:dpml/planet/web/demo" );
+ keyStore.load( resource.getInputStream(), password.toCharArray() );
+ }
+
+ /**
+ * Test the deployment of the Jetty server.
+ * @exception Exception if an error occurs
+ */
public void testServerDeployment() throws Exception
{
File test = new File( System.getProperty( TEST_DIR_KEY ) );
@@ -57,6 +84,10 @@
Server server = (Server) component.getProvider().getValue( false
);
Handler[] handlers = server.getHandlers();
assertEquals( "handler count", 2, handlers.length );
+ for( int i=0; i<handlers.length; i++ )
+ {
+ System.out.println( handlers[i].toString() );
+ }
}
catch( ControlException e )
{
@@ -81,6 +112,7 @@

static
{
+ System.setProperty( "java.protocol.handler.pkgs", "net.dpml.transit"
);
//System.setProperty( "dpml.logging.config",
"local:properties:dpml/transit/debug" );
System.setProperty(
"java.util.logging.config.class",




  • r1011 - in trunk/main: depot/tools/builder/src/main/net/dpml/tools/tasks planet/web planet/web/server planet/web/server/etc/prefs/keystores planet/web/server/etc/prefs/xmls planet/web/server/src/main/net/dpml/web/server planet/web/test/src/test/net/dpml/web/test, mcconnell at BerliOS, 02/02/2006

Archive powered by MHonArc 2.6.24.

Top of Page