All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sics.agentbase.http.HttpAdapter

java.lang.Object
   |
   +----sics.agentbase.http.HttpAdapter

public abstract class HttpAdapter
extends Object
implements MessageListener
HttpAdapter makes it easier to program web-pages. The adapter calls the method generatePage when a HTTP request has been made to the object. It also implements a number of methods for retrieving information about the request (ex Method, Host, etc).


Variable Index

 o req
The HTTP request.

Constructor Index

 o HttpAdapter()
Creates a HttpAdapter without registering itself as a message listener. Deprecated.
 o HttpAdapter(String)
Creates a HttpAdapter and register itself as a message listener with the specified name.
 o HttpAdapter(String, MessageDispatcher)
Creates a HttpAdapter and register itself as a message listener with the specified name at the specified message dispatcher.

Method Index

 o finalize()
Finalizes this HttpAdapter by removing it as message listener.
 o generatePage()
Generates the content of a HTTP response (a web-page).
 o getMethod()
Returns the HTTP request's method.
 o getName()
Returns the name of the http adapter.
 o getPathInfo()
Gets the Path of the HTTP request.
 o getPostData()
Gets the posted data (cgi information) of the HTTP request.
 o getQueryData()
Gets the query data (cgi information) of the HTTP request.
 o getRemoteHost()
Returns the HTTP request's remote host.
 o message(Message)
Invoked when a Message is received.
 o setErrorCode(int)
Sets the HTTP response's error code.
 o setStatusCode(int)
Returns the HTTP request's remote host.

Variables

 o req
 protected HttpMessage req
The HTTP request.

Constructors

 o HttpAdapter
 public HttpAdapter()
Note: HttpAdapter() is deprecated. Use HttpAdapter(name) instead.

Creates a HttpAdapter without registering itself as a message listener.

See Also:
HttpAdapter
 o HttpAdapter
 public HttpAdapter(String name)
Creates a HttpAdapter and register itself as a message listener with the specified name. All messages directed to "name" will be sent to this object.

Parameters:
name - the name of this message listener.
 o HttpAdapter
 public HttpAdapter(String name,
                    MessageDispatcher dispatcher)
Creates a HttpAdapter and register itself as a message listener with the specified name at the specified message dispatcher. All messages directed to "name" will be sent to this object.

Parameters:
name - the name of this message listener.
dispatcher - the message dispatcher to register at.

Methods

 o getName
 public String getName()
Returns the name of the http adapter.

Returns:
the name of the http adapter.
 o finalize
 public void finalize()
Finalizes this HttpAdapter by removing it as message listener.

Overrides:
finalize in class Object
 o getMethod
 public String getMethod()
Returns the HTTP request's method.

 o getRemoteHost
 public String getRemoteHost()
Returns the HTTP request's remote host.

 o setStatusCode
 public void setStatusCode(int code)
Returns the HTTP request's remote host.

 o setErrorCode
 public void setErrorCode(int code)
Sets the HTTP response's error code.

 o getPathInfo
 public String getPathInfo()
Gets the Path of the HTTP request.

 o getQueryData
 public Hashtable getQueryData()
Gets the query data (cgi information) of the HTTP request.

 o getPostData
 public Hashtable getPostData()
Gets the posted data (cgi information) of the HTTP request.

 o message
 public synchronized void message(Message msg)
Invoked when a Message is received. This method calls the generatePage method for generating the content (typically a HTML page) of the HTTP response.

Parameters:
msg - A Message object describing the message.
 o generatePage
 protected abstract Object generatePage()
Generates the content of a HTTP response (a web-page). The object returned must implement a toString() which will be the content of the page.


All Packages  Class Hierarchy  This Package  Previous  Next  Index