Package com.artisol.teneo.engine.webapp
Class HttpEngineEnvironment
- Object
-
- AbstractEngineEnvironment
-
- ServletEngineEnvironment
-
- 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.6.0-SP1
-
-
Field Summary
Fields Modifier and Type Field Description static String
ATTRIBUTE_SESSION_TIMEOUT
Name of the servlet request attribute to store the session timeout value.
-
Constructor Summary
Constructors Constructor Description HttpEngineEnvironment(HttpServletRequest _request, Map<String,Object> _mRequestParameters, HttpServletResponse _response)
Creates a new instance ofHttpEngineEnvironment
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Cookie
createCookie(String _sName, String _sValue)
Constructs aCookie
object for a specified name and value, to be used later as the parameter to methodsetCookie(Cookie)
.void
deleteCookie(String _sName)
Deletes the cookie with the given name.String
getAuthType()
CallsHttpServletRequest.getAuthType()
on the request object.String
getContextPath()
CallsHttpServletRequest.getContextPath()
on the request object.Cookie[]
getCookies()
Returns an array containing all theCookie
objects the client sent with the request.String
getCookieValue(String _sName)
Returns the same result as the following method invocation:String
getCookieValue(String _sName, String _sDefault)
Returns the value of the cookie (sent along with the request) with the given name.String
getHeader(String _sHeaderName)
CallsHttpServletRequest.getHeader(java.lang.String)
on the request object.Enumeration<String>
getHeaderNames()
CallsHttpServletRequest.getHeaderNames()
on the request object.Enumeration<String>
getHeaders(String _sHeaderName)
CallsHttpServletRequest.getHeaders(java.lang.String)
on the request object.String
getMethod()
CallsHttpServletRequest.getMethod()
on the request object.String
getPathInfo()
CallsHttpServletRequest.getPathInfo()
on the request object.String
getPathTranslated()
CallsHttpServletRequest.getPathTranslated()
on the request object.String
getQueryString()
CallsHttpServletRequest.getQueryString()
on the request object.String
getRemoteUser()
CallsHttpServletRequest.getRemoteUser()
on the request object.String
getRequestedSessionId()
CallsHttpServletRequest.getRequestedSessionId()
on the request object.String
getRequestURI()
CallsHttpServletRequest.getRequestURI()
on the request object.StringBuffer
getRequestURL()
CallsHttpServletRequest.getRequestURL()
on the request object.String
getServletPath()
CallsHttpServletRequest.getServletPath()
on the request object.int
getSessionTimeout()
Returns how long the current session must be idle before it is terminated.boolean
isInstanceOf(String _sTypeName)
Checks whether this class or an ancestor is an instance of the given type name.boolean
isRequestedSessionIdFromCookie()
CallsHttpServletRequest.isRequestedSessionIdFromCookie()
on the request object.boolean
isRequestedSessionIdFromURL()
CallsHttpServletRequest.isRequestedSessionIdFromURL()
on the request object.boolean
isRequestedSessionIdValid()
CallsHttpServletRequest.isRequestedSessionIdValid()
on the request object.boolean
isUserInRole(String _sRole)
CallsHttpServletRequest.isUserInRole(java.lang.String)
on the request object.void
setCookie(String _sName, String _sValue, int _iMaxAge)
Sets a cookie with the given name, value, and maximum age.void
setCookie(Cookie _cookie)
Sets a cookie to the given cookie data.void
setSessionTimeout(int _iTimeout)
Sets how long the current session must be idle before it is terminated.-
Methods inherited from class ServletEngineEnvironment
getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameters, getProtocol, getReader, getRemoteAddr, getRemoteHost, getRemotePort, getServerName, getServerPort, isSecure
-
-
-
-
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 ofHttpEngineEnvironment
.- 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 interfaceEngineEnvironmentI
- Overrides:
isInstanceOf
in classServletEngineEnvironment
- 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 callinggetCookies()
.- 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
-
getCookieValue
public String getCookieValue(String _sName)
Returns the same result as the following method invocation:getCookieValue(_sName, null)
- Since:
- 1.0
- See Also:
getCookieValue(String, String)
-
getCookies
public Cookie[] getCookies()
Returns an array containing all theCookie
objects the client sent with the request. If no cookies where sent the returned array is empty.- Returns:
- an array of all the
Cookie
s included with the request - Since:
- 1.0
-
createCookie
public Cookie createCookie(String _sName, String _sValue)
Constructs aCookie
object for a specified name and value, to be used later as the parameter to methodsetCookie(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. SeeCookie(java.lang.String, java.lang.String)
on restrictions of the characters allowed for cookie names._sValue
- the cookie's value SeeCookie.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. SeeCookie(java.lang.String, java.lang.String)
on restrictions of the characters allowed for cookie names._sValue
- the cookie's value SeeCookie.setValue(java.lang.String)
on on restrictions of the characters allowed for cookie values._iMaxAge
- the cookie's maximum age in seconds. SeeCookie.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()
CallsHttpServletRequest.getAuthType()
on the request object.- Since:
- 1.0
-
getContextPath
public String getContextPath()
CallsHttpServletRequest.getContextPath()
on the request object.- Since:
- 1.0
-
getHeader
public String getHeader(String _sHeaderName)
CallsHttpServletRequest.getHeader(java.lang.String)
on the request object.- Since:
- 1.0
-
getHeaderNames
public Enumeration<String> getHeaderNames()
CallsHttpServletRequest.getHeaderNames()
on the request object.- Since:
- 1.0
-
getHeaders
public Enumeration<String> getHeaders(String _sHeaderName)
CallsHttpServletRequest.getHeaders(java.lang.String)
on the request object.- Since:
- 1.0
-
getMethod
public String getMethod()
CallsHttpServletRequest.getMethod()
on the request object.- Since:
- 1.0
-
getPathInfo
public String getPathInfo()
CallsHttpServletRequest.getPathInfo()
on the request object.- Since:
- 1.0
-
getPathTranslated
public String getPathTranslated()
CallsHttpServletRequest.getPathTranslated()
on the request object.- Since:
- 1.0
-
getQueryString
public String getQueryString()
CallsHttpServletRequest.getQueryString()
on the request object.- Since:
- 1.0
-
getRemoteUser
public String getRemoteUser()
CallsHttpServletRequest.getRemoteUser()
on the request object.- Since:
- 1.0
-
getRequestedSessionId
public String getRequestedSessionId()
CallsHttpServletRequest.getRequestedSessionId()
on the request object.- Since:
- 1.0
-
getRequestURI
public String getRequestURI()
CallsHttpServletRequest.getRequestURI()
on the request object.- Since:
- 1.0
-
getRequestURL
public StringBuffer getRequestURL()
CallsHttpServletRequest.getRequestURL()
on the request object.- Since:
- 1.0
-
getServletPath
public String getServletPath()
CallsHttpServletRequest.getServletPath()
on the request object.- Since:
- 1.0
-
isRequestedSessionIdFromCookie
public boolean isRequestedSessionIdFromCookie()
CallsHttpServletRequest.isRequestedSessionIdFromCookie()
on the request object.- Since:
- 1.0
-
isRequestedSessionIdFromURL
public boolean isRequestedSessionIdFromURL()
CallsHttpServletRequest.isRequestedSessionIdFromURL()
on the request object.- Since:
- 1.0
-
isRequestedSessionIdValid
public boolean isRequestedSessionIdValid()
CallsHttpServletRequest.isRequestedSessionIdValid()
on the request object.- Since:
- 1.0
-
isUserInRole
public boolean isUserInRole(String _sRole)
CallsHttpServletRequest.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
-
-