sky.common
Class SkyContext

java.lang.Object
  extended bysky.common.SkyContext

public class SkyContext
extends java.lang.Object

For each request that the SAF controller servlet, SkyServlet, recieves, it creates a SkyContext object. The SkyContext object is then passed to the SAF based form that will handle the request. SkyContext class contains all the necessary information that a SAF based form may need to process the request:

$RCSfile: SkyContext.java,v $
$Revision: 1.8 $, $Date: 2005/04/24 03:14:01 $


Field Summary
protected  javax.servlet.ServletConfig _config
          Servlet config.
protected  javax.servlet.ServletContext _context
          Servlet context.
protected  java.lang.String _from
          Sender's email address for sending emails as specified by user in web.xml file.
protected  java.lang.String _mime
          HTTP response mime-type.
protected  java.lang.String _name
          Class name of the form that will handle the HTTP request.
protected  java.io.OutputStream _out
          HTTP response output stream.
protected  DBPool _pool
          Handle to database connection pool.
protected  javax.servlet.http.HttpServletRequest _request
          Servlet request.
protected  javax.servlet.http.HttpServletResponse _response
          Servlet response.
protected  java.lang.String _smtp
          STMP server name for sending emails as specified by user in web.xml file.
protected  Tracker _t
          Tracks user and session activity.
protected  java.io.PrintWriter _writer
          HTTP response writer.
static FormattedResourceBundle STRINGS
           
 
Constructor Summary
SkyContext(javax.servlet.ServletConfig config)
          Constructor for instantiating SkyContext object.
 
Method Summary
 void clear()
          Clear all the state information except values of parameters specified in web.xml application descriptor file.
 java.lang.String getContentType()
          Get the currently set mime-type of the response.
 DatabaseConnector getDatabaseConnector(Form form)
          Get a database connection from the database connection pool.
 EmailConnector getEmailConnector()
          Get an email connection
 java.io.OutputStream getOutputStream()
          Get output stream that can be used to create a response.
 java.io.PrintWriter getPrintWriter()
          Get print writer that can be used to create a response.
 javax.servlet.ServletConfig getServletConfig()
          Get servlet config associated with this context.
 javax.servlet.ServletContext getServletContext()
          Get servlet context assocated with this context
 java.lang.String getServletName()
          Get the name of the SAF form class that is going to process the HTTP request associated with this context.
 javax.servlet.http.HttpServletRequest getServletRequest()
          Get servlet request associated with this context.
 javax.servlet.http.HttpServletResponse getServletResponse()
          Get servlet response associated with this context
 javax.servlet.http.HttpSession getServletSession()
          Get servlet session associated with this context.
 Tracker getTracker()
          Get the Tracker object that is being used to track user activies.
 void setContentType(java.lang.String type)
          Set the mime-type of the response.
 void setHttp(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Set HTTP request and response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_name

protected java.lang.String _name
Class name of the form that will handle the HTTP request.


_request

protected javax.servlet.http.HttpServletRequest _request
Servlet request.


_response

protected javax.servlet.http.HttpServletResponse _response
Servlet response.


_context

protected javax.servlet.ServletContext _context
Servlet context.


_config

protected javax.servlet.ServletConfig _config
Servlet config.


_writer

protected java.io.PrintWriter _writer
HTTP response writer.


_out

protected java.io.OutputStream _out
HTTP response output stream.


_mime

protected java.lang.String _mime
HTTP response mime-type.


_t

protected Tracker _t
Tracks user and session activity.


_pool

protected DBPool _pool
Handle to database connection pool.


_smtp

protected java.lang.String _smtp
STMP server name for sending emails as specified by user in web.xml file.


_from

protected java.lang.String _from
Sender's email address for sending emails as specified by user in web.xml file.


STRINGS

public static final FormattedResourceBundle STRINGS
Constructor Detail

SkyContext

public SkyContext(javax.servlet.ServletConfig config)
           throws ErrorMessage
Constructor for instantiating SkyContext object. Parameters specified by the user in web.xml file are read in this constructor. These parameters can be one or more of the following:

Parameters:
config - ServletConfig for an HTTP request.
Throws:
ErrorMessage - if the user did not specify parameters in web.xml properly.
Method Detail

clear

public void clear()
Clear all the state information except values of parameters specified in web.xml application descriptor file.


setHttp

public void setHttp(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
             throws ErrorMessage
Set HTTP request and response.

Parameters:
request - HTTP request.
response - HTTP response.
Throws:
ErrorMessage - if an IOException occurs.

getServletRequest

public javax.servlet.http.HttpServletRequest getServletRequest()
Get servlet request associated with this context.

Returns:
servlet request.

getServletResponse

public javax.servlet.http.HttpServletResponse getServletResponse()
Get servlet response associated with this context

Returns:
servlet response.

getServletSession

public javax.servlet.http.HttpSession getServletSession()
Get servlet session associated with this context.

Returns:
servlet session.

getServletContext

public javax.servlet.ServletContext getServletContext()
Get servlet context assocated with this context

Returns:
servlet context.

getServletConfig

public javax.servlet.ServletConfig getServletConfig()
Get servlet config associated with this context.

Returns:
servlet config.

getServletName

public java.lang.String getServletName()
Get the name of the SAF form class that is going to process the HTTP request associated with this context.

Returns:
SAF form class name.

getTracker

public Tracker getTracker()
Get the Tracker object that is being used to track user activies.

Returns:
tracker

getDatabaseConnector

public DatabaseConnector getDatabaseConnector(Form form)
                                       throws Message
Get a database connection from the database connection pool.

Returns:
database connection.
Throws:
Messages - if any messages are produced as a result of this operation.
Message

getEmailConnector

public EmailConnector getEmailConnector()
Get an email connection

Returns:
email connection.

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws ErrorMessage
Get output stream that can be used to create a response.

Returns:
output stream.
Throws:
ErrorMessage - if there is an IO problem.

getPrintWriter

public java.io.PrintWriter getPrintWriter()
                                   throws ErrorMessage
Get print writer that can be used to create a response.

Returns:
print writer
Throws:
ErrorMessage - if there is an IO exception.

setContentType

public void setContentType(java.lang.String type)
Set the mime-type of the response.


getContentType

public java.lang.String getContentType()
Get the currently set mime-type of the response.