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.IncomingUnicastThreads
           
 
Field Summary
static Cm cm
           
static boolean debugFlag
           
static int DefaultNbOfUnicastThreads
           
static java.lang.String HttpSpool
           
 byte[] localIp
           
static java.lang.String MagicWord
           
static int MaxNbOfUnicastKeepAliveThreads
           
static int MaxNbOfUnicastThreads
           
 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 addDynamicHttp(java.lang.String url)
           
 void addStaticHttp(java.lang.String url)
           
 void close()
          closes this TransportProtocol.
 void disablePropagate()
           
 boolean doesPropagate()
           
 void enablePropagate()
           
 net.jxta.endpoint.EndpointAddress getLocalAddress()
          Returns an EndpointAddress of the local endpoint manage by the TransportProtocol
 EndpointMessanger getMessanger(net.jxta.endpoint.EndpointAddress dst, java.lang.String peer, int type)
          Creates and return an EndpointMessanger
 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.lang.String getRouter()
           
 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.
 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 removeDynamicHttp(java.lang.String url)
           
 void removeStaticHttp(java.lang.String url)
           
 void run()
           
 void runReceive(java.net.Socket inputSocket)
           
 void runServer()
           
 java.io.InputStream sendHttpGET(java.lang.String url, boolean reply)
           
static void sendHttpPUT(java.lang.String url, byte[] buffer)
           
 void setProxy(java.lang.String p)
           
 void setRouter(java.lang.String p)
           
 void setServer(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debugFlag

public static boolean debugFlag

serverSocket

public java.net.ServerSocket serverSocket

serverSocketPort

public static int serverSocketPort

localIp

public byte[] localIp

HttpSpool

public static final java.lang.String HttpSpool

MagicWord

public static final java.lang.String MagicWord

cm

public static final Cm cm

DefaultNbOfUnicastThreads

public static final int DefaultNbOfUnicastThreads

MaxNbOfUnicastThreads

public static final int MaxNbOfUnicastThreads

MaxNbOfUnicastKeepAliveThreads

public static final int MaxNbOfUnicastKeepAliveThreads
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 static void sendHttpPUT(java.lang.String url,
                               byte[] buffer)
                        throws java.io.IOException

sendHttpGET

public java.io.InputStream sendHttpGET(java.lang.String url,
                                       boolean reply)
                                throws java.io.IOException

getMessanger

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

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

addStaticHttp

public void addStaticHttp(java.lang.String url)

removeStaticHttp

public void removeStaticHttp(java.lang.String url)

addDynamicHttp

public void addDynamicHttp(java.lang.String url)

removeDynamicHttp

public void removeDynamicHttp(java.lang.String url)

setProxy

public void setProxy(java.lang.String p)

setRouter

public void setRouter(java.lang.String p)

setServer

public void setServer(java.lang.String s)

getProxy

public java.lang.String getProxy()

getRouter

public java.lang.String getRouter()

getServer

public java.lang.String getServer()

enablePropagate

public void enablePropagate()

disablePropagate

public void disablePropagate()

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