Project JXTA

net.jxta.impl.endpoint.http
Class HttpTransport

java.lang.Object
  |
  +--net.jxta.impl.endpoint.http.HttpTransport

public class HttpTransport
extends java.lang.Object
implements TransportProtocol, java.lang.Runnable

This class implements the HTTP Transport Protocol


Inner Class Summary
 class HttpTransport.ClientConnection
           
 class HttpTransport.IncomingUnicastThreads
           
 class HttpTransport.ServerConnection
           
 
Field Summary
static int BlockingSend
           
static Cm cm
           
static int DefaultNbOfUnicastThreads
           
static java.lang.String HttpSpool
           
static java.lang.String MagicWord
           
static int MaxNbOfPendingSockets
           
static int MaxNbOfUnicastKeepAliveThreads
           
static int MaxNbOfUnicastThreads
           
static int PollingSend
           
 java.net.ServerSocket serverSocket
           
static int serverSocketPort
           
 
Constructor Summary
HttpTransport()
           
HttpTransport(net.jxta.protocol.EndpointAdvertisement a)
          This is a portion of the API which might not be useful when the configuration part of the JXTA platform will be completed.
 
Method Summary
 void addPollingHttp(java.lang.String url)
           
 void close()
          closes this TransportProtocol.
 boolean doesPropagate()
           
 net.jxta.endpoint.EndpointAddress getLocalAddress()
          Returns an EndpointAddress of the local endpoint manage by the TransportProtocol
 EndpointMessenger getMessenger(net.jxta.endpoint.EndpointAddress dst, java.lang.String peer, int type)
          Creates and return an EndpointMessenger
 int getPort()
           
 java.lang.String getProtocolName()
          Returns a String containing the canonical name of this protocol, as it appears in an EndpointAddress.
 java.lang.String getProxy()
           
 java.util.Vector getRouters()
           
 java.lang.String getServer()
           
 void init(Endpoint ep)
          Initialise this instance of the TransportProtocol.
 boolean isConnected()
          Returns true if the Transport Protocol can establish connection to the remote host (like TCP).
 boolean isFast()
          Returns true if the Transport Protocol is fast.
 boolean ping(net.jxta.endpoint.EndpointAddress addr)
          Returns true if the target address is reachable.
protected  boolean pollRemote(java.lang.String addr, int type)
           
 void propagate(net.jxta.endpoint.Message message, java.lang.String pName, java.lang.String pParams, java.lang.String prunePeer)
          Propagates a TransportMessage on this TransportProtocol
 void removePollingHttp(java.lang.String url)
           
 void run()
           
 void runReceive(java.net.Socket inputSocket)
           
 void runServer()
           
 void sendHttpPUT(java.lang.String url, java.util.Enumeration buffers, long size)
           
protected  void sendMessageToClient(java.lang.String peer, java.util.Vector buffers)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HttpSpool

public static final java.lang.String HttpSpool

cm

public static final Cm cm

MagicWord

public static final java.lang.String MagicWord

DefaultNbOfUnicastThreads

public static final int DefaultNbOfUnicastThreads

MaxNbOfUnicastThreads

public static final int MaxNbOfUnicastThreads

MaxNbOfUnicastKeepAliveThreads

public static final int MaxNbOfUnicastKeepAliveThreads

MaxNbOfPendingSockets

public static final int MaxNbOfPendingSockets

serverSocketPort

public static int serverSocketPort

serverSocket

public java.net.ServerSocket serverSocket

PollingSend

public static final int PollingSend

BlockingSend

public static final int BlockingSend
Constructor Detail

HttpTransport

public HttpTransport(net.jxta.protocol.EndpointAdvertisement a)
This is a portion of the API which might not be useful when the configuration part of the JXTA platform will be completed. XXX: to revisit.

HttpTransport

public HttpTransport()
Method Detail

getPort

public int getPort()

init

public void init(Endpoint ep)
Description copied from interface: TransportProtocol
Initialise this instance of the TransportProtocol. XXX: this method prototype will need to be revisited when the configuration framework will be completed.
Specified by:
init in interface TransportProtocol

run

public void run()
Specified by:
run in interface java.lang.Runnable

runServer

public void runServer()

runReceive

public void runReceive(java.net.Socket inputSocket)

sendHttpPUT

public void sendHttpPUT(java.lang.String url,
                        java.util.Enumeration buffers,
                        long size)
                 throws java.io.IOException

sendMessageToClient

protected void sendMessageToClient(java.lang.String peer,
                                   java.util.Vector buffers)

getMessenger

public EndpointMessenger getMessenger(net.jxta.endpoint.EndpointAddress dst,
                                      java.lang.String peer,
                                      int type)
                               throws java.io.IOException
Creates and return an EndpointMessenger
Specified by:
getMessenger in interface TransportProtocol
Tags copied from interface: TransportProtocol
Parameters:
dest - EndpointAddress of the destination
type - type of the messenger as defined in the class Endpoint
Returns:
an EndpointMessenger.

propagate

public void propagate(net.jxta.endpoint.Message message,
                      java.lang.String pName,
                      java.lang.String pParams,
                      java.lang.String prunePeer)
               throws java.io.IOException
Propagates a TransportMessage on this TransportProtocol
Specified by:
propagate in interface TransportProtocol
Parameters:
msg - the TransportMessage to be propagated

getProtocolName

public java.lang.String getProtocolName()
Description copied from interface: TransportProtocol
Returns a String containing the canonical name of this protocol, as it appears in an EndpointAddress.
Specified by:
getProtocolName in interface TransportProtocol
Tags copied from interface: TransportProtocol
Returns:
a String containing the name of the protocol

close

public void close()
closes this TransportProtocol.
Specified by:
close in interface TransportProtocol

getLocalAddress

public net.jxta.endpoint.EndpointAddress getLocalAddress()
Description copied from interface: TransportProtocol
Returns an EndpointAddress of the local endpoint manage by the TransportProtocol
Specified by:
getLocalAddress in interface TransportProtocol
Tags copied from interface: TransportProtocol
Returns:
an EndpointAddress containing the local address

addPollingHttp

public void addPollingHttp(java.lang.String url)

removePollingHttp

public void removePollingHttp(java.lang.String url)

pollRemote

protected boolean pollRemote(java.lang.String addr,
                             int type)

getProxy

public java.lang.String getProxy()

getRouters

public java.util.Vector getRouters()

getServer

public java.lang.String getServer()

doesPropagate

public boolean doesPropagate()

isFast

public boolean isFast()
Description copied from interface: TransportProtocol
Returns true if the Transport Protocol is fast. The notion of being fast is relative, but any mailbox type of protocols should return false.
Specified by:
isFast in interface TransportProtocol

isConnected

public boolean isConnected()
Description copied from interface: TransportProtocol
Returns true if the Transport Protocol can establish connection to the remote host (like TCP).
Specified by:
isConnected in interface TransportProtocol

ping

public boolean ping(net.jxta.endpoint.EndpointAddress addr)
Description copied from interface: TransportProtocol
Returns true if the target address is reachable. Otherwise returns false.
Specified by:
ping in interface TransportProtocol

Project JXTA