public class CmsContextInfo extends java.lang.Object implements java.io.Serializable
CmsRequestContext during system runtime.| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
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,
CmsSiteMatcher requestMatcher,
java.lang.String siteRoot,
boolean isSecureRequest,
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(). |
| Modifier and Type | Method and Description |
|---|---|
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.
|
CmsResource |
getDetailResource()
Gets the detail content resource.
|
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.
|
CmsSiteMatcher |
getRequestMatcher()
Returns the matcher for the current request, that is the host part of the URI from the original http request.
|
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.
|
boolean |
isSecureRequest()
Returns true if this a secure request.
|
void |
setDetailResource(CmsResource detailResource)
Sets the detail content resource.
|
void |
setEncoding(java.lang.String encoding)
Sets the encoding.
|
void |
setIsSecureRequest(boolean isSecureRequest)
Sets the 'isSecureRequest' attribute.
|
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 |
setRequestMatcher(CmsSiteMatcher requestMatcher)
Sets the matcher for the current request, that is the host part of the URI from the original http request.
|
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.
|
public static final java.lang.String ATTRIBUTE_REQUEST_TIME
public static final long CURRENT_TIME
public static final java.lang.String LOCALHOST
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, CmsSiteMatcher requestMatcher, java.lang.String siteRoot, boolean isSecureRequest, 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 withrequestMatcher - the matcher for the current request, that is the host part of the URI from the original http requestsiteRoot - the site root to create the context withisSecureRequest - if this a secure requestlocale - 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()public java.lang.Object clone()
clone in class java.lang.ObjectObject.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 CmsResource getDetailResource()
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.getCurrentProject()public java.lang.String getProjectName()
getProject(),
CmsRequestContext.getCurrentProject()public java.lang.String getRemoteAddr()
CmsRequestContext.getRemoteAddress()public java.lang.String getRequestedUri()
CmsRequestContext.getUri()public CmsSiteMatcher getRequestMatcher()
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.getCurrentUser()public java.lang.String getUserName()
getUser(),
CmsRequestContext.getCurrentUser()public boolean isSecureRequest()
public void setDetailResource(CmsResource detailResource)
detailResource - the detail content resource to setpublic void setEncoding(java.lang.String encoding)
encoding - the encoding to setCmsRequestContext.setEncoding(String)public void setIsSecureRequest(boolean isSecureRequest)
isSecureRequest - true if this a secure requestpublic 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.getCurrentProject()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 setRequestMatcher(CmsSiteMatcher requestMatcher)
requestMatcher - the matcher for the current requestpublic 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.getCurrentUser()protected void checkFrozen() throws CmsRuntimeException
CmsRuntimeException - in case the configuration is already frozen