org.locomotive.loco.handler
Class HandlerData

java.lang.Object
  |
  +--org.locomotive.loco.handler.HandlerData

public class HandlerData
extends java.lang.Object

A HandlerData object is passed to all module Handlers when they are invoked. This object is the primary interface to the server facilities. New instances are created by the Locomotive, on a per request basis.


Field Summary
 long bstamp_id
          a numerical id used to track browsers.
 Config cfg
          a org.locomotive.loco.LocoConfig referencing the default Loco config object
 java.util.Hashtable cgi_envars_hash
          A hashtable containing the name/value pairs passed into the Loco by the web server.
 java.sql.Connection conn
          A JDBC Connection, cleared, opened, connected, and associated with the Loco's database namespace.
 Log event_log
          a org.locomotive.server.Log referencing the Loco event log.
 FormData form_data
          A convenient class which allows you to access and error-check the data in an HTML form that a user submits.
 java.util.Hashtable form_hash
          A hash of HTML form input variables.
 java.util.Properties handler_config
          the properties file associated with the handler this is being sent to, if there is one.
 java.lang.String handler_uri
          The part of the URI that is after the Locomotive indicator token.
 java.io.InputStream is
          The input stream associated with sock.
 java.io.OutputStream os
          A java.io.OutputStream, associated with Socket sock.
 Response resp
          A Loco response.
 Log server_log
          a org.locomotive.server.Log referencing the Loco server log
 Session session
          The current session
 java.net.Socket sock
          The socket connected to the web server/locolink CGI.
 java.util.Hashtable subs
          This Hashtable contains all the names and values of variables to be inserted into a Steam document.
 java.lang.String[] url_tokens
          an ordered list of the url tokens that triggered the current request.
 User user
          The current simple user
 
Constructor Summary
HandlerData(int r_id)
          HandlerDataconstructor takes the request id whose fields it contains
 
Method Summary
 java.util.Hashtable getAttributes()
          Get the value of attributes.
 int getRequestID()
          gets the id of this request (for logging purposes)
 void setAttributes(java.util.Hashtable v)
          Set the value of attributes.
 java.lang.String toHTMLText()
          returns a string in HTML format which contains debugging information about the data contained in this instance of HandlerData, so we can print it out on a web browse.
 java.lang.String toString()
          returns a string which contains debugging information about the data contained in this instance of HandlerData.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sock

public java.net.Socket sock
The socket connected to the web server/locolink CGI.
See Also:
Socket

is

public java.io.InputStream is
The input stream associated with sock. Currently implemented with java.io.BufferedInputStream.
See Also:
java.io.BufferedInputStream

os

public java.io.OutputStream os
A java.io.OutputStream, associated with Socket sock.

resp

public Response resp
A Loco response. Used to send the text of a response back to the client. The RequestManager will have already set an association with java.net.Socket sock using java.io.BufferedInputStream is

conn

public java.sql.Connection conn
A JDBC Connection, cleared, opened, connected, and associated with the Loco's database namespace. Used to store and retrieve persistant data.

cgi_envars_hash

public java.util.Hashtable cgi_envars_hash
A hashtable containing the name/value pairs passed into the Loco by the web server. Some possible names might be HTTP_REFERRER, CONTENT_TYPE, CONTENT_LENGTH, HTTP_COOKIE.

form_hash

public java.util.Hashtable form_hash
A hash of HTML form input variables. Normally null. Will be non-null only when the current request was generated by an HTTP "POST" from the remote HTTP client (browser). Subsequently, in any HTML form, the "REQUEST_METHOD" should be explicitly set to "POST".
HTTP 'GET' for forms may eventually be supported

form_data

public FormData form_data
A convenient class which allows you to access and error-check the data in an HTML form that a user submits.

subs

public java.util.Hashtable subs
This Hashtable contains all the names and values of variables to be inserted into a Steam document. (This variable is called "steam_vars" in the GenericRequest class)

url_tokens

public java.lang.String[] url_tokens
an ordered list of the url tokens that triggered the current request.

handler_uri

public java.lang.String handler_uri
The part of the URI that is after the Locomotive indicator token. This string is effectivly the contents of url_tokens, but as it actually appears in the browser.
Examples:
If the uri is /cgi-bin/locolink/foo?bar
handler_uri is /foo?bar
if the uri is /cgi-bin/locolink/foo/bar?baz
handler_uri is /foo/bar?baz
or, in the case of using the NSAPI tunnel, the uri might look like
/locolink/handerfoo?bar
handler_uri is then /handlerfoo?bar

Previously called "url", which was somewhat misleading.


session

public Session session
The current session
See Also:
Session

user

public User user
The current simple user
See Also:
User

bstamp_id

public long bstamp_id
a numerical id used to track browsers. Will be set to zero if a stamp is not available. Perhaps could be used for logging purposes.

server_log

public Log server_log
a org.locomotive.server.Log referencing the Loco server log
See Also:
Log

event_log

public Log event_log
a org.locomotive.server.Log referencing the Loco event log. Typically one would make one call to the Event log per request. The logfile format is tab-delimited, and can easily be sucked back into a database for processing, or processed as is with a Perl script.
See Also:
Log

cfg

public Config cfg
a org.locomotive.loco.LocoConfig referencing the default Loco config object
See Also:
LocoConfig

handler_config

public java.util.Properties handler_config
the properties file associated with the handler this is being sent to, if there is one. The properties file path is set in the hrt.conf file. If there is no properties file set, then this will be null. When this is not null, it will always have at least one property:
 HANDLER_PROPERTIES_PATH 
which is the absolute path to the properties file. This allows handlers to manipulate and re-store their properties.
Constructor Detail

HandlerData

public HandlerData(int r_id)
HandlerDataconstructor takes the request id whose fields it contains
Method Detail

getRequestID

public int getRequestID()
gets the id of this request (for logging purposes)

toString

public java.lang.String toString()
returns a string which contains debugging information about the data contained in this instance of HandlerData.
Overrides:
toString in class java.lang.Object

toHTMLText

public java.lang.String toHTMLText()
returns a string in HTML format which contains debugging information about the data contained in this instance of HandlerData, so we can print it out on a web browse.

getAttributes

public java.util.Hashtable getAttributes()
Get the value of attributes.
Returns:
Value of attributes.

setAttributes

public void setAttributes(java.util.Hashtable v)
Set the value of attributes.
Parameters:
v - Value to assign to attributes.