org.apache.turbine.services.rundata
Class DefaultTurbineRunData

java.lang.Object
  |
  +--org.apache.turbine.util.pool.RecyclableSupport
        |
        +--org.apache.turbine.services.rundata.DefaultTurbineRunData
All Implemented Interfaces:
Recyclable, RunData, TurbineRunData

public class DefaultTurbineRunData
extends RecyclableSupport
implements TurbineRunData, Recyclable

DefaultTurbineRunData is the default implementation of the TurbineRunData interface, which is distributed by the Turbine RunData service, if another implementation is not defined in the default or specified RunData configuration. TurbineRunData is an extension to RunData, which is an interface to run-rime information that is passed within Turbine. This provides the threading mechanism for the entire system because multiple requests can potentially come in at the same time. Thus, there is only one RunData implementation for each request that is being serviced.

DefaultTurbineRunData implements the Recyclable interface making it possible to pool its instances for recycling.

Version:
$Id$
Author:
Ilkka Priha, Jon S. Stevens, Bernie Hoeneisen, Daniel Rall

Field Summary
private  AccessControlList acl
          The access control list.
private  java.lang.String action
          Cached action name to execute for this request.
private  java.lang.String charSet
          The HTTP charset.
private  javax.servlet.ServletConfig config
          The servlet configuration.
private  java.lang.String contentType
          The HTTP content type to return.
 CookieParser cookies
          A reference to a cookie parser.
private static java.lang.String defaultCharSet
          The default charset.
private static boolean defaultCharSetChecked
          The default charset checked flag.
private static java.util.Locale defaultLocale
          The default locale.
private static boolean defaultLocaleChecked
          The default locale checked flag.
private  java.util.Vector errors
          This is a vector to hold critical system errors.
private  java.util.Hashtable jndiContexts
          JNDI Contexts.
private  java.lang.String layout
          This is the layout that the page will use to render the screen.
private  java.util.Locale locale
          The locale.
private  org.apache.ecs.StringElement message
          This is where output messages from actions should go.
private  FormMessages messages
          This is a dedicated message class where output messages from actions should go.
private  java.io.PrintWriter out
          Cache the output stream because it can be used in many different places.
private  boolean outSet
          Determines if there is information in the outputstream or not.
private  org.apache.ecs.Document page
          This creates an ECS Document.
private  boolean pageSet
          Determines if there is information in the document or not.
private  ParameterParser parameters
          A reference to the GET/POST data parser.
private  java.lang.String redirectURI
          If this is set, also set the status code to 302.
private  java.lang.String remoteAddr
           
private  java.lang.String remoteHost
           
private  javax.servlet.http.HttpServletRequest req
          The servlet request interface.
private  javax.servlet.http.HttpServletResponse res
          The servlet response interface.
private  java.lang.String screen
          Cached screen name to execute for this request.
private  ServerData serverData
          Holds ServerData (basic properties) about this RunData object.
private  javax.servlet.ServletContext servletContext
          The servlet context information.
private  javax.servlet.http.HttpSession session
          The servlet session information.
private  java.lang.String stackTrace
          A holder for stack trace.
private  java.lang.Throwable stackTraceException
          A holder ofr stack trace exception.
private  int statusCode
          The HTTP status code to return.
private  java.lang.String templateEncoding
          The character encoding of template files.
private  TemplateInfo templateInfo
          Information used by a Template system (such as Velocity/Freemarker).
private  java.lang.String title
          This is what will build the of the document.
private  User user
          The user object.
private  java.lang.String userAgent
           
private  java.util.Hashtable varDebug
          Put things here and they will be shown on the default Error screen.
 
Fields inherited from class org.apache.turbine.util.pool.RecyclableSupport
disposed
 
Constructor Summary
DefaultTurbineRunData()
          Constructs a run data object.
 
Method Summary
 void addMessage(org.apache.ecs.Element msg)
          Adds the ECS element to message.
 void addMessage(java.lang.String msg)
          Adds the string to message.
 void declareDirectResponse()
          Declares that output will be direct to the response stream, even though getOut() may never be called.
 void dispose()
          Disposes a run data object.
 AccessControlList getACL()
          Gets the access control list.
 java.lang.String getAction()
          Gets the action.
 java.lang.String getCharSet()
          Gets the charset.
 java.lang.String getContentType()
          Gets the HTTP content type to return.
 java.lang.String getContextPath()
          Gets the cached context path.
 CookieParser getCookieParser()
          Gets the cookie parser without parsing the cookies.
 CookieParser getCookies()
          Gets the cookies.
protected  java.lang.String getDefaultCharSet()
          Gets the default charset defined by a property named "locale.default.charset" or by the specified locale.
protected static java.util.Locale getDefaultLocale()
          Gets the default locale defined by properties named "locale.default.lang" and "locale.default.country".
 java.util.Hashtable getJNDIContexts()
          Gets JNDI Contexts.
 java.lang.String getLayout()
          If the Layout has not been defined by the screen then set the layout to be "DefaultLayout".
 java.lang.String getLayoutTemplate()
          Convenience method for a template info that returns the layout template being used.
 java.util.Locale getLocale()
          Gets the locale.
 java.lang.String getMessage()
          Gets the results of an action or another message to be displayed as a string.
 org.apache.ecs.StringElement getMessageAsHTML()
          Gets the results of an action or another message to be displayed as an ECS string element.
 FormMessages getMessages()
          Gets a FormMessages object where all the messages to the user should be stored.
 java.io.PrintWriter getOut()
          Gets the print writer.
 org.apache.ecs.Document getPage()
          Gets the page.
 ParameterParser getParameterParser()
          Gets the parameter parser without parsing the parameters.
 ParameterParser getParameters()
          Gets the parameters.
 java.lang.String getRedirectURI()
          Gets the redirect URI.
 java.lang.String getRemoteAddr()
          Gets the IP address of the client that sent the request.
 java.lang.String getRemoteHost()
          Gets the qualified name of the client that sent the request.
 javax.servlet.http.HttpServletRequest getRequest()
          Gets the servlet request.
 javax.servlet.http.HttpServletResponse getResponse()
          Gets the servlet response.
 java.lang.String getScreen()
          Gets the screen to execute.
 java.lang.String getScreenTemplate()
          Convenience method for a template info that returns the name of the template being used.
 java.lang.String getScriptName()
          Gets the cached script name.
 ServerData getServerData()
          Gets the server data ofy the request.
 java.lang.String getServerName()
          Gets the cached server name.
 int getServerPort()
          Gets the cached server port.
 java.lang.String getServerScheme()
          Gets the cached server scheme.
 javax.servlet.ServletConfig getServletConfig()
          Gets the servlet configuration used during servlet init.
 javax.servlet.ServletContext getServletContext()
          Gets the servlet context used during servlet init.
 javax.servlet.http.HttpSession getSession()
          Gets the servlet session information.
 java.lang.String getStackTrace()
          Gets the stack trace if set.
 java.lang.Throwable getStackTraceException()
          Gets the stack trace exception if set.
 int getStatusCode()
          Gets the HTTP status code to return.
 SystemError[] getSystemErrors()
          Gets an array of system errors.
 java.lang.String getTemplateEncoding()
          Gets the character encoding to use for reading template files.
 TemplateInfo getTemplateInfo()
          Gets the template info.
 java.lang.String getTitle()
          Gets the title of the page.
 User getUser()
          Gets the user.
 java.lang.String getUserAgent()
          Get the user agent for the request.
 User getUserFromSession()
          Attempts to get the user from the session.
static User getUserFromSession(javax.servlet.http.HttpSession session)
          Attempts to get the User object from the session.
 java.util.Hashtable getVarDebug()
          Gets a table of debug variables.
 boolean hasAction()
          Whether or not an action has been defined.
 boolean hasMessage()
          Whether or not a message has been defined.
 boolean hasScreen()
          Whether or not a screen has been defined.
 boolean isOutSet()
          Checks to see if out is set.
 boolean isPageSet()
          Checks to see if the page is set.
 void populate()
          Pulls a user object from the session and increments the access counter and sets the last access date for the object.
 void recycle()
          Recycles a run data object.
 boolean removeUserFromSession()
          Allows one to invalidate the user in the default session.
static boolean removeUserFromSession(javax.servlet.http.HttpSession session)
          Allows one to invalidate the user in a session.
 void save()
          Saves a user object into the session.
 void setACL(AccessControlList acl)
          Sets the access control list.
 void setAction(java.lang.String action)
          Sets the action for the request.
 void setCharSet(java.lang.String charset)
          Sets the charset.
 void setContentType(java.lang.String ct)
          Sets the HTTP content type to return.
protected  void setContextPath(java.lang.String cp)
          Sets the cached context path that is stored in the server data.
 void setCookieParser(CookieParser parser)
          Sets the cookie parser.
 void setJNDIContexts(java.util.Hashtable contexts)
          Sets JNDI Contexts.
 void setLayout(java.lang.String layout)
          Set the layout for the request.
 void setLayoutTemplate(java.lang.String layout)
          Modifies the layout template for the screen.
 void setLocale(java.util.Locale locale)
          Sets the locale.
 void setMessage(org.apache.ecs.Element msg)
          Sets the message for the request as an ECS element.
 void setMessage(java.lang.String msg)
          Sets the message for the request as a string.
 void setMessages(FormMessages msgs)
          Sets the FormMessages object for the request.
protected  void setOut(java.io.PrintWriter out)
          Sets the print writer.
 void setParameterParser(ParameterParser parser)
          Sets the parameter parser.
 void setRedirectURI(java.lang.String ruri)
          Sets the redirect uri.
 void setRequest(javax.servlet.http.HttpServletRequest req)
          Sets the servlet request.
 void setResponse(javax.servlet.http.HttpServletResponse res)
          Sets the servlet response.
 void setScreen(java.lang.String screen)
          Sets the screen for the request.
 void setScreenTemplate(java.lang.String screen)
          Sets the screen template for the request.
protected  void setScriptName(java.lang.String sn)
          Sets the cached script name that is stored in the server data.
 void setServerData(ServerData serverData)
          Sets the server data of the request.
protected  void setServerName(java.lang.String sn)
          Sets the cached server same that is stored in the server data.
protected  void setServerPort(int port)
          Sets the cached server port that is stored in the server data.
protected  void setServerScheme(java.lang.String ss)
          Sets the cached server scheme that is stored in the server data.
 void setServletConfig(javax.servlet.ServletConfig config)
          Setsthe servlet configuration used during servlet init.
 void setSession(javax.servlet.http.HttpSession sess)
          Sets the servlet session inforamtion.
 void setStackTrace(java.lang.String trace, java.lang.Throwable exp)
          Sets the stack trace.
 void setStatusCode(int sc)
          Sets the HTTP status code to return.
 void setSystemError(SystemError err)
          Adds a critical system error.
 void setTemplateEncoding(java.lang.String encoding)
          Sets the character encoding to use for reading template files.
 void setTitle(java.lang.String title)
          Sets the title of the page.
 void setUser(User user)
          Sets the user.
 void unsetMessage()
          Unsets the message for the request.
 boolean userExists()
          Checks if a user exists in this session.
 
Methods inherited from class org.apache.turbine.util.pool.RecyclableSupport
doDispose, isDisposed, Recyclable
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 
Methods inherited from interface org.apache.turbine.util.pool.Recyclable
isDisposed
 

Field Detail

defaultLocale

private static java.util.Locale defaultLocale
The default locale.

defaultLocaleChecked

private static boolean defaultLocaleChecked
The default locale checked flag.

defaultCharSet

private static java.lang.String defaultCharSet
The default charset.

defaultCharSetChecked

private static boolean defaultCharSetChecked
The default charset checked flag.

parameters

private ParameterParser parameters
A reference to the GET/POST data parser.

cookies

public CookieParser cookies
A reference to a cookie parser.

req

private javax.servlet.http.HttpServletRequest req
The servlet request interface.

res

private javax.servlet.http.HttpServletResponse res
The servlet response interface.

session

private javax.servlet.http.HttpSession session
The servlet session information.

config

private javax.servlet.ServletConfig config
The servlet configuration.

servletContext

private javax.servlet.ServletContext servletContext
The servlet context information. Note that this is from the "Turbine" Servlet context.

acl

private AccessControlList acl
The access control list.

pageSet

private boolean pageSet
Determines if there is information in the document or not.

page

private org.apache.ecs.Document page
This creates an ECS Document.

action

private java.lang.String action
Cached action name to execute for this request.

layout

private java.lang.String layout
This is the layout that the page will use to render the screen.

screen

private java.lang.String screen
Cached screen name to execute for this request.

templateEncoding

private java.lang.String templateEncoding
The character encoding of template files.

templateInfo

private TemplateInfo templateInfo
Information used by a Template system (such as Velocity/Freemarker).

message

private org.apache.ecs.StringElement message
This is where output messages from actions should go.

messages

private FormMessages messages
This is a dedicated message class where output messages from actions should go.

user

private User user
The user object.

title

private java.lang.String title
This is what will build the of the document.

outSet

private boolean outSet
Determines if there is information in the outputstream or not.

out

private java.io.PrintWriter out
Cache the output stream because it can be used in many different places.

locale

private java.util.Locale locale
The locale.

charSet

private java.lang.String charSet
The HTTP charset.

contentType

private java.lang.String contentType
The HTTP content type to return.

redirectURI

private java.lang.String redirectURI
If this is set, also set the status code to 302.

statusCode

private int statusCode
The HTTP status code to return.

errors

private java.util.Vector errors
This is a vector to hold critical system errors.

jndiContexts

private java.util.Hashtable jndiContexts
JNDI Contexts.

serverData

private ServerData serverData
Holds ServerData (basic properties) about this RunData object.

remoteAddr

private java.lang.String remoteAddr
See Also:
getRemoteAddr()

remoteHost

private java.lang.String remoteHost
See Also:
getRemoteHost()

userAgent

private java.lang.String userAgent
See Also:
getUserAgent()

stackTrace

private java.lang.String stackTrace
A holder for stack trace.

stackTraceException

private java.lang.Throwable stackTraceException
A holder ofr stack trace exception.

varDebug

private java.util.Hashtable varDebug
Put things here and they will be shown on the default Error screen. This is great for debugging variable values when an exception is thrown.
Constructor Detail

DefaultTurbineRunData

public DefaultTurbineRunData()
Constructs a run data object.
Method Detail

getUserFromSession

public static User getUserFromSession(javax.servlet.http.HttpSession session)
Attempts to get the User object from the session. If it does not exist, it returns null.
Parameters:
session - An HttpSession.
Returns:
A User.

removeUserFromSession

public static boolean removeUserFromSession(javax.servlet.http.HttpSession session)
Allows one to invalidate the user in a session.
Parameters:
session - An HttpSession.
Returns:
True if user was invalidated.

getDefaultLocale

protected static java.util.Locale getDefaultLocale()
Gets the default locale defined by properties named "locale.default.lang" and "locale.default.country".
Returns:
the default locale or null.

getDefaultCharSet

protected java.lang.String getDefaultCharSet()
Gets the default charset defined by a property named "locale.default.charset" or by the specified locale. If the specified locale is null, the default locale is applied.
Parameters:
locale - the locale of the charset.
Returns:
the name of the default charset or null.

recycle

public void recycle()
Recycles a run data object.
Specified by:
recycle in interface Recyclable
Overrides:
recycle in class RecyclableSupport

dispose

public void dispose()
Disposes a run data object.
Specified by:
dispose in interface Recyclable
Overrides:
dispose in class RecyclableSupport

getParameters

public ParameterParser getParameters()
Gets the parameters.
Specified by:
getParameters in interface RunData
Returns:
a parameter parser.

getCookies

public CookieParser getCookies()
Gets the cookies.
Specified by:
getCookies in interface RunData
Returns:
a cookie parser.

getRequest

public javax.servlet.http.HttpServletRequest getRequest()
Gets the servlet request.
Specified by:
getRequest in interface RunData
Returns:
the request.

getResponse

public javax.servlet.http.HttpServletResponse getResponse()
Gets the servlet response.
Specified by:
getResponse in interface RunData
Returns:
the resposne.

getSession

public javax.servlet.http.HttpSession getSession()
Gets the servlet session information.
Specified by:
getSession in interface RunData
Returns:
the session.

getServletConfig

public javax.servlet.ServletConfig getServletConfig()
Gets the servlet configuration used during servlet init.
Specified by:
getServletConfig in interface RunData
Returns:
the configuration.

getServletContext

public javax.servlet.ServletContext getServletContext()
Gets the servlet context used during servlet init.
Specified by:
getServletContext in interface RunData
Returns:
the context.

getACL

public AccessControlList getACL()
Gets the access control list.
Specified by:
getACL in interface RunData
Returns:
the access control list.

setACL

public void setACL(AccessControlList acl)
Sets the access control list.
Specified by:
setACL in interface RunData
Parameters:
acl - an access control list.

isPageSet

public boolean isPageSet()
Checks to see if the page is set.
Specified by:
isPageSet in interface RunData
Returns:
true if the page is set.

getPage

public org.apache.ecs.Document getPage()
Gets the page.
Specified by:
getPage in interface RunData
Returns:
a document.

hasAction

public boolean hasAction()
Whether or not an action has been defined.
Specified by:
hasAction in interface RunData
Returns:
true if an action has been defined.

getAction

public java.lang.String getAction()
Gets the action. It returns an empty string if null so that it is easy to do conditionals on it based on the equalsIgnoreCase() method.
Specified by:
getAction in interface RunData
Returns:
a string, "" if null.

setAction

public void setAction(java.lang.String action)
Sets the action for the request.
Specified by:
setAction in interface RunData
Parameters:
action - a atring.

getLayout

public java.lang.String getLayout()
If the Layout has not been defined by the screen then set the layout to be "DefaultLayout". The screen object can also override this method to provide intelligent determination of the Layout to execute. You can also define that logic here as well if you want it to apply on a global scale. For example, if you wanted to allow someone to define layout "preferences" where they could dynamicially change the layout for the entire site.
Specified by:
getLayout in interface RunData
Returns:
a string.

setLayout

public void setLayout(java.lang.String layout)
Set the layout for the request.
Specified by:
setLayout in interface RunData
Parameters:
layout - a string.

getLayoutTemplate

public java.lang.String getLayoutTemplate()
Convenience method for a template info that returns the layout template being used.
Specified by:
getLayoutTemplate in interface RunData
Returns:
a string.

setLayoutTemplate

public void setLayoutTemplate(java.lang.String layout)
Modifies the layout template for the screen. This convenience method allows for a layout to be modified from within a template. For example; $data.setLayoutTemplate("/NewLayout.vm")
Specified by:
setLayoutTemplate in interface RunData
Parameters:
layout - a layout template.

hasScreen

public boolean hasScreen()
Whether or not a screen has been defined.
Specified by:
hasScreen in interface RunData
Returns:
true if a screen has been defined.

getScreen

public java.lang.String getScreen()
Gets the screen to execute.
Specified by:
getScreen in interface RunData
Returns:
a string.

setScreen

public void setScreen(java.lang.String screen)
Sets the screen for the request.
Specified by:
setScreen in interface RunData
Parameters:
screen - a string.

getScreenTemplate

public java.lang.String getScreenTemplate()
Convenience method for a template info that returns the name of the template being used.
Specified by:
getScreenTemplate in interface RunData
Returns:
a string.

setScreenTemplate

public void setScreenTemplate(java.lang.String screen)
Sets the screen template for the request. For example; $data.setScreenTemplate("NewScreen.vm")
Specified by:
setScreenTemplate in interface RunData
Parameters:
screen - a screen template.

getTemplateEncoding

public java.lang.String getTemplateEncoding()
Gets the character encoding to use for reading template files.
Specified by:
getTemplateEncoding in interface RunData
Returns:
the template encoding or null if not specified.

setTemplateEncoding

public void setTemplateEncoding(java.lang.String encoding)
Sets the character encoding to use for reading template files.
Specified by:
setTemplateEncoding in interface RunData
Parameters:
encoding - the template encoding.

getTemplateInfo

public TemplateInfo getTemplateInfo()
Gets the template info. Creates a new one if needed.
Specified by:
getTemplateInfo in interface RunData
Returns:
a template info.

hasMessage

public boolean hasMessage()
Whether or not a message has been defined.
Specified by:
hasMessage in interface RunData
Returns:
true if a message has been defined.

getMessage

public java.lang.String getMessage()
Gets the results of an action or another message to be displayed as a string.
Specified by:
getMessage in interface RunData
Returns:
a string.

setMessage

public void setMessage(java.lang.String msg)
Sets the message for the request as a string.
Specified by:
setMessage in interface RunData
Parameters:
msg - a string.

addMessage

public void addMessage(java.lang.String msg)
Adds the string to message. If message has prior messages from other actions or screens, this method can be used to chain them.
Specified by:
addMessage in interface RunData
Parameters:
msg - a string.

getMessageAsHTML

public org.apache.ecs.StringElement getMessageAsHTML()
Gets the results of an action or another message to be displayed as an ECS string element.
Specified by:
getMessageAsHTML in interface RunData
Returns:
a string element.

setMessage

public void setMessage(org.apache.ecs.Element msg)
Sets the message for the request as an ECS element.
Specified by:
setMessage in interface RunData
Parameters:
msg - an element.

addMessage

public void addMessage(org.apache.ecs.Element msg)
Adds the ECS element to message. If message has prior messages from other actions or screens, this method can be used to chain them.
Specified by:
addMessage in interface RunData
Parameters:
msg - an element.

unsetMessage

public void unsetMessage()
Unsets the message for the request.
Specified by:
unsetMessage in interface RunData

getMessages

public FormMessages getMessages()
Gets a FormMessages object where all the messages to the user should be stored.
Specified by:
getMessages in interface RunData
Returns:
a FormMessages.

setMessages

public void setMessages(FormMessages msgs)
Sets the FormMessages object for the request.
Specified by:
setMessages in interface RunData
Parameters:
msgs - A FormMessages.

getTitle

public java.lang.String getTitle()
Gets the title of the page.
Specified by:
getTitle in interface RunData
Returns:
a string.

setTitle

public void setTitle(java.lang.String title)
Sets the title of the page.
Specified by:
setTitle in interface RunData
Parameters:
title - a string.

userExists

public boolean userExists()
Checks if a user exists in this session.
Specified by:
userExists in interface RunData
Returns:
true if a user exists in this session.

getUser

public User getUser()
Gets the user.
Specified by:
getUser in interface RunData
Returns:
a user.

setUser

public void setUser(User user)
Sets the user.
Specified by:
setUser in interface RunData
Parameters:
user - a user.

getUserFromSession

public User getUserFromSession()
Attempts to get the user from the session. If it does not exist, it returns null.
Specified by:
getUserFromSession in interface RunData
Returns:
a user.

removeUserFromSession

public boolean removeUserFromSession()
Allows one to invalidate the user in the default session.
Specified by:
removeUserFromSession in interface RunData
Returns:
true if user was invalidated.

isOutSet

public boolean isOutSet()
Checks to see if out is set.
Specified by:
isOutSet in interface RunData
Returns:
true if out is set.

getOut

public java.io.PrintWriter getOut()
                           throws java.io.IOException
Gets the print writer. First time calling this will set the print writer via the response.
Specified by:
getOut in interface RunData
Returns:
a print writer.
Throws:
IOException. -  

declareDirectResponse

public void declareDirectResponse()
Declares that output will be direct to the response stream, even though getOut() may never be called. Useful for response mechanisms that may call res.getWriter() themselves (such as JSP.)
Specified by:
declareDirectResponse in interface RunData

getLocale

public java.util.Locale getLocale()
Gets the locale. If it has not already been defined with setLocale(), then properties named "locale.default.lang" and "locale.default.country" are checked from the Resource Service and the corresponding locale is returned. If these properties are undefined, JVM's default locale is returned.
Specified by:
getLocale in interface RunData
Returns:
the locale.

setLocale

public void setLocale(java.util.Locale locale)
Sets the locale.
Specified by:
setLocale in interface RunData
Parameters:
locale - the new locale.

getCharSet

public java.lang.String getCharSet()
Gets the charset. If it has not already been defined with setCharSet(), then a property named "locale.default.charset" is checked from the Resource Service and returned. If this property is undefined, the default charset of the locale is returned. If the locale is undefined, null is returned.
Specified by:
getCharSet in interface RunData
Returns:
the name of the charset or null.

setCharSet

public void setCharSet(java.lang.String charset)
Sets the charset.
Specified by:
setCharSet in interface RunData
Parameters:
charset - the name of the new charset.

getContentType

public java.lang.String getContentType()
Gets the HTTP content type to return. If a charset has been specified, it is included in the content type. If the charset has not been specified and the main type of the content type is "text", the default charset is included. If the default charset is undefined, but the default locale is defined and it is not the US locale, a locale specific charset is included.
Specified by:
getContentType in interface RunData
Returns:
the content type or an empty string.

setContentType

public void setContentType(java.lang.String ct)
Sets the HTTP content type to return.
Specified by:
setContentType in interface RunData
Parameters:
ct - a string.

getRedirectURI

public java.lang.String getRedirectURI()
Gets the redirect URI. If this is set, also make sure to set the status code to 302.
Specified by:
getRedirectURI in interface RunData
Returns:
a string, "" if null.

setRedirectURI

public void setRedirectURI(java.lang.String ruri)
Sets the redirect uri. If this is set, also make sure to set the status code to 302.
Specified by:
setRedirectURI in interface RunData
Parameters:
ruri - a string.

getStatusCode

public int getStatusCode()
Gets the HTTP status code to return.
Specified by:
getStatusCode in interface RunData
Returns:
the status.

setStatusCode

public void setStatusCode(int sc)
Sets the HTTP status code to return.
Specified by:
setStatusCode in interface RunData
Parameters:
sc - the status.

getSystemErrors

public SystemError[] getSystemErrors()
Gets an array of system errors.
Specified by:
getSystemErrors in interface RunData
Returns:
a SystemError[].

setSystemError

public void setSystemError(SystemError err)
Adds a critical system error.
Specified by:
setSystemError in interface RunData
Parameters:
err - a system error.

getJNDIContexts

public java.util.Hashtable getJNDIContexts()
Gets JNDI Contexts.
Specified by:
getJNDIContexts in interface RunData
Returns:
a hashtable.

setJNDIContexts

public void setJNDIContexts(java.util.Hashtable contexts)
Sets JNDI Contexts.
Specified by:
setJNDIContexts in interface RunData
Parameters:
contexts - a hashtable.

getServerScheme

public java.lang.String getServerScheme()
Gets the cached server scheme.
Specified by:
getServerScheme in interface RunData
Returns:
a string.

getServerName

public java.lang.String getServerName()
Gets the cached server name.
Specified by:
getServerName in interface RunData
Returns:
a string.

getServerPort

public int getServerPort()
Gets the cached server port.
Specified by:
getServerPort in interface RunData
Returns:
an int.

getContextPath

public java.lang.String getContextPath()
Gets the cached context path.
Specified by:
getContextPath in interface RunData
Returns:
a string.

getScriptName

public java.lang.String getScriptName()
Gets the cached script name.
Specified by:
getScriptName in interface RunData
Returns:
a string.

getServerData

public ServerData getServerData()
Gets the server data ofy the request.
Specified by:
getServerData in interface RunData
Returns:
server data.

getRemoteAddr

public java.lang.String getRemoteAddr()
Gets the IP address of the client that sent the request.
Specified by:
getRemoteAddr in interface RunData
Returns:
a string.

getRemoteHost

public java.lang.String getRemoteHost()
Gets the qualified name of the client that sent the request.
Specified by:
getRemoteHost in interface RunData
Returns:
a string.

getUserAgent

public java.lang.String getUserAgent()
Get the user agent for the request.
Specified by:
getUserAgent in interface RunData
Returns:
a string.

populate

public void populate()
Pulls a user object from the session and increments the access counter and sets the last access date for the object.
Specified by:
populate in interface RunData

save

public void save()
Saves a user object into the session.
Specified by:
save in interface RunData

getStackTrace

public java.lang.String getStackTrace()
Gets the stack trace if set.
Specified by:
getStackTrace in interface RunData
Returns:
the stack trace.

getStackTraceException

public java.lang.Throwable getStackTraceException()
Gets the stack trace exception if set.
Specified by:
getStackTraceException in interface RunData
Returns:
the stack exception.

setStackTrace

public void setStackTrace(java.lang.String trace,
                          java.lang.Throwable exp)
Sets the stack trace.
Specified by:
setStackTrace in interface RunData
Parameters:
trace - the stack trace.
exp - the exception.

getVarDebug

public java.util.Hashtable getVarDebug()
Gets a table of debug variables.
Specified by:
getVarDebug in interface RunData
Returns:
a hashtable for debug variables.

getParameterParser

public ParameterParser getParameterParser()
Gets the parameter parser without parsing the parameters.
Specified by:
getParameterParser in interface TurbineRunData
Returns:
the parameter parser.

setParameterParser

public void setParameterParser(ParameterParser parser)
Sets the parameter parser.
Specified by:
setParameterParser in interface TurbineRunData
Parameters:
parser - a parameter parser.

getCookieParser

public CookieParser getCookieParser()
Gets the cookie parser without parsing the cookies.
Specified by:
getCookieParser in interface TurbineRunData
Returns:
the cookie parser.

setCookieParser

public void setCookieParser(CookieParser parser)
Sets the cookie parser.
Specified by:
setCookieParser in interface TurbineRunData
Parameters:
parser - a cookie parser.

setRequest

public void setRequest(javax.servlet.http.HttpServletRequest req)
Sets the servlet request.
Specified by:
setRequest in interface TurbineRunData
Parameters:
req - a request.

setResponse

public void setResponse(javax.servlet.http.HttpServletResponse res)
Sets the servlet response.
Specified by:
setResponse in interface TurbineRunData
Parameters:
res - a response.

setSession

public void setSession(javax.servlet.http.HttpSession sess)
Sets the servlet session inforamtion.
Specified by:
setSession in interface TurbineRunData
Parameters:
sess - a session.

setServletConfig

public void setServletConfig(javax.servlet.ServletConfig config)
Setsthe servlet configuration used during servlet init.
Specified by:
setServletConfig in interface TurbineRunData
Parameters:
config - a configuration.

setServerData

public void setServerData(ServerData serverData)
Sets the server data of the request.
Specified by:
setServerData in interface TurbineRunData
Parameters:
serverData - server data.

setOut

protected void setOut(java.io.PrintWriter out)
Sets the print writer.
Parameters:
out - a print writer.

setServerScheme

protected void setServerScheme(java.lang.String ss)
Sets the cached server scheme that is stored in the server data.
Parameters:
ss - a string.

setServerName

protected void setServerName(java.lang.String sn)
Sets the cached server same that is stored in the server data.
Parameters:
sn - a string.

setServerPort

protected void setServerPort(int port)
Sets the cached server port that is stored in the server data.
Parameters:
port - an int.

setContextPath

protected void setContextPath(java.lang.String cp)
Sets the cached context path that is stored in the server data.
Parameters:
cp - a string.

setScriptName

protected void setScriptName(java.lang.String sn)
Sets the cached script name that is stored in the server data.
Parameters:
sn - a string.


Copyright © 1999-2001 Apache Software Foundation. All Rights Reserved.