Class HttpEngineEnvironment

  • All Implemented Interfaces:
    EngineEnvironmentI

    public class HttpEngineEnvironment
    extends ServletEngineEnvironment
    Provides access to request data and cookie handling in a servlet container environment. Instances of this class are passed directly to solution scripts.
    Version:
    7.4.0-SP1
    • Field Detail

      • ATTRIBUTE_SESSION_TIMEOUT

        public static final String ATTRIBUTE_SESSION_TIMEOUT
        Name of the servlet request attribute to store the session timeout value.
        See Also:
        Constant Field Values
    • Constructor Detail

      • HttpEngineEnvironment

        public HttpEngineEnvironment​(HttpServletRequest _request,
                                     Map<String,​Object> _mRequestParameters,
                                     HttpServletResponse _response)
        Creates a new instance of HttpEngineEnvironment.
        Parameters:
        _request - the servlet's request parameter
        _mRequestParameters - free typed request parameters
        _response - the servlet's response parameter
    • Method Detail

      • isInstanceOf

        public boolean isInstanceOf​(String _sTypeName)
        Checks whether this class or an ancestor is an instance of the given type name.
        Specified by:
        isInstanceOf in interface EngineEnvironmentI
        Overrides:
        isInstanceOf in class ServletEngineEnvironment
        Returns:
        true if and only if the given type name equals "HttpEngineEnvironment" or one of the type names of the ancestor classes.
        Since:
        1.0
      • getCookieValue

        public String getCookieValue​(String _sName,
                                     String _sDefault)
        Returns the value of the cookie (sent along with the request) with the given name. If no such cookie exists then the given default value is returned.

        This is a convenience method for accessing a cookie's value. In order to access all cookie data, an array containing all Cookie objects can be obtained by calling getCookies().

        Parameters:
        _sName - name of the requested cookie
        _sDefault - default return value (default = null)
        Returns:
        the value of the cookie with the given name if such cookie exists, otherwise the given default value
        Since:
        1.0
        See Also:
        HttpServletRequest.getCookies(), Cookie
      • getCookies

        public Cookie[] getCookies()
        Returns an array containing all the Cookie objects the client sent with the request. If no cookies where sent the returned array is empty.
        Returns:
        an array of all the Cookies included with the request
        Since:
        1.0
      • createCookie

        public Cookie createCookie​(String _sName,
                                   String _sValue)
        Constructs a Cookie object for a specified name and value, to be used later as the parameter to method setCookie(Cookie).

        Note: This method only creates a Cookie object but does not set the cookie in the engine environment.

        This is a factory method wrapped around the Cookie(java.lang.String, java.lang.String) constructor.

        Parameters:
        _sName - the cookie's name. See Cookie(java.lang.String, java.lang.String) on restrictions of the characters allowed for cookie names.
        _sValue - the cookie's value See Cookie.setValue(java.lang.String) on on restrictions of the characters allowed for cookie values.
        Returns:
        a newly allocated Cookie object with the given name and value
        Since:
        1.1
        See Also:
        Cookie(java.lang.String, java.lang.String)
      • setCookie

        public void setCookie​(String _sName,
                              String _sValue,
                              int _iMaxAge)
        Sets a cookie with the given name, value, and maximum age. If a cookie with the given name already existed it is overwritten. The cookie data will be sent along the servlet reply to the client.

        This is a convenience method for setting a cookie's value. In order to set other attributes of a cookie it should be set by calling setCookie(Cookie).

        Parameters:
        _sName - the cookie's name. See Cookie(java.lang.String, java.lang.String) on restrictions of the characters allowed for cookie names.
        _sValue - the cookie's value See Cookie.setValue(java.lang.String) on on restrictions of the characters allowed for cookie values.
        _iMaxAge - the cookie's maximum age in seconds. See Cookie.setMaxAge(int) on a desciption of this value.
        Since:
        1.0
      • setCookie

        public void setCookie​(Cookie _cookie)
        Sets a cookie to the given cookie data. If a cookie with the given name already existed it is overwritten. The cookie data will be sent along the servlet reply to the client.
        Since:
        1.0
      • deleteCookie

        public void deleteCookie​(String _sName)
        Deletes the cookie with the given name. The cookie data will be sent along the servlet reply to the client.
        Since:
        1.0
      • getAuthType

        public String getAuthType()
        Calls HttpServletRequest.getAuthType() on the request object.
        Since:
        1.0
      • getContextPath

        public String getContextPath()
        Calls HttpServletRequest.getContextPath() on the request object.
        Since:
        1.0
      • getHeader

        public String getHeader​(String _sHeaderName)
        Calls HttpServletRequest.getHeader(java.lang.String) on the request object.
        Since:
        1.0
      • getHeaderNames

        public Enumeration<String> getHeaderNames()
        Calls HttpServletRequest.getHeaderNames() on the request object.
        Since:
        1.0
      • getHeaders

        public Enumeration<String> getHeaders​(String _sHeaderName)
        Calls HttpServletRequest.getHeaders(java.lang.String) on the request object.
        Since:
        1.0
      • getMethod

        public String getMethod()
        Calls HttpServletRequest.getMethod() on the request object.
        Since:
        1.0
      • getPathInfo

        public String getPathInfo()
        Calls HttpServletRequest.getPathInfo() on the request object.
        Since:
        1.0
      • getPathTranslated

        public String getPathTranslated()
        Calls HttpServletRequest.getPathTranslated() on the request object.
        Since:
        1.0
      • getQueryString

        public String getQueryString()
        Calls HttpServletRequest.getQueryString() on the request object.
        Since:
        1.0
      • getRemoteUser

        public String getRemoteUser()
        Calls HttpServletRequest.getRemoteUser() on the request object.
        Since:
        1.0
      • getRequestedSessionId

        public String getRequestedSessionId()
        Calls HttpServletRequest.getRequestedSessionId() on the request object.
        Since:
        1.0
      • getRequestURI

        public String getRequestURI()
        Calls HttpServletRequest.getRequestURI() on the request object.
        Since:
        1.0
      • getRequestURL

        public StringBuffer getRequestURL()
        Calls HttpServletRequest.getRequestURL() on the request object.
        Since:
        1.0
      • getServletPath

        public String getServletPath()
        Calls HttpServletRequest.getServletPath() on the request object.
        Since:
        1.0
      • isRequestedSessionIdFromCookie

        public boolean isRequestedSessionIdFromCookie()
        Calls HttpServletRequest.isRequestedSessionIdFromCookie() on the request object.
        Since:
        1.0
      • isRequestedSessionIdFromURL

        public boolean isRequestedSessionIdFromURL()
        Calls HttpServletRequest.isRequestedSessionIdFromURL() on the request object.
        Since:
        1.0
      • isRequestedSessionIdValid

        public boolean isRequestedSessionIdValid()
        Calls HttpServletRequest.isRequestedSessionIdValid() on the request object.
        Since:
        1.0
      • isUserInRole

        public boolean isUserInRole​(String _sRole)
        Calls HttpServletRequest.isUserInRole(java.lang.String) on the request object.
        Since:
        1.0
      • getSessionTimeout

        public int getSessionTimeout()
        Returns how long the current session must be idle before it is terminated.
        Returns:
        the session timeout, in seconds
        Since:
        1.1
      • setSessionTimeout

        public void setSessionTimeout​(int _iTimeout)
        Sets how long the current session must be idle before it is terminated. Setting the timeout to 0 terminates the session after the current input request handling is completed.
        Parameters:
        _iTimeout - new session timeout, in seconds. May not be negative.
        Since:
        1.1