[jboss-cvs] JBoss Messaging SVN: r7588 - in trunk: examples/javaee/servlet-ssl-example and 10 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Jul 19 06:05:53 EDT 2009


Author: ataylor
Date: 2009-07-19 06:05:53 -0400 (Sun, 19 Jul 2009)
New Revision: 7588

Added:
   trunk/examples/javaee/servlet-ssl-example/
   trunk/examples/javaee/servlet-ssl-example/build.xml
   trunk/examples/javaee/servlet-ssl-example/config/
   trunk/examples/javaee/servlet-ssl-example/config/META-INF/
   trunk/examples/javaee/servlet-ssl-example/config/META-INF/application.xml
   trunk/examples/javaee/servlet-ssl-example/config/WEB-INF/
   trunk/examples/javaee/servlet-ssl-example/config/WEB-INF/web.xml
   trunk/examples/javaee/servlet-ssl-example/config/ant.properties
   trunk/examples/javaee/servlet-ssl-example/config/jndi.properties
   trunk/examples/javaee/servlet-ssl-example/readme.html
   trunk/examples/javaee/servlet-ssl-example/server/
   trunk/examples/javaee/servlet-ssl-example/server/jbm-configuration.xml
   trunk/examples/javaee/servlet-ssl-example/server/jbm-jms.xml
   trunk/examples/javaee/servlet-ssl-example/server/jbm-users.xml
   trunk/examples/javaee/servlet-ssl-example/server/jbm.example.keystore
   trunk/examples/javaee/servlet-ssl-example/server/jbm.example.truststore
   trunk/examples/javaee/servlet-ssl-example/server/server.xml
   trunk/examples/javaee/servlet-ssl-example/src/
   trunk/examples/javaee/servlet-ssl-example/src/org/
   trunk/examples/javaee/servlet-ssl-example/src/org/jboss/
   trunk/examples/javaee/servlet-ssl-example/src/org/jboss/javaee/
   trunk/examples/javaee/servlet-ssl-example/src/org/jboss/javaee/example/
   trunk/examples/javaee/servlet-ssl-example/src/org/jboss/javaee/example/ServletSSLTransportExample.java
Modified:
   trunk/examples/javaee/messaging-javaee-examples.iml
   trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java
Log:
netty ssl servlet support and example

Modified: trunk/examples/javaee/messaging-javaee-examples.iml
===================================================================
--- trunk/examples/javaee/messaging-javaee-examples.iml	2009-07-19 09:25:34 UTC (rev 7587)
+++ trunk/examples/javaee/messaging-javaee-examples.iml	2009-07-19 10:05:53 UTC (rev 7588)
@@ -9,6 +9,15 @@
         <webroots>
           <root url="file://$MODULE_DIR$/servlet-transport/config/jms-servlet.war" relative="/" />
         </webroots>
+        <sourceRoots>
+          <root url="file://$MODULE_DIR$/ejb-jms-transaction/src" />
+          <root url="file://$MODULE_DIR$/hajndi/src" />
+          <root url="file://$MODULE_DIR$/jca-config/src" />
+          <root url="file://$MODULE_DIR$/jms-bridge/src" />
+          <root url="file://$MODULE_DIR$/mdb/src" />
+          <root url="file://$MODULE_DIR$/servlet-transport/src" />
+          <root url="file://$MODULE_DIR$/xarecovery/src" />
+        </sourceRoots>
         <building>
           <setting name="EXPLODED_URL" value="file://" />
           <setting name="EXPLODED_ENABLED" value="false" />
@@ -48,6 +57,7 @@
       <sourceFolder url="file://$MODULE_DIR$/jca-config/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/jms-bridge/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/mdb/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/servlet-ssl-example/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/servlet-transport/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/xarecovery/src" isTestSource="false" />
       <excludeFolder url="file://$MODULE_DIR$/mdb/build" />

Copied: trunk/examples/javaee/servlet-ssl-example/build.xml (from rev 7490, trunk/examples/javaee/servlet-transport/build.xml)
===================================================================
--- trunk/examples/javaee/servlet-ssl-example/build.xml	                        (rev 0)
+++ trunk/examples/javaee/servlet-ssl-example/build.xml	2009-07-19 10:05:53 UTC (rev 7588)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- =========================================================================================== -->
+<!--                                                                                             -->
+<!-- JBoss, Home of Professional Open Source                                                     -->
+<!-- Copyright 2005, JBoss Inc., and individual contributors as indicated                        -->
+<!-- by the @authors tag. See the copyright.txt in the distribution for a                        -->
+<!-- full listing of individual contributors.                                                    -->
+<!--                                                                                             -->
+<!-- This is free software; you can redistribute it and/or modify it                             -->
+<!-- under the terms of the GNU Lesser General Public License as                                 -->
+<!-- published by the Free Software Foundation; either version 2.1 of                            -->
+<!-- the License, or (at your option) any later version.                                         -->
+<!--                                                                                             -->
+<!-- This software is distributed in the hope that it will be useful,                            -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of                              -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU                            -->
+<!-- Lesser General Public License for more details.                                             -->
+<!--                                                                                             -->
+<!-- You should have received a copy of the GNU Lesser General Public                            -->
+<!-- License along with this software; if not, write to the Free                                 -->
+<!-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA                          -->
+<!-- 02110-1301 USA, or see the FSF site: http://www.fsf.org.                                    -->
+<!--                                                                                             -->
+<!-- =========================================================================================== -->
+
+
+<project default="run" name="JBoss Messaging Servlet Transport Example">
+
+   <import file="../common/build.xml"/>
+
+   <target name="copy-resources">
+      <path id="keystore.location" location="${example.server.dir}/jbm.example.keystore"/>
+      <property name="keystore.loc" refid="keystore.location"/>
+      <copy toFile="${jboss.home}/server/${example.name}-example-profile/deploy/jbossweb.sar/server.xml"
+            file="${example.server.dir}/server.xml" overwrite="true">
+         <filterset>
+            <filter token="KEYSTORE" value="${keystore.loc}"/>
+         </filterset>
+      </copy>
+   </target>
+   <target name="run">
+      <antcall target="runExample">
+         <param name="example.classname" value="org.jboss.javaee.example.ServletSSLTransportExample"/>
+      </antcall>
+   </target>
+
+</project>

Added: trunk/examples/javaee/servlet-ssl-example/config/META-INF/application.xml
===================================================================
--- trunk/examples/javaee/servlet-ssl-example/config/META-INF/application.xml	                        (rev 0)
+++ trunk/examples/javaee/servlet-ssl-example/config/META-INF/application.xml	2009-07-19 10:05:53 UTC (rev 7588)
@@ -0,0 +1,11 @@
+<application>
+  <display-name>My Application</display-name>
+
+  <module>
+    <web>
+      <web-uri>servlet-ssl-transport-example.war</web-uri>
+      <context-root>/messaging</context-root>
+    </web>
+  </module>
+   
+</application>

Added: trunk/examples/javaee/servlet-ssl-example/config/WEB-INF/web.xml
===================================================================
--- trunk/examples/javaee/servlet-ssl-example/config/WEB-INF/web.xml	                        (rev 0)
+++ trunk/examples/javaee/servlet-ssl-example/config/WEB-INF/web.xml	2009-07-19 10:05:53 UTC (rev 7588)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+         version="2.4">
+   <servlet>
+      <servlet-name>NettyServlet</servlet-name>
+      <servlet-class>org.jboss.netty.channel.socket.http.HttpTunnelingServlet</servlet-class>
+      <init-param>
+             <param-name>endpoint</param-name>
+             <param-value>local:org.jboss.jbm</param-value>
+           </init-param>
+           <load-on-startup>1</load-on-startup>
+   </servlet>
+
+   <servlet-mapping>
+      <servlet-name>NettyServlet</servlet-name>
+      <url-pattern>/JBMServlet</url-pattern>
+   </servlet-mapping>
+</web-app>

Added: trunk/examples/javaee/servlet-ssl-example/config/ant.properties
===================================================================
--- trunk/examples/javaee/servlet-ssl-example/config/ant.properties	                        (rev 0)
+++ trunk/examples/javaee/servlet-ssl-example/config/ant.properties	2009-07-19 10:05:53 UTC (rev 7588)
@@ -0,0 +1 @@
+example.name=servlet-ssl-transport
\ No newline at end of file

Added: trunk/examples/javaee/servlet-ssl-example/config/jndi.properties
===================================================================
--- trunk/examples/javaee/servlet-ssl-example/config/jndi.properties	                        (rev 0)
+++ trunk/examples/javaee/servlet-ssl-example/config/jndi.properties	2009-07-19 10:05:53 UTC (rev 7588)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Copied: trunk/examples/javaee/servlet-ssl-example/readme.html (from rev 7490, trunk/examples/javaee/servlet-transport/readme.html)
===================================================================
--- trunk/examples/javaee/servlet-ssl-example/readme.html	                        (rev 0)
+++ trunk/examples/javaee/servlet-ssl-example/readme.html	2009-07-19 10:05:53 UTC (rev 7588)
@@ -0,0 +1,101 @@
+<html>
+  <head>
+    <title>JBoss Messaging Java EE Servlet SSL Example</title>
+    <link rel="stylesheet" type="text/css" href="../../common/common.css">
+  </head>
+  <body>
+     <h1>Java EE Servlet SSL Example</h1>
+     <br>
+     <p>This example shows you how to configure and use servlet transport over SSL with JBoss Messaging.</p>
+     
+     <h2>JBoss AS configuration</h2>
+
+     <p>Please refer to JBoss Messaging Quickstart guide to <a href="../../../docs/quickstart-guide/en/html_single/index.html#installation.jboss">install it in JBoss AS 5<a></p>
+  
+     <h2>Example configuration</h2>
+        
+
+
+     <h2>Example step-by-step</h2>
+     <p><em>To deploy and start the server, type <code>ant deploy</code>from the example directory</br >
+     Once the server has started type <code>ant run</code> to run the example.<br />
+     To remove the new profile type <code>ant undeploy</code>.</em></p>
+     
+     <br>
+     <ol>
+        <li>First we need to get an initial context so we can look-up the JMS connection factory and destination objects from JNDI. This initial context will get it's properties from the <code>jndi.properties</code> file in the directory <code>config</code></li>
+        <pre>
+           <code>initialContext = new InitialContext();</code>
+        </pre>
+
+        <li>We look up the JMS queue object from JNDI</li>
+        <pre>
+           <code>Queue queue = (Queue) initialContext.lookup("/queue/testQueue");</code>
+        </pre>
+
+        <li>We look up the JMS connection factory object from JNDI</li>
+        <pre>
+           <code>ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/TestServletConnectionFactory");</code>
+        </pre>
+
+        <li>We create a JMS connection</li>
+        <pre>
+           <code>connection = cf.createConnection();</code>
+        </pre>
+
+        <li>We create a JMS session. The session is created as non transacted and will auto acknowledge messages.</li>
+        <pre>
+           <code>Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);</code>
+        </pre>
+
+        <li>We create a JMS message producer on the session. This will be used to send the messages.</li>
+        <pre>
+          <code>MessageProducer messageProducer = session.createProducer(queue);</code>
+       </pre>
+
+        <li>We create a JMS text messages that we are going to send.</li>
+        <pre>
+           <code> TextMessage message = session.createTextMessage("This is a text message");</code>
+        </pre>
+
+        <li>We send messages to the queue</li>
+        <pre>
+           <code>messageProducer.send(message);</code>
+        </pre>
+        
+        <li>We create a JMS Message Consumer</li>
+        <pre>
+           <code>MessageConsumer messageConsumer = session.createConsumer(queue);</code>
+        </pre>
+            
+        <li>We start the connection</li>
+        <pre>
+            <code>connection.start();</code>
+        </pre>
+            
+        <li>We receive the message</li>
+        <pre>
+            <code>TextMessage messageReceived = (TextMessage) messageConsumer.receive(5000);</code>
+        </pre>
+        
+        <li>And finally, <b>always</b> remember to close your JMS connections and resources after use, in a <code>finally</code> block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objects</li>
+
+        <pre>
+           <code>finally
+           {
+              if (initialContext != null)
+              {
+                initialContext.close();
+              }
+              if (connection != null)
+              {
+                 connection.close();
+              }
+           }</code>
+        </pre>
+
+
+
+     </ol>
+  </body>
+</html>

Added: trunk/examples/javaee/servlet-ssl-example/server/jbm-configuration.xml
===================================================================
--- trunk/examples/javaee/servlet-ssl-example/server/jbm-configuration.xml	                        (rev 0)
+++ trunk/examples/javaee/servlet-ssl-example/server/jbm-configuration.xml	2009-07-19 10:05:53 UTC (rev 7588)
@@ -0,0 +1,67 @@
+<configuration xmlns="urn:jboss:messaging"
+               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+               xsi:schemaLocation="urn:jboss:messaging /schema/jbm-configuration.xsd">
+
+   <bindings-directory>${jboss.server.data.dir}/messaging/bindings</bindings-directory>
+
+   <journal-directory>${jboss.server.data.dir}/messaging/journal</journal-directory>
+
+   <large-messages-directory>${jboss.server.data.dir}/messaging/largemessages</large-messages-directory>
+
+   <paging-directory>${jboss.server.data.dir}/messaging/paging</paging-directory>
+
+   <connectors>
+
+      <connector name="netty-servlet">
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
+         <param key="jbm.remoting.netty.host" value="localhost" type="String"/>
+         <param key="jbm.remoting.netty.port" value="8443" type="Integer"/>
+         <param key="jbm.remoting.netty.useservlet" value="true" type="Boolean"/>
+         <param key="jbm.remoting.netty.servletpath" value="/messaging/JBMServlet" type="String"/>
+         <param key="jbm.remoting.netty.sslenabled" value="true" type="Boolean"/>
+         <param key="jbm.remoting.netty.keystorepath" value="server/jbm.example.keystore" type="String"/>
+         <param key="jbm.remoting.netty.keystorepassword" value="jbmexample" type="String"/>
+      </connector>
+
+   </connectors>
+
+   <acceptors>
+
+      <acceptor name="netty-servlet">
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory</factory-class>
+         <param key="jbm.remoting.netty.useinvm" value="true" type="Boolean"/>
+         <param key="jbm.remoting.netty.host" value="org.jboss.jbm" type="String"/>
+      </acceptor>
+
+      <acceptor name="netty-invm">
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory</factory-class>
+         <param key="jbm.remoting.netty.useinvm" value="true" type="Boolean"/>
+         <param key="jbm.remoting.netty.host" value="org.jboss.jbm" type="String"/>
+      </acceptor>
+
+   </acceptors>
+
+
+   <security-settings>
+      <security-setting match="jms.queue.testQueue">
+         <permission type="consume" roles="guest,publisher"/>
+         <permission type="send" roles="guest,publisher"/>
+      </security-setting>
+   </security-settings>
+
+   <address-settings>
+      <!--default for catch all-->
+      <address-setting match="#">
+         <clustered>false</clustered>
+         <dead-letter-address>jms.queue.DLQ</dead-letter-address>
+         <expiry-address>jms.queue.ExpiryQueue</expiry-address>
+         <redelivery-delay>0</redelivery-delay>
+         <max-size-bytes>-1</max-size-bytes>
+         <page-size-bytes>10485760</page-size-bytes>
+         <distribution-policy-class>org.jboss.messaging.core.server.impl.RoundRobinDistributor</distribution-policy-class>
+         <message-counter-history-day-limit>10</message-counter-history-day-limit>
+      </address-setting>
+   </address-settings>
+
+
+</configuration>

Added: trunk/examples/javaee/servlet-ssl-example/server/jbm-jms.xml
===================================================================
--- trunk/examples/javaee/servlet-ssl-example/server/jbm-jms.xml	                        (rev 0)
+++ trunk/examples/javaee/servlet-ssl-example/server/jbm-jms.xml	2009-07-19 10:05:53 UTC (rev 7588)
@@ -0,0 +1,16 @@
+<configuration xmlns="urn:jboss:messaging"
+               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+               xsi:schemaLocation="urn:jboss:messaging /schema/jbm-jms.xsd">
+
+   <connection-factory name="ServletConnectionFactory">
+      <connector-ref connector-name="netty-servlet"/>
+      <entries>
+         <entry name="/ServletConnectionFactory"/>
+      </entries>
+   </connection-factory>
+
+
+   <queue name="testQueue">
+      <entry name="/queue/testQueue"/>
+   </queue>
+</configuration>
\ No newline at end of file

Added: trunk/examples/javaee/servlet-ssl-example/server/jbm-users.xml
===================================================================
--- trunk/examples/javaee/servlet-ssl-example/server/jbm-users.xml	                        (rev 0)
+++ trunk/examples/javaee/servlet-ssl-example/server/jbm-users.xml	2009-07-19 10:05:53 UTC (rev 7588)
@@ -0,0 +1,7 @@
+<configuration xmlns="urn:jboss:messaging" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:jboss:messaging /schema/jbm-users.xsd">
+   <!-- the default user.  this is used where username is null-->
+   <defaultuser name="guest" password="guest">
+      <role name="guest"/>
+   </defaultuser>
+</configuration>
\ No newline at end of file

Copied: trunk/examples/javaee/servlet-ssl-example/server/jbm.example.keystore (from rev 7490, trunk/examples/jms/ssl-enabled/server0/jbm.example.keystore)
===================================================================
(Binary files differ)

Copied: trunk/examples/javaee/servlet-ssl-example/server/jbm.example.truststore (from rev 7490, trunk/examples/jms/ssl-enabled/server0/jbm.example.truststore)
===================================================================
(Binary files differ)

Added: trunk/examples/javaee/servlet-ssl-example/server/server.xml
===================================================================
--- trunk/examples/javaee/servlet-ssl-example/server/server.xml	                        (rev 0)
+++ trunk/examples/javaee/servlet-ssl-example/server/server.xml	2009-07-19 10:05:53 UTC (rev 7588)
@@ -0,0 +1,168 @@
+<Server>
+
+   <!-- Optional listener which ensures correct init and shutdown of APR,
+        and provides information if it is not installed -->
+   <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
+   <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
+   <Listener className="org.apache.catalina.core.JasperListener" />
+
+   <Service name="jboss.web">
+
+      <!-- A HTTP/1.1 Connector on port 8080 -->
+      <Connector protocol="HTTP/1.1" port="8080" address="${jboss.bind.address}"
+               connectionTimeout="20000" redirectPort="8443" />
+
+      <!-- Add this option to the connector to avoid problems with
+          .NET clients that don't implement HTTP/1.1 correctly
+         restrictedUserAgents="^.*MS Web Services Client Protocol 1.1.4322.*$"
+      -->
+
+      <!-- A AJP 1.3 Connector on port 8009 -->
+      <Connector protocol="AJP/1.3" port="8009" address="${jboss.bind.address}"
+         redirectPort="8443" />
+
+      <!-- SSL/TLS Connector configuration using the admin devl guide keystore-->
+      <Connector protocol="HTTP/1.1" SSLEnabled="true"
+           port="8443" address="${jboss.bind.address}"
+           scheme="https" secure="true" clientAuth="false"
+           keystoreFile="@KEYSTORE@"
+           keystorePass="jbmexample" sslProtocol = "TLS" />
+
+
+      <Engine name="jboss.web" defaultHost="localhost">
+
+         <!-- The JAAS based authentication and authorization realm implementation
+         that is compatible with the jboss 3.2.x realm implementation.
+         - certificatePrincipal : the class name of the
+         org.jboss.security.auth.certs.CertificatePrincipal impl
+         used for mapping X509[] cert chains to a Princpal.
+         - allRolesMode : how to handle an auth-constraint with a role-name=*,
+         one of strict, authOnly, strictAuthOnly
+           + strict = Use the strict servlet spec interpretation which requires
+           that the user have one of the web-app/security-role/role-name
+           + authOnly = Allow any authenticated user
+           + strictAuthOnly = Allow any authenticated user only if there are no
+           web-app/security-roles
+         -->
+         <Realm className="org.jboss.web.tomcat.security.JBossWebRealm"
+            certificatePrincipal="org.jboss.security.auth.certs.SubjectDNMapping"
+            allRolesMode="authOnly"
+            />
+         <!-- A subclass of JBossSecurityMgrRealm that uses the authentication
+         behavior of JBossSecurityMgrRealm, but overrides the authorization
+         checks to use JACC permissions with the current java.security.Policy
+         to determine authorized access.
+         - allRolesMode : how to handle an auth-constraint with a role-name=*,
+         one of strict, authOnly, strictAuthOnly
+           + strict = Use the strict servlet spec interpretation which requires
+           that the user have one of the web-app/security-role/role-name
+           + authOnly = Allow any authenticated user
+           + strictAuthOnly = Allow any authenticated user only if there are no
+           web-app/security-roles
+         <Realm className="org.jboss.web.tomcat.security.JaccAuthorizationRealm"
+            certificatePrincipal="org.jboss.security.auth.certs.SubjectDNMapping"
+            allRolesMode="authOnly"
+            />
+         -->
+
+         <Host name="localhost">
+
+            <!-- Uncomment to enable request dumper. This Valve "logs interesting
+                 contents from the specified Request (before processing) and the
+                 corresponding Response (after processing). It is especially useful
+                 in debugging problems related to headers and cookies."
+            -->
+            <!--
+            <Valve className="org.apache.catalina.valves.RequestDumperValve" />
+            -->
+
+            <!-- Access logger -->
+            <!--
+            <Valve className="org.apache.catalina.valves.AccessLogValve"
+                prefix="localhost_access_log." suffix=".log"
+                pattern="common" directory="${jboss.server.log.dir}"
+                resolveHosts="false" />
+            -->
+
+            <!-- Uncomment to enable single sign-on across web apps
+                deployed to this host. Does not provide SSO across a cluster.
+
+                If this valve is used, do not use the JBoss ClusteredSingleSignOn
+                valve shown below.
+
+                A new configuration attribute is available beginning with
+                release 4.0.4:
+
+                cookieDomain  configures the domain to which the SSO cookie
+                              will be scoped (i.e. the set of hosts to
+                              which the cookie will be presented).  By default
+                              the cookie is scoped to "/", meaning the host
+                              that presented it.  Set cookieDomain to a
+                              wider domain (e.g. "xyz.com") to allow an SSO
+                              to span more than one hostname.
+             -->
+            <!--
+            <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
+            -->
+
+            <!-- Uncomment to enable single sign-on across web apps
+               deployed to this host AND to all other hosts in the cluster.
+
+               If this valve is used, do not use the standard Tomcat SingleSignOn
+               valve shown above.
+
+               Valve uses a JBossCache instance to support SSO credential
+               caching and replication across the cluster.  The JBossCache
+               instance must be configured separately.  See the
+               "jboss-web-clusteredsso-beans.xml" file in the
+               server/all/deploy directory for cache configuration details.
+
+               Besides the attributes supported by the standard Tomcat
+               SingleSignOn valve (see the Tomcat docs), this version also
+               supports the following attributes:
+
+               cookieDomain   see non-clustered valve above
+
+               cacheConfig    Name of the CacheManager service configuration
+                              to use for the clustered SSO cache. See
+                              deploy/cluster/jboss-cache-manager.sar/META-INF/jboss-cache-manager-jboss-beans.xml
+                              Default is "clustered-sso".
+
+               treeCacheName  Deprecated. Use "cacheConfig".
+                              JMX ObjectName of the JBoss Cache MBean used to
+                              support credential caching and replication across
+                              the cluster. Only used if no cache can be located
+                              from the CacheManager service using the "cacheConfig"
+                              attribute (or its default value). If not set, the
+                              default is "jboss.cache:service=TomcatClusteringCache"
+
+               maxEmptyLife   The maximum number of seconds an SSO with no
+                              active sessions will be usable by a request
+
+               processExpiresInterval The minimum number of seconds between
+                              efforts by the valve to find and invalidate
+                              SSO's that have exceeded their 'maxEmptyLife'.
+                              Does not imply effort will be spent on such
+                      			cleanup every 'processExpiresInterval'.
+            -->
+            <!--
+            <Valve className="org.jboss.web.tomcat.service.sso.ClusteredSingleSignOn" />
+            -->
+
+            <!-- Check for unclosed connections and transaction terminated checks
+                 in servlets/jsps.
+
+                 Important: The dependency on the CachedConnectionManager
+                 in META-INF/jboss-service.xml must be uncommented, too
+           -->
+
+            <Valve className="org.jboss.web.tomcat.service.jca.CachedConnectionValve"
+                cachedConnectionManagerObjectName="jboss.jca:service=CachedConnectionManager"
+                transactionManagerObjectName="jboss:service=TransactionManager" />
+
+         </Host>
+      </Engine>
+
+   </Service>
+
+</Server>
\ No newline at end of file

Copied: trunk/examples/javaee/servlet-ssl-example/src/org/jboss/javaee/example/ServletSSLTransportExample.java (from rev 7490, trunk/examples/javaee/servlet-transport/src/org/jboss/javaee/example/ServletTransportExample.java)
===================================================================
--- trunk/examples/javaee/servlet-ssl-example/src/org/jboss/javaee/example/ServletSSLTransportExample.java	                        (rev 0)
+++ trunk/examples/javaee/servlet-ssl-example/src/org/jboss/javaee/example/ServletSSLTransportExample.java	2009-07-19 10:05:53 UTC (rev 7588)
@@ -0,0 +1,100 @@
+/*
+   * JBoss, Home of Professional Open Source
+   * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+   * by the @authors tag. See the copyright.txt in the distribution for a
+   * full listing of individual contributors.
+   *
+   * This is free software; you can redistribute it and/or modify it
+   * under the terms of the GNU Lesser General Public License as
+   * published by the Free Software Foundation; either version 2.1 of
+   * the License, or (at your option) any later version.
+   *
+   * This software is distributed in the hope that it will be useful,
+   * but WITHOUT ANY WARRANTY; without even the implied warranty of
+   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   * Lesser General Public License for more details.
+   *
+   * You should have received a copy of the GNU Lesser General Public
+   * License along with this software; if not, write to the Free
+   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+   */
+package org.jboss.javaee.example;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+/**
+ * A simple JMS Queue example that uses servlet protocol.
+ *
+ * @author <a href="hgao at redhat.com">Howard Gao</a>
+ */
+public class ServletSSLTransportExample
+{
+   public static void main(String[] args) throws Exception
+   {
+      Connection connection = null;
+      InitialContext initialContext = null;
+      try
+      {
+         //Step 1. Create an initial context to perform the JNDI lookup.
+         initialContext = new InitialContext();
+
+         //Step 2. Perfom a lookup on the queue
+         Queue queue = (Queue) initialContext.lookup("/queue/testQueue");
+
+         //Step 3. Perform a lookup on the Connection Factory
+         ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ServletConnectionFactory");
+
+         //Step 4.Create a JMS Connection
+         connection = cf.createConnection();
+
+         System.out.println("connection created: " + connection);
+
+         //Step 5. Create a JMS Session
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         //Step 6. Create a JMS Message Producer
+         MessageProducer producer = session.createProducer(queue);
+
+         //Step 7. Create a Text Message
+         TextMessage message = session.createTextMessage("This is a text message");
+
+         System.out.println("Sent message: " + message.getText());
+
+         //Step 8. Send the Message
+         producer.send(message);
+
+         //Step 9. Create a JMS Message Consumer
+         MessageConsumer messageConsumer = session.createConsumer(queue);
+
+         //Step 10. Start the Connection
+         connection.start();
+
+         //Step 11. Receive the message
+         TextMessage messageReceived = (TextMessage) messageConsumer.receive(5000);
+
+         System.out.println("Received message: " + messageReceived.getText());
+
+      }
+      finally
+      {
+         //Step 12. Be sure to close our JMS resources!
+         if (initialContext != null)
+         {
+            initialContext.close();
+         }
+         if(connection != null)
+         {
+            connection.close();
+         }
+      }
+   }
+
+}
\ No newline at end of file

Modified: trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java	2009-07-19 09:25:34 UTC (rev 7587)
+++ trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java	2009-07-19 10:05:53 UTC (rev 7588)
@@ -21,25 +21,6 @@
  */
 package org.jboss.messaging.integration.transports.netty;
 
-import static org.jboss.netty.channel.Channels.pipeline;
-import static org.jboss.netty.channel.Channels.write;
-
-import java.net.ConnectException;
-import java.net.InetSocketAddress;
-import java.net.SocketAddress;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.Executor;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLException;
-
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.remoting.impl.ssl.SSLSupport;
@@ -58,6 +39,8 @@
 import org.jboss.netty.channel.ChannelPipelineCoverage;
 import org.jboss.netty.channel.ChannelPipelineFactory;
 import org.jboss.netty.channel.ChannelStateEvent;
+import static org.jboss.netty.channel.Channels.pipeline;
+import static org.jboss.netty.channel.Channels.write;
 import org.jboss.netty.channel.MessageEvent;
 import org.jboss.netty.channel.SimpleChannelHandler;
 import org.jboss.netty.channel.UpstreamMessageEvent;
@@ -80,6 +63,21 @@
 import org.jboss.netty.handler.codec.http.HttpVersion;
 import org.jboss.netty.handler.ssl.SslHandler;
 
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLException;
+import java.net.ConnectException;
+import java.net.InetSocketAddress;
+import java.net.SocketAddress;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.Executor;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
 /**
  * A NettyConnector
  *
@@ -294,12 +292,17 @@
          context = null; // Unused
       }
 
+      if(context != null && useServlet)
+      {
+         bootstrap.setOption("sslContext", context);
+      }
+
       bootstrap.setPipelineFactory(new ChannelPipelineFactory()
       {
          public ChannelPipeline getPipeline() throws Exception
          {
             ChannelPipeline pipeline = pipeline();
-            if (sslEnabled)
+            if (sslEnabled && !useServlet)
             {
                ChannelPipelineSupport.addSSLFilter(pipeline, context, true);
             }




More information about the jboss-cvs-commits mailing list