tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <wbar...@wilshire.com>
Subject Re: Custom Socket Factory in 5.0.28 (previously unanswered in tomcat-user)
Date Mon, 10 Jan 2005 18:59:43 GMT
The <Factory> element under the <Connector> is deprecated, and doesn't do
very much.

If you're not using SSL (i.e. secure="false" on the <Connector>), then you
need your class to extend o.a.t.u.net.ServerSocketFactory and set
socketFactory="fully.qualified.name.of.my.SocketFactory" on the <Connector>.

----- Original Message -----
From: "James Richardson" <james.richardson@db.com>
To: <tomcat-dev@jakarta.apache.org>
Sent: Monday, January 10, 2005 10:03 AM
Subject: Custom Socket Factory in 5.0.28 (previously unanswered in
tomcat-user)


>
> Hi,
>
> I'm playing around with P2PSockets and thought it might be fun to plug
> into tomcat.
>
> I've written a (very trivial) class to implement the ServerSocketFactory
> interface, but I'm not too sure how to make the Connector use it.
>
> I read of a Factory element that goes within a Context element, but
> couldn't find any more about it.
>
> If anybody could point me in the right direction, would be much
> appreciative.
>
> Thanks!
>
> James
>
>
> package com.xx.es.jxta.tomcat.connector;
>
> import org.apache.catalina.net.ServerSocketFactory;
> import org.p2psockets.P2PServerSocket;
> import org.p2psockets.P2PNetwork;
>
> import java.net.ServerSocket;
> import java.net.InetAddress;
> import java.io.IOException;
> import java.security.KeyStoreException;
> import java.security.NoSuchAlgorithmException;
> import java.security.UnrecoverableKeyException;
> import java.security.KeyManagementException;
> import java.security.cert.CertificateException;
>
> /**
>  * $Header$
>  */
> public class JxtaServerSocketFactory implements ServerSocketFactory {
>
>   protected static boolean initialised = false;
>
>   protected static synchronized void init() throws IOException {
>     if (!initialised) {
>       try {
>         P2PNetwork.signin();
>         initialised = true;
>       } catch (Exception e) {
>         throw new IOException(e.toString());
>       }
>     }
>   }
>
>   public ServerSocket createSocket(int port) throws IOException,
> KeyStoreException, NoSuchAlgorithmException, CertificateException,
> UnrecoverableKeyException, KeyManagementException {
>     init();
>     return new P2PServerSocket(port);
>   }
>
>   public ServerSocket createSocket(int port, int backlog) throws
> IOException, KeyStoreException, NoSuchAlgorithmException,
> CertificateException, UnrecoverableKeyException, KeyManagementException {
>     init();
>     return new P2PServerSocket(port, backlog);
>   }
>
>   public ServerSocket createSocket(int port, int backlog, InetAddress
> ifAddress) throws IOException, KeyStoreException,
> NoSuchAlgorithmException, CertificateException, UnrecoverableKeyException,
> KeyManagementException {
>     init();
>     return new P2PServerSocket(port, backlog, ifAddress);
>   }
> }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>



This message is intended only for the use of the person(s) listed above as the intended recipient(s),
and may contain information that is PRIVILEGED and CONFIDENTIAL.  If you are not an intended
recipient, you may not read, copy, or distribute this message or any attachment. If you received
this communication in error, please notify us immediately by e-mail and then delete all copies
of this message and any attachments.

In addition you should be aware that ordinary (unencrypted) e-mail sent through the Internet
is not secure. Do not send confidential or sensitive information, such as social security
numbers, account numbers, personal identification numbers and passwords, to us via ordinary
(unencrypted) e-mail.



Mime
View raw message