org.opencms.main
Class CmsServletContainerSettings

java.lang.Object
  extended by org.opencms.main.CmsServletContainerSettings

public class CmsServletContainerSettings
extends java.lang.Object

Stores specific servlet container options, that might influence OpenCms behavior.

Since:
7.0.5
Version:
$Revision: 1.9 $
Author:
Michael Moossen

Nested Class Summary
static class CmsServletContainerSettings.CmsServletContainerCfgMode
          Enumeration class for the configuration mode.
 
Field Summary
static CmsServletContainerSettings.CmsServletContainerCfgMode CFG_MODE_AUTO
          String remote command execution return type.
static CmsServletContainerSettings.CmsServletContainerCfgMode CFG_MODE_MANUAL
          Map remote command execution return type.
static CmsServletContainerSettings.CmsServletContainerCfgMode CFG_MODE_NONE
          List remote command execution return type.
 
Constructor Summary
  CmsServletContainerSettings(javax.servlet.ServletContext context)
          Creates a new object.
protected CmsServletContainerSettings(java.lang.String webInfRfsPath, java.lang.String defaultWebApplication, java.lang.String servletMapping, java.lang.String servletContainerName, java.lang.String webApplicationContext)
          Creates an instance based on the given values.
 
Method Summary
 java.lang.String getContextPath()
          Returns the web application context path, e.g. "" (empty String) if the web application is the default web application (usually "ROOT"), or "/opencms" if the web application is called "opencms".
 java.lang.String getDefaultWebApplicationName()
          Returns the default web application name (usually "ROOT").
 CmsServletContainerSettings.CmsServletContainerCfgMode getMode()
          Returns the mode.
 java.lang.String getOpenCmsContext()
          Returns the OpenCms request context, e.g.
 java.lang.String getRequestErrorPageAttribute()
          Returns the request error page attribute.
 java.lang.String getServletContainerName()
          Returns the name of the servlet container running OpenCms.
 java.lang.String getServletPath()
          Returns the OpenCms servlet path, e.g.
 java.lang.String getWebApplicationName()
          Returns the OpenCms web application name, e.g.
 java.lang.String getWebApplicationRfsPath()
          Returns the OpenCms web application folder in the servlet container.
 java.lang.String getWebInfRfsPath()
          Returns the OpenCms web application "WEB-INF" directory path.
 boolean isPreventResponseFlush()
          Checks if the flex response has to prevent buffer flushing.
 boolean isReleaseTagsAfterEnd()
          Checks if the tags need to be released after ending.
static boolean isServletThrowsException()
          Checks if the servlet can throw an exception if initialization fails.
 void setMode(java.lang.String configValue)
          Sets the mode from the configuration.
 void setPreventResponseFlush(boolean preventResponseFlush)
          Sets if the flex response has to prevent buffer flushing.
 void setReleaseTagsAfterEnd(boolean releaseTagsAfterEnd)
          Sets if the tags need to be released after ending.
 void setRequestErrorPageAttribute(java.lang.String requestErrorPageAttribute)
          Sets the request error page attribute.
 void setServletThrowsException(boolean servletThrowsException)
          Sets if the servlet can throw an exception if initialization fails.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CFG_MODE_AUTO

public static final CmsServletContainerSettings.CmsServletContainerCfgMode CFG_MODE_AUTO
String remote command execution return type.


CFG_MODE_MANUAL

public static final CmsServletContainerSettings.CmsServletContainerCfgMode CFG_MODE_MANUAL
Map remote command execution return type.


CFG_MODE_NONE

public static final CmsServletContainerSettings.CmsServletContainerCfgMode CFG_MODE_NONE
List remote command execution return type.

Constructor Detail

CmsServletContainerSettings

public CmsServletContainerSettings(javax.servlet.ServletContext context)
Creates a new object.

Parameters:
context - used to find out specifics of the servlet container

CmsServletContainerSettings

protected CmsServletContainerSettings(java.lang.String webInfRfsPath,
                                      java.lang.String defaultWebApplication,
                                      java.lang.String servletMapping,
                                      java.lang.String servletContainerName,
                                      java.lang.String webApplicationContext)
Creates an instance based on the given values.

This is intended for CmsShell access.

Parameters:
webInfRfsPath - the OpenCms web application "WEB-INF" path in the "real" file system) to set
servletMapping - the OpenCms servlet mapping (e.g. "/opencms/*")
webApplicationContext - the name/path of the OpenCms web application context (optional, will be calculated form the path if null)
defaultWebApplication - the default web application name (usually "ROOT")
servletContainerName - the name of the servlet container running OpenCms
Method Detail

isServletThrowsException

public static boolean isServletThrowsException()
Checks if the servlet can throw an exception if initialization fails.

Returns:
true if the servlet can throw an exception if initialization fails

getContextPath

public java.lang.String getContextPath()
Returns the web application context path, e.g. "" (empty String) if the web application is the default web application (usually "ROOT"), or "/opencms" if the web application is called "opencms".

From the Java Servlet Specification v2.4:
Context Path: The path prefix associated with the ServletContext that this servlet is a part of. If this context is the "default" context rooted at the base of the web server's URL name space, this path will be an empty string. Otherwise, if the context is not rooted at the root of the server's name space, the path starts with a "/" character but does not end with a "/" character.

Returns:
the web application context path
See Also:
getWebApplicationName(), getServletPath(), getOpenCmsContext()

getDefaultWebApplicationName

public java.lang.String getDefaultWebApplicationName()
Returns the default web application name (usually "ROOT").

Returns:
the default web application name

getMode

public CmsServletContainerSettings.CmsServletContainerCfgMode getMode()
Returns the mode.

Returns:
the mode

getOpenCmsContext

public java.lang.String getOpenCmsContext()
Returns the OpenCms request context, e.g. "/opencms/opencms".

The OpenCms context will always start with a "/" and never have a trailing "/". The OpenCms context is identical to getContexPath() + getServletPath().

Returns:
the OpenCms request context, e.g. "/opencms/opencms"
See Also:
getContextPath(), getServletPath()

getRequestErrorPageAttribute

public java.lang.String getRequestErrorPageAttribute()
Returns the request error page attribute.

Returns:
the request error page attribute

getServletContainerName

public java.lang.String getServletContainerName()
Returns the name of the servlet container running OpenCms.

Returns:
the name of the servlet container running OpenCms

getServletPath

public java.lang.String getServletPath()
Returns the OpenCms servlet path, e.g. "/opencms".

From the Java Servlet Specification v2.4:
Servlet Path: The path section that directly corresponds to the mapping which activated this request. This path starts with a?/? character except in the case where the request is matched with the ?/*? pattern, in which case it is the empty string.

Returns:
the OpenCms servlet path
See Also:
getContextPath(), getWebApplicationName(), getOpenCmsContext()

getWebApplicationName

public java.lang.String getWebApplicationName()
Returns the OpenCms web application name, e.g. "opencms" or "ROOT" (no leading or trailing "/").

The web application name is stored for informational purposes only. If you want to construct an URI, use either getContextPath() and getServletPath(), or for links to the OpenCms VFS use getOpenCmsContext().

Returns:
the OpenCms web application name
See Also:
getContextPath(), getServletPath(), getOpenCmsContext()

getWebApplicationRfsPath

public java.lang.String getWebApplicationRfsPath()
Returns the OpenCms web application folder in the servlet container.

Returns:
the OpenCms web application folder in the servlet container

getWebInfRfsPath

public java.lang.String getWebInfRfsPath()
Returns the OpenCms web application "WEB-INF" directory path.

Returns:
the OpenCms web application "WEB-INF" directory path

isPreventResponseFlush

public boolean isPreventResponseFlush()
Checks if the flex response has to prevent buffer flushing.

Returns:
true if the flex response has to prevent buffer flushing

isReleaseTagsAfterEnd

public boolean isReleaseTagsAfterEnd()
Checks if the tags need to be released after ending.

Returns:
true if the tags need to be released after ending

setMode

public void setMode(java.lang.String configValue)
Sets the mode from the configuration.

Parameters:
configValue - the mode to set

setPreventResponseFlush

public void setPreventResponseFlush(boolean preventResponseFlush)
Sets if the flex response has to prevent buffer flushing.

Parameters:
preventResponseFlush - the flag to set

setReleaseTagsAfterEnd

public void setReleaseTagsAfterEnd(boolean releaseTagsAfterEnd)
Sets if the tags need to be released after ending.

Parameters:
releaseTagsAfterEnd - the flag to set

setRequestErrorPageAttribute

public void setRequestErrorPageAttribute(java.lang.String requestErrorPageAttribute)
Sets the request error page attribute.

Parameters:
requestErrorPageAttribute - the request error page attribute to set

setServletThrowsException

public void setServletThrowsException(boolean servletThrowsException)
Sets if the servlet can throw an exception if initialization fails.

Parameters:
servletThrowsException - the flag to set