org.apache.turbine.util

## Interface RunData

- All Superinterfaces:
    PipelineData
  All Known Subinterfaces:
    TurbineRunData
  All Known Implementing Classes:
    DefaultTurbineRunData

      public interface RunData
      extends PipelineData

  RunData is an interface to run-time 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 instance for each request that is being serviced.
  Version:
    $Id: RunData.java 1695634 2015-08-13 00:35:47Z tv $
  Author:
    Ilkka Priha, Jon S. Stevens, Bernie Hoeneisen, Daniel Rall, Quinton McCombs

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addMessage(org.apache.ecs.Element msg)` Adds the ECS element to message.
    `void` | `addMessage(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.
    `<A extends org.apache.fulcrum.security.acl.AccessControlList> A` | `getACL()` Gets the access control list.
    `String` | `getAction()` Gets the action.
    `String` | `getCharSet()` Gets the charset.
    `String` | `getContentType()` Gets the HTTP content type to return.
    `String` | `getContextPath()` Gets the cached context path.
    `org.apache.fulcrum.parser.CookieParser` | `getCookies()` Gets the cookies.
    `Map<String,Object>` | `getDebugVariables()` Gets a Map of debug variables.
    `Map<String,Context>` | `getJNDIContexts()` Gets JNDI Contexts.
    `String` | `getLayout()` If the Layout has not been defined by the screen then set the layout to be "DefaultLayout".
    `String` | `getLayoutTemplate()` Convenience method for a template info that returns the layout template being used.
    `Locale` | `getLocale()` Gets the locale.
    `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.
    `PrintWriter` | `getOut()` Gets the print writer.
    `org.apache.ecs.Document` | `getPage()` Deprecated. no replacement planned, ECS is no longer a requirement
    `org.apache.fulcrum.parser.ParameterParser` | `getParameters()` Gets the parameters.
    `String` | `getRedirectURI()` Gets the redirect URI.
    `String` | `getRemoteAddr()` Gets the IP address of the client that sent the request.
    `String` | `getRemoteHost()` Gets the qualified name of the client that sent the request.
    `HttpServletRequest` | `getRequest()` Gets the servlet request.
    `HttpServletResponse` | `getResponse()` Gets the servlet response.
    `String` | `getScreen()` Gets the screen to execute.
    `String` | `getScreenTemplate()` Convenience method for a template info that returns the name of the template being used.
    `String` | `getScriptName()` Gets the cached script name.
    `ServerData` | `getServerData()` Gets the server data used by the request.
    `String` | `getServerName()` Gets the cached server name.
    `int` | `getServerPort()` Gets the cached server port.
    `String` | `getServerScheme()` Gets the cached server scheme.
    `ServletConfig` | `getServletConfig()` Gets the servlet configuration used during servlet init.
    `ServletContext` | `getServletContext()` Gets the servlet context used during servlet init.
    `HttpSession` | `getSession()` Gets the servlet session information.
    `String` | `getStackTrace()` Gets the stack trace if set.
    `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.
    `String` | `getTemplateEncoding()` Gets the character encoding to use for reading template files.
    `TemplateInfo` | `getTemplateInfo()` Gets the template info.
    `String` | `getTitle()` Gets the title of the page.
    `<T extends User> T` | `getUser()` Gets the user.
    `String` | `getUserAgent()` Get the user agent for the request.
    `<T extends User> T` | `getUserFromSession()` Attempts to get the user from the session.
    `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()` Deprecated. no replacement planned, response writer will not be cached
    `boolean` | `isPageSet()` Deprecated. no replacement planned, ECS is no longer a requirement
    `void` | `populate()` Pulls a user object from the session and increments the access counter and sets the last access date for the object.
    `boolean` | `removeUserFromSession()` Allows one to invalidate the user in the default session.
    `void` | `save()` Saves a user object into the session.
    `void` | `setACL(org.apache.fulcrum.security.acl.AccessControlList acl)` Sets the access control list.
    `void` | `setAction(String action)` Sets the action for the request.
    `void` | `setCharSet(String charset)` Sets the charset.
    `void` | `setContentType(String ct)` Sets the HTTP content type to return.
    `void` | `setDebugVariable(String name, Object value)` Sets a name/value pair in an internal Map that is accessible from the Error screen.
    `void` | `setJNDIContexts(Map<String,Context> contexts)` Sets JNDI Contexts.
    `void` | `setLayout(String layout)` Set the layout for the request.
    `void` | `setLayoutTemplate(String layout)` Modifies the layout template for the screen.
    `void` | `setLocale(Locale locale)` Sets the locale.
    `void` | `setMessage(org.apache.ecs.Element msg)` Sets the message for the request as an ECS element.
    `void` | `setMessage(String msg)` Sets the message for the request as a string.
    `void` | `setMessages(FormMessages msgs)` Sets the FormMessages object for the request.
    `void` | `setRedirectURI(String ruri)` Sets the redirect uri.
    `void` | `setScreen(String screen)` Sets the screen for the request.
    `void` | `setScreenTemplate(String screen)` Sets the screen template for the request.
    `void` | `setStackTrace(String trace, 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(String encoding)` Sets the character encoding to use for reading template files.
    `void` | `setTitle(String title)` Sets the title of the page.
    `<T extends User> void` | `setUser(T 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 interface org.apache.turbine.pipeline.PipelineData

      `get, get, put`

- - ### Method Detail

    - #### getParameters

          org.apache.fulcrum.parser.ParameterParser getParameters()

      Gets the parameters.
      Returns:
        a parameter parser.

    - #### getCookies

          org.apache.fulcrum.parser.CookieParser getCookies()

      Gets the cookies.
      Returns:
        a cookie parser.

    - #### getRequest

          HttpServletRequest getRequest()

      Gets the servlet request.
      Returns:
        the request.

    - #### getResponse

          HttpServletResponse getResponse()

      Gets the servlet response.
      Returns:
        the resposne.

    - #### getSession

          HttpSession getSession()

      Gets the servlet session information.
      Returns:
        the session.

    - #### getServletConfig

          ServletConfig getServletConfig()

      Gets the servlet configuration used during servlet init.
      Returns:
        the configuration.

    - #### getServletContext

          ServletContext getServletContext()

      Gets the servlet context used during servlet init.
      Returns:
        the context.

    - #### getACL

          <A extends org.apache.fulcrum.security.acl.AccessControlList> A getACL()

      Gets the access control list.
      Returns:
        the access control list.

    - #### setACL

          void setACL(org.apache.fulcrum.security.acl.AccessControlList acl)

      Sets the access control list.
      Parameters:
        `acl` - an access control list.

    - #### isPageSet

          @Deprecated
          boolean isPageSet()

      Deprecated. no replacement planned, ECS is no longer a requirement
      Checks to see if the page is set.
      Returns:
        true if the page is set.

    - #### getPage

          @Deprecated
          org.apache.ecs.Document getPage()

      Deprecated. no replacement planned, ECS is no longer a requirement
      Gets the page.
      Returns:
        a document.

    - #### hasAction

          boolean hasAction()

      Whether or not an action has been defined.
      Returns:
        true if an action has been defined.

    - #### getAction

          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.
      Returns:
        a string, "" if null.

    - #### setAction

          void setAction(String action)

      Sets the action for the request.
      Parameters:
        `action` - a string.

    - #### getLayout

          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 dynamically change the layout for the entire site.
      Returns:
        a string.

    - #### setLayout

          void setLayout(String layout)

      Set the layout for the request.
      Parameters:
        `layout` - a string.

    - #### getLayoutTemplate

          String getLayoutTemplate()

      Convenience method for a template info that returns the layout template being used.
      Returns:
        a string.

    - #### setLayoutTemplate

          void setLayoutTemplate(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")
      Parameters:
        `layout` - a layout template.

    - #### hasScreen

          boolean hasScreen()

      Whether or not a screen has been defined.
      Returns:
        true if a screen has been defined.

    - #### getScreen

          String getScreen()

      Gets the screen to execute.
      Returns:
        a string.

    - #### setScreen

          void setScreen(String screen)

      Sets the screen for the request.
      Parameters:
        `screen` - a string.

    - #### getScreenTemplate

          String getScreenTemplate()

      Convenience method for a template info that returns the name of the template being used.
      Returns:
        a string.

    - #### setScreenTemplate

          void setScreenTemplate(String screen)

      Sets the screen template for the request. For example; $data.setScreenTemplate("NewScreen.vm")
      Parameters:
        `screen` - a screen template.

    - #### getTemplateEncoding

          String getTemplateEncoding()

      Gets the character encoding to use for reading template files.
      Returns:
        the template encoding or null if not specified.

    - #### setTemplateEncoding

          void setTemplateEncoding(String encoding)

      Sets the character encoding to use for reading template files.
      Parameters:
        `encoding` - the template encoding.

    - #### getTemplateInfo

          TemplateInfo getTemplateInfo()

      Gets the template info. Creates a new one if needed.
      Returns:
        a template info.

    - #### hasMessage

          boolean hasMessage()

      Whether or not a message has been defined.
      Returns:
        true if a message has been defined.

    - #### getMessage

          String getMessage()

      Gets the results of an action or another message to be displayed as a string.
      Returns:
        a string.

    - #### setMessage

          void setMessage(String msg)

      Sets the message for the request as a string.
      Parameters:
        `msg` - a string.

    - #### addMessage

          void addMessage(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.
      Parameters:
        `msg` - a string.

    - #### getMessageAsHTML

          org.apache.ecs.StringElement getMessageAsHTML()

      Gets the results of an action or another message to be displayed as an ECS string element.
      Returns:
        a string element.

    - #### setMessage

          void setMessage(org.apache.ecs.Element msg)

      Sets the message for the request as an ECS element.
      Parameters:
        `msg` - an element.

    - #### addMessage

          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.
      Parameters:
        `msg` - an element.

    - #### unsetMessage

          void unsetMessage()

      Unsets the message for the request.

    - #### getMessages

          FormMessages getMessages()

      Gets a FormMessages object where all the messages to the user should be stored.
      Returns:
        a FormMessages.

    - #### setMessages

          void setMessages(FormMessages msgs)

      Sets the FormMessages object for the request.
      Parameters:
        `msgs` - A FormMessages.

    - #### getTitle

          String getTitle()

      Gets the title of the page.
      Returns:
        a string.

    - #### setTitle

          void setTitle(String title)

      Sets the title of the page.
      Parameters:
        `title` - a string.

    - #### userExists

          boolean userExists()

      Checks if a user exists in this session.
      Returns:
        true if a user exists in this session.

    - #### getUser

          <T extends User> T getUser()

      Gets the user.
      Returns:
        a user.

    - #### setUser

          <T extends User> void setUser(T user)

      Sets the user.
      Parameters:
        `user` - a user.

    - #### getUserFromSession

          <T extends User> T getUserFromSession()

      Attempts to get the user from the session. If it does not exist, it returns null.
      Returns:
        a user.

    - #### removeUserFromSession

          boolean removeUserFromSession()

      Allows one to invalidate the user in the default session.
      Returns:
        true if user was invalidated.

    - #### isOutSet

          @Deprecated
          boolean isOutSet()

      Deprecated. no replacement planned, response writer will not be cached
      Checks to see if out is set.
      Returns:
        true if out is set.

    - #### getOut

          PrintWriter getOut()
                             throws IOException

      Gets the print writer. First time calling this will set the print writer via the response.
      Returns:
        a print writer.
      Throws:
        `IOException`

    - #### declareDirectResponse

          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.)

    - #### getLocale

          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.
      Returns:
        the locale.

    - #### setLocale

          void setLocale(Locale locale)

      Sets the locale.
      Parameters:
        `locale` - the new locale.

    - #### getCharSet

          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.
      Returns:
        the name of the charset or null.

    - #### setCharSet

          void setCharSet(String charset)

      Sets the charset.
      Parameters:
        `charset` - the name of the new charset.

    - #### getContentType

          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.
      Returns:
        the content type or an empty string.

    - #### setContentType

          void setContentType(String ct)

      Sets the HTTP content type to return.
      Parameters:
        `ct` - the new content type.

    - #### getRedirectURI

          String getRedirectURI()

      Gets the redirect URI. If this is set, also make sure to set the status code to 302.
      Returns:
        a string, "" if null.

    - #### setRedirectURI

          void setRedirectURI(String ruri)

      Sets the redirect uri. If this is set, also make sure to set the status code to 302.
      Parameters:
        `ruri` - a string.

    - #### getStatusCode

          int getStatusCode()

      Gets the HTTP status code to return.
      Returns:
        the status.

    - #### setStatusCode

          void setStatusCode(int sc)

      Sets the HTTP status code to return.
      Parameters:
        `sc` - the status.

    - #### getSystemErrors

          SystemError[] getSystemErrors()

      Gets an array of system errors.
      Returns:
        a SystemError[].

    - #### setSystemError

          void setSystemError(SystemError err)

      Adds a critical system error.
      Parameters:
        `err` - a system error.

    - #### getJNDIContexts

          Map<String,Context> getJNDIContexts()

      Gets JNDI Contexts.
      Returns:
        a hashtable.

    - #### setJNDIContexts

          void setJNDIContexts(Map<String,Context> contexts)

      Sets JNDI Contexts.
      Parameters:
        `contexts` - a hashtable.

    - #### getServerScheme

          String getServerScheme()

      Gets the cached server scheme.
      Returns:
        a string.

    - #### getServerName

          String getServerName()

      Gets the cached server name.
      Returns:
        a string.

    - #### getServerPort

          int getServerPort()

      Gets the cached server port.
      Returns:
        an int.

    - #### getContextPath

          String getContextPath()

      Gets the cached context path.
      Returns:
        a string.

    - #### getScriptName

          String getScriptName()

      Gets the cached script name.
      Returns:
        a string.

    - #### getServerData

          ServerData getServerData()

      Gets the server data used by the request.
      Returns:
        server data.

    - #### getRemoteAddr

          String getRemoteAddr()

      Gets the IP address of the client that sent the request.
      Returns:
        a string.

    - #### getRemoteHost

          String getRemoteHost()

      Gets the qualified name of the client that sent the request.
      Returns:
        a string.

    - #### getUserAgent

          String getUserAgent()

      Get the user agent for the request.
      Returns:
        a string.

    - #### populate

          void populate()

      Pulls a user object from the session and increments the access counter and sets the last access date for the object.

    - #### save

          void save()

      Saves a user object into the session.

    - #### getStackTrace

          String getStackTrace()

      Gets the stack trace if set.
      Returns:
        the stack trace.

    - #### getStackTraceException

          Throwable getStackTraceException()

      Gets the stack trace exception if set.
      Returns:
        the stack exception.

    - #### setStackTrace

          void setStackTrace(String trace,
                           Throwable exp)

      Sets the stack trace.
      Parameters:
        `trace` - the stack trace.
        `exp` - the exception.

    - #### setDebugVariable

          void setDebugVariable(String name,
                              Object value)

      Sets a name/value pair in an internal Map that is accessible from the Error screen. This is a good way to get debugging information when an exception is thrown.
      Parameters:
        `name` - name of the variable
        `value` - value of the variable.

    - #### getDebugVariables

          Map<String,Object> getDebugVariables()

      Gets a Map of debug variables.
      Returns:
        a Map of debug variables.

Copyright © 2000-2015 The Apache Software Foundation. All Rights Reserved.