Package com.artisol.teneo.engine.webapp
Class HttpEngineEnvironment
Object
AbstractEngineEnvironment
ServletEngineEnvironment
HttpEngineEnvironment
- All Implemented Interfaces:
EngineEnvironmentI
Provides access to request data and cookie handling in a servlet container environment.
Instances of this class are passed directly to solution scripts.
- Version:
- 8.1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of the servlet request attribute to store the session timeout value. -
Constructor Summary
ConstructorsConstructorDescriptionHttpEngineEnvironment(HttpServletRequest _request, Map<String, Object> _mRequestParameters, HttpServletResponse _response) Creates a new instance ofHttpEngineEnvironment. -
Method Summary
Modifier and TypeMethodDescriptionCookiecreateCookie(String _sName, String _sValue) Constructs aCookieobject for a specified name and value, to be used later as the parameter to methodsetCookie(Cookie).voiddeleteCookie(String _sName) Deletes the cookie with the given name.CallsHttpServletRequest.getAuthType()on the request object.CallsHttpServletRequest.getContextPath()on the request object.Cookie[]Returns an array containing all theCookieobjects the client sent with the request.getCookieValue(String _sName) Returns the same result as the following method invocation:getCookieValue(String _sName, String _sDefault) Returns the value of the cookie (sent along with the request) with the given name.CallsHttpServletRequest.getHeader(java.lang.String)on the request object.CallsHttpServletRequest.getHeaderNames()on the request object.getHeaders(String _sHeaderName) CallsHttpServletRequest.getHeaders(java.lang.String)on the request object.CallsHttpServletRequest.getMethod()on the request object.CallsHttpServletRequest.getPathInfo()on the request object.CallsHttpServletRequest.getPathTranslated()on the request object.CallsHttpServletRequest.getQueryString()on the request object.CallsHttpServletRequest.getRemoteUser()on the request object.CallsHttpServletRequest.getRequestedSessionId()on the request object.CallsHttpServletRequest.getRequestURI()on the request object.CallsHttpServletRequest.getRequestURL()on the request object.CallsHttpServletRequest.getServletPath()on the request object.intReturns how long the current session must be idle before it is terminated.booleanisInstanceOf(String _sTypeName) Checks whether this class or an ancestor is an instance of the given type name.booleanCallsHttpServletRequest.isRequestedSessionIdFromCookie()on the request object.booleanCallsHttpServletRequest.isRequestedSessionIdFromURL()on the request object.booleanCallsHttpServletRequest.isRequestedSessionIdValid()on the request object.booleanisUserInRole(String _sRole) CallsHttpServletRequest.isUserInRole(java.lang.String)on the request object.voidSets a cookie with the given name, value, and maximum age.voidsetCookie(Cookie _cookie) Sets a cookie to the given cookie data.voidsetSessionTimeout(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 Details
-
ATTRIBUTE_SESSION_TIMEOUT
Name of the servlet request attribute to store the session timeout value.- See Also:
-
-
Constructor Details
-
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 Details
-
isInstanceOf
Checks whether this class or an ancestor is an instance of the given type name.- Specified by:
isInstanceOfin interfaceEngineEnvironmentI- Overrides:
isInstanceOfin classServletEngineEnvironment- Returns:
trueif and only if the given type name equals"HttpEngineEnvironment"or one of the type names of the ancestor classes.- Since:
- 1.0
-
getCookieValue
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
Cookieobjects 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:
-
getCookieValue
Returns the same result as the following method invocation:getCookieValue(_sName, null)
- Since:
- 1.0
- See Also:
-
getCookies
public Cookie[] getCookies()Returns an array containing all theCookieobjects 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
Constructs aCookieobject for a specified name and value, to be used later as the parameter to methodsetCookie(Cookie).Note: This method only creates a
Cookieobject 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
Cookieobject with the given name and value - Since:
- 1.1
- See Also:
-
setCookie
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
Deletes the cookie with the given name. The cookie data will be sent along the servlet reply to the client.- Since:
- 1.0
-
getAuthType
CallsHttpServletRequest.getAuthType()on the request object.- Since:
- 1.0
-
getContextPath
CallsHttpServletRequest.getContextPath()on the request object.- Since:
- 1.0
-
getHeader
CallsHttpServletRequest.getHeader(java.lang.String)on the request object.- Since:
- 1.0
-
getHeaderNames
CallsHttpServletRequest.getHeaderNames()on the request object.- Since:
- 1.0
-
getHeaders
CallsHttpServletRequest.getHeaders(java.lang.String)on the request object.- Since:
- 1.0
-
getMethod
CallsHttpServletRequest.getMethod()on the request object.- Since:
- 1.0
-
getPathInfo
CallsHttpServletRequest.getPathInfo()on the request object.- Since:
- 1.0
-
getPathTranslated
CallsHttpServletRequest.getPathTranslated()on the request object.- Since:
- 1.0
-
getQueryString
CallsHttpServletRequest.getQueryString()on the request object.- Since:
- 1.0
-
getRemoteUser
CallsHttpServletRequest.getRemoteUser()on the request object.- Since:
- 1.0
-
getRequestedSessionId
CallsHttpServletRequest.getRequestedSessionId()on the request object.- Since:
- 1.0
-
getRequestURI
CallsHttpServletRequest.getRequestURI()on the request object.- Since:
- 1.0
-
getRequestURL
CallsHttpServletRequest.getRequestURL()on the request object.- Since:
- 1.0
-
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
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
-