|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.main.CmsContextInfo
public class CmsContextInfo
Contains user information for automated creation of a
CmsRequestContext
during system runtime.
Field Summary | |
---|---|
static java.lang.String |
ATTRIBUTE_REQUEST_TIME
Name of the http session attribute the request time is stored in. |
static long |
CURRENT_TIME
Indicates the request time should always be the current time. |
static java.lang.String |
LOCALHOST
Localhost ip used in fallback cases. |
Constructor Summary | |
---|---|
CmsContextInfo()
Creates a new instance, initializing the variables with some reasonable default values. |
|
CmsContextInfo(CmsRequestContext requestContext)
Creates a new instance with all context variables initialized from the given request context. |
|
CmsContextInfo(CmsUser user,
CmsProject project,
java.lang.String requestedUri,
java.lang.String siteRoot,
java.util.Locale locale,
java.lang.String encoding,
java.lang.String remoteAddr,
long requestTime,
java.lang.String ouFqn)
Creates a new instance with all context variables initialized. |
|
CmsContextInfo(java.lang.String userName)
Creates a new instance, initializing the user name as provided and all other vaiables with the same default values as in CmsContextInfo() . |
Method Summary | |
---|---|
protected void |
checkFrozen()
Checks if this context info configuration is frozen. |
java.lang.Object |
clone()
Creates a clone of this context info object. |
void |
freeze()
Finalizes (freezes) the configuration of this context information. |
java.lang.String |
getEncoding()
Returns the encoding. |
java.util.Locale |
getLocale()
Returns the locale. |
java.lang.String |
getLocaleName()
Returns the locale name. |
java.lang.String |
getOuFqn()
Returns the fully qualified name of the organizational unit. |
CmsProject |
getProject()
Returns the project, or null if the project
has not been configured. |
java.lang.String |
getProjectName()
Returns the project name. |
java.lang.String |
getRemoteAddr()
Returns the remote ip address. |
java.lang.String |
getRequestedUri()
Returns the requested uri. |
long |
getRequestTime()
Returns the request time used for validation of resource publication and expiration dates. |
java.lang.String |
getSiteRoot()
Returns the siteroot. |
CmsUser |
getUser()
Returns the user, or null if the user
has not been configured. |
java.lang.String |
getUserName()
Returns the username. |
void |
setEncoding(java.lang.String encoding)
Sets the encoding. |
void |
setLocale(java.util.Locale locale)
Sets the locale. |
void |
setLocaleName(java.lang.String localeName)
Sets the locale name. |
void |
setOuFqn(java.lang.String ouFqn)
Sets the fully qualified name of the organizational unit. |
void |
setProjectName(java.lang.String projectName)
Sets the project name. |
void |
setRemoteAddr(java.lang.String remoteAddr)
Sets the remote ip address. |
void |
setRequestedUri(java.lang.String requestedUri)
Sets the requested uri. |
void |
setRequestTime(long requestTime)
Sets the request time used for validation of resource publication and expiration dates. |
void |
setSiteRoot(java.lang.String siteRoot)
Sets the siteroot. |
void |
setUserName(java.lang.String userName)
Sets the username. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ATTRIBUTE_REQUEST_TIME
public static final long CURRENT_TIME
public static final java.lang.String LOCALHOST
Constructor Detail |
---|
public CmsContextInfo()
The default values are:
public CmsContextInfo(CmsRequestContext requestContext)
requestContext
- the request context to initialize this context info withpublic CmsContextInfo(CmsUser user, CmsProject project, java.lang.String requestedUri, java.lang.String siteRoot, java.util.Locale locale, java.lang.String encoding, java.lang.String remoteAddr, long requestTime, java.lang.String ouFqn)
user
- the user to create the context withproject
- the project to create the context withrequestedUri
- the request URI to create the context withsiteRoot
- the site root to create the context withlocale
- the locale to create the context withencoding
- the encoding to create the context withremoteAddr
- the remote ip address to create the context withrequestTime
- the time of the request (used for resource publication / expiration date)ouFqn
- the fully qualified name of the organizational unit to create the context withpublic CmsContextInfo(java.lang.String userName)
CmsContextInfo()
.
userName
- the user name to create the context withCmsContextInfo()
Method Detail |
---|
public java.lang.Object clone()
clone
in class java.lang.Object
Object.clone()
public void freeze()
After this entry has been frozen, any attempt to change the
configuration of this context info with one of the "set..." methods
will lead to a RuntimeException
.
public java.lang.String getEncoding()
CmsRequestContext.getEncoding()
public java.util.Locale getLocale()
CmsRequestContext.getLocale()
public java.lang.String getLocaleName()
CmsRequestContext.getLocale()
public java.lang.String getOuFqn()
public CmsProject getProject()
null
if the project
has not been configured.If the project has not been configured, at last the project name will be available.
getProjectName()
,
CmsRequestContext.currentProject()
public java.lang.String getProjectName()
getProject()
,
CmsRequestContext.currentProject()
public java.lang.String getRemoteAddr()
CmsRequestContext.getRemoteAddress()
public java.lang.String getRequestedUri()
CmsRequestContext.getUri()
public long getRequestTime()
CmsRequestContext.getRequestTime()
public java.lang.String getSiteRoot()
CmsRequestContext.getSiteRoot()
public CmsUser getUser()
null
if the user
has not been configured.If the user has not been configured, at last the user name will be available.
getUserName()
,
CmsRequestContext.currentUser()
public java.lang.String getUserName()
getUser()
,
CmsRequestContext.currentUser()
public void setEncoding(java.lang.String encoding)
encoding
- the encoding to setCmsRequestContext.setEncoding(String)
public void setLocale(java.util.Locale locale)
Setting the locale name will override the currently selected locale and vice-versa. The locale name and the locale will always match.
locale
- the locale to setsetLocaleName(String)
,
CmsRequestContext.getLocale()
public void setLocaleName(java.lang.String localeName)
Setting the locale name will override the currently selected locale and vice-versa. The locale name and the locale will always match.
localeName
- the locale name to setsetLocale(Locale)
,
CmsRequestContext.getLocale()
public void setOuFqn(java.lang.String ouFqn)
ouFqn
- the fully qualified name of the organizational unit to setpublic void setProjectName(java.lang.String projectName)
projectName
- the project name to setCmsRequestContext.currentProject()
public void setRemoteAddr(java.lang.String remoteAddr)
remoteAddr
- the remote ip addressCmsRequestContext.getRemoteAddress()
public void setRequestedUri(java.lang.String requestedUri)
requestedUri
- the requested uri to setCmsRequestContext.setUri(String)
public void setRequestTime(long requestTime)
requestTime
- the request time to setCmsRequestContext.getRequestTime()
public void setSiteRoot(java.lang.String siteRoot)
siteRoot
- the siteroot to setCmsRequestContext.setSiteRoot(String)
public void setUserName(java.lang.String userName)
userName
- the username to setCmsRequestContext.currentUser()
protected void checkFrozen() throws CmsRuntimeException
CmsRuntimeException
- in case the configuration is already frozen
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |