JXTA

net.jxta.impl.protocol
Class HTTPAdv

java.lang.Object
  extended by net.jxta.document.Advertisement
      extended by net.jxta.document.ExtendableAdvertisement
          extended by net.jxta.protocol.TransportAdvertisement
              extended by net.jxta.impl.protocol.HTTPAdv

public class HTTPAdv
extends TransportAdvertisement

Configuration parameters for HttpServelet Message Transport.


Nested Class Summary
static class HTTPAdv.Instantiator
          Our instantiator.
 
Field Summary
 
Fields inherited from class net.jxta.protocol.TransportAdvertisement
protocol
 
Method Summary
static String getAdvertisementType()
          Returns the identifying type of this Advertisement.
 String getAdvType()
          Returns the identifying type of this Advertisement.
 String getConfigMode()
          returns the config mode.
 Document getDocument(MimeMediaType encodeAs)
          Write this advertisement into a document of the requested type.
 String[] getIndexFields()
          Returns the element names on which this advertisement should be indexed.
 String getInterfaceAddress()
          Returns the interfaceAddr.
 int getPort()
          Returns the port number to which server sockets are locally bound.
 String getProxy()
          Deprecated. This has been deprecated. Set your proxy directly with the JVM
 boolean getPublicAddressOnly()
           
 String getServer()
           
protected  boolean handleElement(Element raw)
          Process an individual element from the document during parse.
 boolean isClientEnabled()
           
 boolean isProxyEnabled()
          Deprecated. This has been deprecated. Set your proxy directly with the JVM
 boolean isServerEnabled()
           
 void setClientEnabled(boolean enabled)
           
 void setConfigMode(String mode)
          set the config mode.
 void setInterfaceAddress(String address)
          Sets the interfaceAddr.
 void setPort(int newPort)
          Sets the port number to which server sockets are locally bound.
 void setProxy(String name)
          Deprecated. This has been deprecated. Set your proxy directly with the JVM
 void setProxyEnabled(boolean enabled)
          Deprecated. This has been deprecated. Set your proxy directly with the JVM
 void setPublicAddressOnly(boolean only)
           
 void setServer(String name)
           
 void setServerEnabled(boolean enabled)
           
 
Methods inherited from class net.jxta.protocol.TransportAdvertisement
getBaseAdvType, getID, getProtocol, setProtocol
 
Methods inherited from class net.jxta.document.ExtendableAdvertisement
handleAttribute
 
Methods inherited from class net.jxta.document.Advertisement
clone, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getAdvertisementType

public static String getAdvertisementType()
Returns the identifying type of this Advertisement.

Note: This is a static method. It cannot be used to determine the runtime type of an advertisement. ie.

      Advertisement adv = module.getSomeAdv();
      String advType = adv.getAdvertisementType();
  

This is wrong and does not work the way you might expect. This call is not polymorphic and calls Advertisement.getAdvertisementType() no matter what the real type of the advertisement.

Returns:
String the type of advertisement

getAdvType

public String getAdvType()
Returns the identifying type of this Advertisement. Unlike Advertisement.getAdvertisementType() this method will return the correct runtime type of an Advertisement object.

This implementation is provided for existing advertisements which do not provide their own implementation. In most cases you should provide your own implementation for efficiency reasons.

Overrides:
getAdvType in class Advertisement
Returns:
The identifying type of this Advertisement.

handleElement

protected boolean handleElement(Element raw)
Process an individual element from the document during parse. Normally, implementations will allow the base advertisements a chance to handle the element before attempting to handle the element themselves. ie.


  protected boolean handleElement(Element elem) {

      if (super.handleElement()) {
           // it's been handled.
           return true;
           }
      ... handle elements here ...

      // we don't know how to handle the element
      return false;
      }
  

Overrides:
handleElement in class ExtendableAdvertisement
Parameters:
raw - The element to be processed.
Returns:
true if the element was recognized, otherwise false.

getDocument

public Document getDocument(MimeMediaType encodeAs)
Write this advertisement into a document of the requested type. Two standard document forms are defined. "text/plain" encodes the document in a "pretty-print" format for human viewing and "text/xml" which provides an XML format.

We don't have any content to add, just build the document instance and return it to implementations that actually do something with it.

NB: we do not try to enforce dependency rules such as Proxy only when router, because we want to convey the complete configuration, even items corresponding to not currently enabled features. HttpTransport will gracefully disregard items that have no use in the current context.

Overrides:
getDocument in class ExtendableAdvertisement
Parameters:
encodeAs - MimeMediaType format representation requested.
Returns:
The Advertisement represented as a Document of the requested MIME Media Type.

getInterfaceAddress

public String getInterfaceAddress()
Returns the interfaceAddr. That is, the ip of the IF to which to bind locally created sockets.

Returns:
string The address.

setInterfaceAddress

public void setInterfaceAddress(String address)
Sets the interfaceAddr. That is, the ip of the IF to which to bind locally created sockets.

Parameters:
address - The address

getPublicAddressOnly

public boolean getPublicAddressOnly()

setPublicAddressOnly

public void setPublicAddressOnly(boolean only)

getConfigMode

public String getConfigMode()
returns the config mode. That is, how the user prefers to configure the interface address: "auto", "manual"

Returns:
string config mode

setConfigMode

public void setConfigMode(String mode)
set the config mode. That is, how the user prefers to configure the interface address: "auto", "manual"

This is just a pure config item. It is never in published advs. The TCP transport strips it when it initializes.

Parameters:
mode - Can be "auto", "manual" other settings will act as the default which is "auto".

getPort

public int getPort()
Returns the port number to which server sockets are locally bound.

Returns:
String the port

setPort

public void setPort(int newPort)
Sets the port number to which server sockets are locally bound.

Parameters:
newPort - the port

getProxy

@Deprecated
public String getProxy()
Deprecated. This has been deprecated. Set your proxy directly with the JVM

Returns:
the proxy string

getServer

public String getServer()

isProxyEnabled

@Deprecated
public boolean isProxyEnabled()
Deprecated. This has been deprecated. Set your proxy directly with the JVM

Returns:
true if proxy enabled

isServerEnabled

public boolean isServerEnabled()

isClientEnabled

public boolean isClientEnabled()

setProxy

@Deprecated
public void setProxy(String name)
Deprecated. This has been deprecated. Set your proxy directly with the JVM

Parameters:
name - the proxy string

setServer

public void setServer(String name)

setProxyEnabled

@Deprecated
public void setProxyEnabled(boolean enabled)
Deprecated. This has been deprecated. Set your proxy directly with the JVM

Parameters:
enabled - true if proxy is enabled

setServerEnabled

public void setServerEnabled(boolean enabled)

setClientEnabled

public void setClientEnabled(boolean enabled)

getIndexFields

public String[] getIndexFields()
Returns the element names on which this advertisement should be indexed.

Specified by:
getIndexFields in class Advertisement
Returns:
The element names on which this advertisement should be indexed.

JXSE