public class DefaultEnvironment extends Object implements Environment
Environment.| Modifier | Constructor and Description |
|---|---|
protected |
DefaultEnvironment() |
protected |
DefaultEnvironment(javax.servlet.ServletContext servletContext,
javax.servlet.http.HttpSession httpSession,
javax.servlet.ServletRequest servletRequest) |
protected |
DefaultEnvironment(javax.servlet.ServletContext servletContext,
javax.servlet.http.HttpSession httpSession,
javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse) |
|
DefaultEnvironment(javax.servlet.ServletContext context,
String host)
Returns a fully initialized DefaultEnvironment.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearSiteScope(Site site)
Clears the site-scoped attributes for the given
Site. |
void |
disable(Scope scope)
Disables the given
Scope for this environment |
void |
enable(Scope scope)
Enables the given
Scope for this environment |
static DefaultEnvironment |
get(javax.servlet.http.HttpSession session)
Returns a new
DefaultEnvironment. |
static DefaultEnvironment |
get(javax.servlet.jsp.PageContext pageContext)
Returns a fully initialized DefaultEnvironment.
|
static DefaultEnvironment |
get(javax.servlet.ServletContext context)
Returns a new
DefaultEnvironment. |
static DefaultEnvironment |
get(javax.servlet.ServletContext context,
javax.servlet.ServletRequest request)
Returns a fully initialized DefaultEnvironment.
|
static DefaultEnvironment |
get(javax.servlet.ServletContext context,
javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response)
Returns a fully initialized DefaultEnvironment.
|
static DefaultEnvironment |
get(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response)
Returns a fully initialized DefaultEnvironment.
|
<T> T |
getAttribute(Scope scope,
String name)
Returns the attribute with the given name for the given
Scope. |
String |
getAttributeAsString(Scope scope,
String name)
Returns the string-representation of an attribute, calling
toString() on the resulting object. |
Locale |
getLocale()
Returns the current
Locale. |
javax.servlet.ServletContext |
getServletContext()
Returns the current
ServletContext. |
javax.servlet.http.HttpServletRequest |
getServletRequest()
Returns the current
HttpServletRequest. |
javax.servlet.http.HttpServletResponse |
getServletResponse()
Returns the current
HttpServletResponse. |
Subject |
getSubject()
Returns the current
Subject. |
TimeZone |
getTimeZone()
Returns the current
TimeZone. |
void |
init(javax.servlet.ServletContext servletContext,
javax.servlet.http.HttpSession httpSession,
javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse,
String host)
Initializes the
Environment. |
boolean |
isInitialized()
Checks whether this
Environment has been initialized. |
boolean |
isSubjectAuthenticated()
|
Set<String> |
keySet(Scope scope)
|
void |
logoutSubject()
Removes the current
Subject form the HttpSession and invalidates the latter. |
<T> T |
removeAttribute(Scope scope,
String name)
Removes the attribute with the given name from the given
Scope and returns it. |
void |
setAttribute(Scope scope,
String name,
Object value)
Sets an attribute for the given
Scope to the given value. |
void |
setLocale(Locale locale) |
void |
setSubject(Subject subject)
Sets the
Subject fur the current HttpSession. |
void |
setTimeZone(TimeZone timeZone) |
String |
toString() |
protected DefaultEnvironment(javax.servlet.ServletContext servletContext,
javax.servlet.http.HttpSession httpSession,
javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse)
protected DefaultEnvironment()
protected DefaultEnvironment(javax.servlet.ServletContext servletContext,
javax.servlet.http.HttpSession httpSession,
javax.servlet.ServletRequest servletRequest)
public void init(javax.servlet.ServletContext servletContext,
javax.servlet.http.HttpSession httpSession,
javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse,
String host)
EnvironmentEnvironment.init in interface EnvironmentservletContext - a ServletContexthttpSession - a HttpSessionservletRequest - a ServletRequestservletResponse - a ServletResponsehost - the host for the site-Scopepublic static DefaultEnvironment get(javax.servlet.jsp.PageContext pageContext)
pageContext - a PageContextpublic static DefaultEnvironment get(javax.servlet.http.HttpSession session)
DefaultEnvironment. Only Scope.PLATFORM and Scope.SESSION will be available
for the returned instance.session - a HttpSessionDefaultEnvironmentpublic static DefaultEnvironment get(javax.servlet.ServletContext context, javax.servlet.ServletRequest request)
context - a ServletContextrequest - a ServletRequestDefaultEnvironmentpublic static DefaultEnvironment get(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
request - a ServletRequestresponse - a ServletResponseDefaultEnvironmentpublic static DefaultEnvironment get(javax.servlet.ServletContext context, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
context - a ServletContextrequest - a ServletRequestresponse - a ServletResponseDefaultEnvironmentpublic static DefaultEnvironment get(javax.servlet.ServletContext context)
DefaultEnvironment. Only Scope.PLATFORM will be available for the returned
instance.context - a ServletContextDefaultEnvironmentpublic void setAttribute(Scope scope, String name, Object value)
EnvironmentScope to the given value.setAttribute in interface Environmentscope - the Scope of the attribute to setname - the name of the attribute to setvalue - the attribute to setpublic <T> T getAttribute(Scope scope, String name)
EnvironmentScope.getAttribute in interface Environmentscope - the Scope of the attribute to getname - the name of the attribute to getnull if the attribute does not exist in the given
Scopepublic <T> T removeAttribute(Scope scope, String name)
EnvironmentScope and returns it.removeAttribute in interface Environmentscope - the Scope of the attribute to removename - the name of the attribute to removenull if the attribute does not exist in the given
Scopepublic String getAttributeAsString(Scope scope, String name)
EnvironmenttoString() on the resulting object.getAttributeAsString in interface Environmentscope - the Scope of the attribute to getname - the name of the attribute to getnull if the attribute does not exist in the given
Scopepublic Set<String> keySet(Scope scope)
EnvironmentkeySet in interface Environmentscope - the Scope the get the attribute names forSet containing all attribute names, or null if the Scope is not availablepublic javax.servlet.ServletContext getServletContext()
ServletContext.ServletContextpublic javax.servlet.http.HttpServletRequest getServletRequest()
HttpServletRequest.HttpServletRequestpublic javax.servlet.http.HttpServletResponse getServletResponse()
HttpServletResponse.HttpServletResponsepublic boolean isSubjectAuthenticated()
EnvironmentisSubjectAuthenticated in interface Environmenttrue if the current Subject is authenticated, false otherwisepublic void setSubject(Subject subject)
Subject fur the current HttpSession.subject - the Subject to setpublic Locale getLocale()
EnvironmentLocale. If a Subject is logged in, a Locale is returned that
represent the language of the Subject via Account.getLanguage(). If no Subject is
present, the default-Locale from the Site is used.getLocale in interface EnvironmentLocalepublic void setLocale(Locale locale)
public TimeZone getTimeZone()
EnvironmentTimeZone. If a Subject is present (no matter whether it is logged in or not),
Account.getTimeZone() is being returned. If no Subject is present, the default-TimeZone
from the Site is used.getTimeZone in interface EnvironmentTimeZonepublic void setTimeZone(TimeZone timeZone)
public Subject getSubject()
EnvironmentSubject.getSubject in interface EnvironmentSubject, if presentpublic void logoutSubject()
Subject form the HttpSession and invalidates the latter.public void disable(Scope scope)
Scope for this environmentscope - the Scope to disableenable(Scope)public void enable(Scope scope)
Scope for this environmentscope - the Scope to enabledisable(Scope)public boolean isInitialized()
Environment has been initialized.true if his Environment has been initialized, false otherwise.init(ServletContext, HttpSession, ServletRequest, ServletResponse, String)Copyright © 2011–2019 aiticon GmbH. All rights reserved.