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).
-
req
- The HTTP request.
-
HttpAdapter()
- Creates a HttpAdapter without registering itself as a message listener.
Deprecated.
-
HttpAdapter(String)
- Creates a HttpAdapter and register itself as a message listener
with the specified name.
-
HttpAdapter(String, MessageDispatcher)
- Creates a HttpAdapter and register itself as a message listener
with the specified name at the specified message dispatcher.
-
finalize()
- Finalizes this HttpAdapter by removing it as message listener.
-
generatePage()
- Generates the content of a HTTP response (a web-page).
-
getMethod()
- Returns the HTTP request's method.
-
getName()
- Returns the name of the http adapter.
-
getPathInfo()
- Gets the Path of the HTTP request.
-
getPostData()
- Gets the posted data (cgi information) of the HTTP request.
-
getQueryData()
- Gets the query data (cgi information) of the HTTP request.
-
getRemoteHost()
- Returns the HTTP request's remote host.
-
message(Message)
- Invoked when a Message is received.
-
setErrorCode(int)
- Sets the HTTP response's error code.
-
setStatusCode(int)
- Returns the HTTP request's remote host.
req
protected HttpMessage req
- The HTTP request.
HttpAdapter
public HttpAdapter()
- Note: HttpAdapter() is deprecated.
Use HttpAdapter(name) instead.
- Creates a HttpAdapter without registering itself as a message listener.
- See Also:
- HttpAdapter
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.
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.
getName
public String getName()
- Returns the name of the http adapter.
- Returns:
- the name of the http adapter.
finalize
public void finalize()
- Finalizes this HttpAdapter by removing it as message listener.
- Overrides:
- finalize in class Object
getMethod
public String getMethod()
- Returns the HTTP request's method.
getRemoteHost
public String getRemoteHost()
- Returns the HTTP request's remote host.
setStatusCode
public void setStatusCode(int code)
- Returns the HTTP request's remote host.
setErrorCode
public void setErrorCode(int code)
- Sets the HTTP response's error code.
getPathInfo
public String getPathInfo()
- Gets the Path of the HTTP request.
getQueryData
public Hashtable getQueryData()
- Gets the query data (cgi information) of the HTTP request.
getPostData
public Hashtable getPostData()
- Gets the posted data (cgi information) of the HTTP request.
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.
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