|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.flexive.shared.FxContext
public class FxContext
The [fleXive] context - user session specific data like UserTickets, etc.
| Field Summary | |
|---|---|
static java.lang.String |
ADMIN_AUTHENTICATED
Session key set if the user successfully logged into the admin area |
static int |
DIV_GLOBAL_CONFIGURATION
Global division id |
static int |
DIV_UNDEFINED
Undefined division id |
static java.lang.String |
SESSION_DIVISIONID
Session key for the session division ID. |
| Method Summary | |
|---|---|
static FxContext |
_getEJBContext(FxContext template)
Get a FxContext instance to use at the EJB layer. |
void |
_reloadUserTicket()
Reload the UserTicket, needed i.e. |
static void |
cleanup()
Performs a cleanup of the stored informations. |
void |
clearCachedAttributes()
Remove attributes that are known to be cached (before storing the context for later use). |
FxContext |
copy()
Returns an independent copy of this context. |
static FxContext |
get()
Gets the session information for the running thread |
java.lang.String |
getAbsolutePath(java.lang.String path)
Returns the absolute path for the given resource (i.e. |
java.lang.String |
getApplicationId()
Returns the id of the appication the request was made in. |
java.lang.Object |
getAttribute(java.lang.Object key)
Return the value stored under the given key. |
java.util.Map<java.lang.Object,java.lang.Object> |
getAttributeMap()
Return a (unmodifiable) map of all attributes stored in the context. |
java.lang.String |
getContextPath()
Return the context path of this request. |
java.lang.String |
getDateFormat()
Get the used date format - either an override set in the context or the one defined by the current users ticket |
java.lang.String |
getDateFormatOverride()
|
java.text.DateFormat |
getDateFormatter()
Get the date formatter for the current users locale |
java.text.DateFormat |
getDateFormatter(java.util.Locale locale)
Get the date formatter for the requested locale |
java.lang.String |
getDateTimeFormat()
Get the used date/time format - either an override set in the context or the one defined by the current users ticket |
java.lang.String |
getDateTimeFormatOverride()
|
java.text.DateFormat |
getDateTimeFormatter()
Get the date/time formatter for the current users locale |
java.text.DateFormat |
getDateTimeFormatter(java.util.Locale locale)
Get the date/time formatter for the requested locale |
char |
getDecimalSeparator()
Get the used decimal separator - either an override set in the context or the one defined by the current users ticket |
char |
getDecimalSeparatorOverride()
|
DivisionData |
getDivisionData()
|
int |
getDivisionId()
Returns the id of the division. |
char |
getGroupingSeparator()
Get the used grouping separator - either an override set in the context or the one defined by the current users ticket |
char |
getGroupingSeparatorOverride()
|
FxLanguage |
getLanguage()
Get the current users preferred language |
java.util.Locale |
getLocale()
Get the current users preferred locale (based on his preferred language) |
long |
getNodeId()
Deprecated. will be removed as soon as tree search is fixed |
java.text.NumberFormat |
getNumberFormatInstance()
Get a number format instance depending on the current users formatting options |
java.text.NumberFormat |
getNumberFormatInstance(java.util.Locale locale)
Get a number format instance depending on the current users formatting options |
java.text.NumberFormat |
getPortableNumberFormatInstance()
Get a portable number formatter instance |
java.lang.String |
getRelativeRequestURI()
Returns the decoded relative request URI. |
java.lang.String |
getRelativeRequestURI(boolean decode)
Returns the relative request URI. |
java.lang.String |
getRemoteHost()
Returns the calling remote host. |
java.lang.String |
getRequestURI()
Returns the request URI. |
java.lang.String |
getRequestUriNoContext()
Returns the request URI without its context. |
boolean |
getRunAsSystem()
Returns true if all calls are done without permission checks for the time beeing. |
java.lang.String |
getServer()
Returns the full server URL including the port for this request, e.g. |
java.lang.String |
getServerName()
Returns the name of the server handling this request, e.g. |
int |
getServerPort()
Returns the port of the server handling this request, e.g. |
java.lang.String |
getSessionId()
Returns the session id, which is unique at call time |
UserTicket |
getTicket()
|
static UserTicket |
getTicketFromEJB(javax.servlet.http.HttpSession session)
Gets the user ticket from the ejb layer, and stores it in the session as 'last used user ticket' |
java.lang.String |
getTimeFormat()
Get the used time format - either an override set in the context or the one defined by the current users ticket |
java.lang.String |
getTimeFormatOverride()
|
java.text.DateFormat |
getTimeFormatter()
Get the time formatter for the current users locale |
java.text.DateFormat |
getTimeFormatter(java.util.Locale locale)
Get the time formatter for the requested locale |
FxTreeMode |
getTreeMode()
Deprecated. will be removed as soon as tree search is fixed |
boolean |
getTreeWasModified()
Returns true if the tree was modified within this thread by the user belonging to this thread. |
java.lang.Boolean |
getUseGroupingSeparatorOverride()
|
static UserTicket |
getUserTicket()
Returns the user ticket associated to the current thread. |
static void |
initializeSystem(int divisionId,
java.lang.String applicationName)
Helper method to bootstrap a [fleXive] system outside an application server (e.g. |
boolean |
isExecutingRunOnceScripts()
Is this context currently executing run-once scripts? This effectively returns the user id of the default global supervisor, but does not change any other behaviour. |
boolean |
isGlobalAuthenticated()
Return true if the user successfully authenticated for the global configuration area |
boolean |
isGlobalConfigDivision()
Returns true if the division is the global configuration division. |
boolean |
isTestDivision()
Return true if the current context runs in the test division. |
boolean |
isWebDAV()
Returns true if this request is triggered by a webdav operation. |
void |
login(java.lang.String loginname,
java.lang.String password,
boolean takeOver)
Tries to login a user. |
void |
logout()
Logout of the current user. |
void |
overrideTicket(UserTicket ticket)
Override the used ticket. |
static boolean |
preventAutoVersioning()
Should auto versioning be prevented for this context? |
static void |
remove()
Remove the thread-local FxContext instance. |
void |
replace()
Stores the FxContext instance in the current thread. |
static void |
replace(FxContext context)
Deprecated. use replace() |
void |
runAsSystem()
Runs all further calls as SYSTEM user with full permissions until stopRunAsSystem gets called. |
void |
setAttribute(java.lang.Object key,
java.lang.Object value)
Store a value under the given key in the current request's FxContext. |
void |
setContextPath(java.lang.String contextPath)
Changes the context path (Currently needed for embedded container testing.) |
void |
setDateFormatOverride(java.lang.String dateFormatOverride)
|
void |
setDateTimeFormatOverride(java.lang.String dateTimeFormatOverride)
|
void |
setDecimalSeparatorOverride(char decimalSeparatorOverride)
|
void |
setDivisionId(int division)
Changes the division ID. |
void |
setExecutingRunOnceScripts(boolean executingRunOnceScripts)
Mark this context for executing run-once scripts. |
void |
setGlobalAuthenticated(boolean globalAuthenticated)
Authorize the user for the global configuration area |
void |
setGroupingSeparatorOverride(char groupingSeparatorOverride)
|
void |
setNodeId(long nodeId)
Deprecated. will be removed as soon as tree search is fixed |
static void |
setPreventAutoVersioning(boolean flag)
Set auto versioning prevention flag |
void |
setSessionID(java.lang.String sessionID)
Sets the session ID. |
void |
setTicket(UserTicket ticket)
|
void |
setTimeFormatOverride(java.lang.String timeFormatOverride)
|
void |
setTreeMode(FxTreeMode treeMode)
Deprecated. will be removed as soon as tree search is fixed |
void |
setTreeWasModified()
Flag the tree as modified |
void |
setUseGroupingSeparatorOverride(java.lang.Boolean useGroupingSeparatorOverride)
|
static void |
startRunningAsSystem()
Shortcut for FxContext.get().runAsSystem(). |
void |
stopRunAsSystem()
Removes one runeAsSystem flag from the stack. |
static void |
stopRunningAsSystem()
Shortcut for FxContext.get().stopRunAsSystem(). |
static FxContext |
storeInfos(javax.servlet.http.HttpServletRequest request,
boolean dynamicContent,
int divisionId,
boolean isWebdav)
Stores the needed informations about the sessions. |
java.lang.String |
toString()
Returns a string representation of the object. |
boolean |
useGroupingSeparator()
Use the grouping separator? - either an override set in the context or the one defined by the current users ticket |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int DIV_GLOBAL_CONFIGURATION
public static final int DIV_UNDEFINED
public static final java.lang.String ADMIN_AUTHENTICATED
public static final java.lang.String SESSION_DIVISIONID
| Method Detail |
|---|
public UserTicket getTicket()
public void setTicket(UserTicket ticket)
public long getNodeId()
public void setNodeId(long nodeId)
nodeId - active tree node idpublic FxTreeMode getTreeMode()
public void setTreeMode(FxTreeMode treeMode)
treeMode - the active tree modepublic boolean getTreeWasModified()
public void setTreeWasModified()
public boolean isExecutingRunOnceScripts()
public void setExecutingRunOnceScripts(boolean executingRunOnceScripts)
executingRunOnceScripts - flagpublic java.util.Locale getLocale()
public FxLanguage getLanguage()
public void login(java.lang.String loginname,
java.lang.String password,
boolean takeOver)
throws FxLoginFailedException,
FxAccountInUseException
loginname - the unique user namepassword - the passwordtakeOver - the take over flag
FxLoginFailedException - if the login failed
FxAccountInUseException - if take over was false and the account is in use
public void logout()
throws FxLogoutFailedException
FxLogoutFailedException - if the function failspublic void overrideTicket(UserTicket ticket)
ticket - ticket to override withpublic static UserTicket getTicketFromEJB(javax.servlet.http.HttpSession session)
session - the session
public boolean isGlobalConfigDivision()
public boolean isTestDivision()
public int getDivisionId()
public void setDivisionId(int division)
division - the division idpublic void setContextPath(java.lang.String contextPath)
contextPath - the context pathpublic void runAsSystem()
public void stopRunAsSystem()
public boolean getRunAsSystem()
public java.lang.String getSessionId()
public void setSessionID(java.lang.String sessionID)
sessionID - the new session IDpublic java.lang.String getRequestURI()
public java.lang.String getRelativeRequestURI()
public java.lang.String getRelativeRequestURI(boolean decode)
decode - if set to true the URI will be decoded (eg "%20" to a space), using UTF-8
public java.lang.String getServerName()
public int getServerPort()
public java.lang.String getServer()
public java.lang.String getRemoteHost()
public java.lang.String getApplicationId()
public java.lang.String getAbsolutePath(java.lang.String path)
path - the path of the resource (e.g. /pub/css/demo.css)
public void _reloadUserTicket()
public boolean isWebDAV()
public boolean isGlobalAuthenticated()
public void setGlobalAuthenticated(boolean globalAuthenticated)
globalAuthenticated - true if the user should be authorized for the global configurationpublic java.lang.String getRequestUriNoContext()
public java.lang.String getContextPath()
public DivisionData getDivisionData()
public FxContext copy()
public void replace()
public static void remove()
public void clearCachedAttributes()
public void setAttribute(java.lang.Object key,
java.lang.Object value)
A value stored in the context exists for the entire time of the fleXive request, for a web request this is slightly shorter than request scope. The main advantage is that the fleXive context is available for any request, not just requests from a web application, and that no overhead for setting or retrieving values exists.
key - the attribute keyvalue - the attribute value. If null, the attribute will be removed.public java.lang.Object getAttribute(java.lang.Object key)
A value stored in the context exists for the entire time of the fleXive request, for a web request this is slightly shorter than request scope. The main advantage is that the fleXive context is available for any request, not just requests from a web application, and that no overhead for setting or retrieving values exists.
key - the attribute key
public java.util.Map<java.lang.Object,java.lang.Object> getAttributeMap()
public static FxContext storeInfos(javax.servlet.http.HttpServletRequest request,
boolean dynamicContent,
int divisionId,
boolean isWebdav)
request - the users requestdynamicContent - is the content dynamic?divisionId - the division idisWebdav - true if this is an webdav request
public static void cleanup()
public static void initializeSystem(int divisionId,
java.lang.String applicationName)
divisionId - the desired division ID (will determin the application datasource)applicationName - the application name (mostly used as "imaginary context path")public java.lang.String toString()
toString in class java.lang.Objectpublic static FxContext get()
public static UserTicket getUserTicket()
@Deprecated public static void replace(FxContext context)
replace()
null
context - the FxContext to use as replacementpublic static void startRunningAsSystem()
FxContext.get().runAsSystem().
public static void stopRunningAsSystem()
FxContext.get().stopRunAsSystem().
public static FxContext _getEJBContext(FxContext template)
template - the template to use for the division
public java.lang.String getDateFormatOverride()
public void setDateFormatOverride(java.lang.String dateFormatOverride)
public java.lang.String getTimeFormatOverride()
public void setTimeFormatOverride(java.lang.String timeFormatOverride)
public java.lang.String getDateTimeFormatOverride()
public void setDateTimeFormatOverride(java.lang.String dateTimeFormatOverride)
public char getDecimalSeparatorOverride()
public void setDecimalSeparatorOverride(char decimalSeparatorOverride)
public char getGroupingSeparatorOverride()
public void setGroupingSeparatorOverride(char groupingSeparatorOverride)
public java.lang.Boolean getUseGroupingSeparatorOverride()
public void setUseGroupingSeparatorOverride(java.lang.Boolean useGroupingSeparatorOverride)
public java.lang.String getDateFormat()
public java.lang.String getTimeFormat()
public java.lang.String getDateTimeFormat()
public char getDecimalSeparator()
public char getGroupingSeparator()
public boolean useGroupingSeparator()
public java.text.NumberFormat getPortableNumberFormatInstance()
public java.text.NumberFormat getNumberFormatInstance()
public java.text.NumberFormat getNumberFormatInstance(java.util.Locale locale)
locale - locale to use
public java.text.DateFormat getDateFormatter()
public java.text.DateFormat getDateFormatter(java.util.Locale locale)
locale - requested locale
public java.text.DateFormat getTimeFormatter()
public java.text.DateFormat getTimeFormatter(java.util.Locale locale)
locale - requested locale
public java.text.DateFormat getDateTimeFormatter()
public java.text.DateFormat getDateTimeFormatter(java.util.Locale locale)
locale - requested locale
public static boolean preventAutoVersioning()
public static void setPreventAutoVersioning(boolean flag)
flag - auto versioning prevention flag
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||