public interface Environment
Environment is able to set, read and remove attributes of a certain Scope. The main purposes are:
Subject via getSubject()
Locale and TimeZone via getLocale() and
getTimeZone()
Scope.SESSION and Scope.SITE)
Scope.PLATFORM and Applications where
Application.isPrivileged() is true)
Scope| Modifier and Type | Method and Description |
|---|---|
<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. |
Subject |
getSubject()
Returns the current
Subject. |
TimeZone |
getTimeZone()
Returns the current
TimeZone. |
void |
init(javax.servlet.ServletContext context,
javax.servlet.http.HttpSession session,
javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
String host)
Deprecated.
no replacement
|
boolean |
isSubjectAuthenticated()
|
Set<String> |
keySet(Scope scope)
|
<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 setAttribute(Scope scope, String name, Object value)
Scope to the given value.scope - the Scope of the attribute to setname - the name of the attribute to setvalue - the attribute to set<T> T getAttribute(Scope scope, String name)
Scope.<T> T removeAttribute(Scope scope, String name)
Scope and returns it.String getAttributeAsString(Scope scope, String name)
toString() on the resulting object.Locale getLocale()
Locale. 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.LocaleTimeZone getTimeZone()
TimeZone. 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.TimeZoneboolean isSubjectAuthenticated()
true if the current Subject is authenticated, false otherwise@Deprecated void init(javax.servlet.ServletContext context, javax.servlet.http.HttpSession session, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, String host)
Environment.context - a ServletContextsession - a HttpSessionrequest - a ServletRequestresponse - a ServletResponsehost - the host for the site-ScopeIllegalStateException - if this Environment already has been initializedCopyright © 2011–2021 aiticon GmbH. All rights reserved.