org.apache.commons.httpclient.protocol
Class P2PProtocolSocketFactory

java.lang.Object
  extended byorg.apache.commons.httpclient.protocol.P2PProtocolSocketFactory
All Implemented Interfaces:
org.apache.commons.httpclient.protocol.ProtocolSocketFactory

public class P2PProtocolSocketFactory
extends java.lang.Object
implements org.apache.commons.httpclient.protocol.ProtocolSocketFactory

This class constructs and returns java.net.Sockets that are actually java.net.VirtualSockets, which are sockets that have been converted to use JXTA as their transport and addressing layer. To use this factory, you must first register it: PeerGroup parentPeerGroup = // get the parent peer group that scopes all // requests made over this Jxta socket Protocol jxtaHttp = new Protocol( "http", new JxtaProtocolSocketFactory(), 80 ); Protocol.registerProtocol( "http", jxtaHttp ); You can now use the Apache HTTP Client libraries as you normally would; all http requests will now be made over Jxta sockets instead of raw IP sockets.

Version:
0.3
Author:
Brad GNUberg, bkn3@columbia.edu

Constructor Summary
P2PProtocolSocketFactory()
           
 
Method Summary
 java.net.Socket createSocket(java.lang.String host, int port)
           
 java.net.Socket createSocket(java.lang.String host, int port, java.net.InetAddress clientHost, int clientPort)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.commons.httpclient.protocol.ProtocolSocketFactory
createSocket
 

Constructor Detail

P2PProtocolSocketFactory

public P2PProtocolSocketFactory()
Method Detail

createSocket

public java.net.Socket createSocket(java.lang.String host,
                                    int port,
                                    java.net.InetAddress clientHost,
                                    int clientPort)
                             throws java.io.IOException,
                                    java.net.UnknownHostException
Specified by:
createSocket in interface org.apache.commons.httpclient.protocol.ProtocolSocketFactory
Throws:
java.io.IOException
java.net.UnknownHostException
See Also:
createSocket(java.lang.String,int,java.net.InetAddress,int)

createSocket

public java.net.Socket createSocket(java.lang.String host,
                                    int port)
                             throws java.io.IOException,
                                    java.net.UnknownHostException
Specified by:
createSocket in interface org.apache.commons.httpclient.protocol.ProtocolSocketFactory
Throws:
java.io.IOException
java.net.UnknownHostException
See Also:
ProtocolSocketFactory#createSocket(java.lang.String,int)