Package com.microstrategy.web.platform
Class HttpServletContainerServices
- java.lang.Object
-
- com.microstrategy.web.platform.AbstractConfigurableContainerServices
-
- com.microstrategy.web.platform.HttpServletContainerServices
-
- All Implemented Interfaces:
ContainerServices
,ContainerServicesContext
- Direct Known Subclasses:
ServletContainerServices
public class HttpServletContainerServices extends AbstractConfigurableContainerServices
This is the implementation class for theContainerServices
interface when application is running in the Java Web Container environment.This class should ONLY be called and known to by the Main Servlet class and the Tag Libaries.
In the ASPx environment, Web applications should implement another interface
From the perspective of the Web Application Data layer and all other layers which require platform independence, this class should be completely transparent and hidden.DisconnectedContainerServices
and are encouraged to extend the reference implementationDisconnectedContainerServicesImpl
.- Since:
- MicroStrategy Web 9.3.2
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.microstrategy.web.platform.AbstractConfigurableContainerServices
AbstractConfigurableContainerServices.AbstractContainerStringCollection, AbstractConfigurableContainerServices.CookieWrapper
-
-
Field Summary
-
Fields inherited from class com.microstrategy.web.platform.AbstractConfigurableContainerServices
_prependSlashToResource, APPLICATION_PARAMETERS_XML_PATH, WEB_XML_PATH
-
Fields inherited from interface com.microstrategy.web.platform.ContainerServices
SPNEGO_CREDENTIAL
-
-
Constructor Summary
Constructors Constructor Description HttpServletContainerServices()
Creates a new ServletContainerServices object.HttpServletContainerServices(boolean hasOutputStream)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addCookieToResponse(GenericCookie cookie)
This method associates a platform-independent Cookie with a response.java.lang.Object
getApplicationAttribute(java.lang.String name)
This method returns the value of an Application Attribute.java.lang.String
getApplicationPath()
This method returns the application full path of the servletjava.lang.String
getAppServerInfo()
int
getCodePage()
Returns an integer that represents the character formatting codepage.java.lang.String
getContextPath()
Returns the context path.java.lang.String
getControllerName()
protected HashList
getCookies(ContainerServicesNamespace namespace)
ContainerStringCollection
getCookieStrings()
This method returns the contents of all Cookies as a collection of sub strings (as name/value pairs).ContainerStringCollection
getCookieStrings(ContainerServicesNamespace namespace)
This method returns the contents of all Cookies as a collection of sub strings (as name/value pairs).ContainerStringCollection
getFormAndQueryStrings()
This method returns the contents of the Form Data and Query String as a collection of sub strings (as name/value pairs).java.lang.String
getHeaderValue(java.lang.String headerName)
This method returns the value of the requested headerjava.lang.String
getMethod()
Return the request's method is post or getMultipartRequest
getMultipartRequest()
Deprecated.this is only used internally by MicroStrategy methods, and may not be visible in future releasesjava.io.OutputStream
getOutputStream()
PostedFile
getPostedFile(java.lang.String name)
Provides a way to access individual files that have been uploaded by a client.java.lang.String
getQueryString()
This method returns the entire Query String.java.lang.String
getRealPath(java.lang.String relPath)
This is a low level API call to the outside world - it returns the real path to a server-side resource.java.lang.String
getRemoteAddress()
This method returns the client IP addressjavax.servlet.http.HttpServletRequest
getRequest()
This method retrieves the HttpServletRequest object associated with this class.java.lang.Object
getRequestAttribute(java.lang.String name)
This method returns the value of a Request Attribute.java.lang.String
getRequestServerName()
This method returns the Web Server Name from the request objectjava.net.URL
getResource(java.lang.String relPath)
Returns theURL
associated with the given resource path.java.io.InputStream
getResourceAsStream(java.lang.String relPath)
This method returns the contents of a file resource relative to the web application as an input stream.java.util.Set<java.lang.String>
getResourcePaths(java.lang.String relPath)
Returns a directory path strings of all the paths to resources within the application whose longest sub-path matches the supplied path.javax.servlet.http.HttpServletResponse
getResponse()
This method retrieves the HttpServletResponse object associated with this class.ContainerStringCollection
getServerVariables()
Returns a collection of server variables.javax.servlet.ServletConfig
getServletConfig()
javax.servlet.ServletContext
getServletContext()
This method retrieves the ServletContext object associated with this class.javax.servlet.http.HttpSession
getSession()
This method retrieves the HttpSession object associated with this class.java.lang.Object
getSessionAttribute(java.lang.String name)
This method returns the value of a Session Attribute.java.lang.Object
getSessionAttribute(java.lang.String name, ContainerServicesNamespace namespace)
This method returns the value of a Session Attribute.java.lang.String
getSessionID()
Returns HTTP session IDint
getSessionMaxIdleTime()
Returns the maximum time interval, in seconds, that the container will keep this session open between client accesses.ContainerStringCollection
getSessionStrings()
This method returns the contents of the Session Variables as a collection of sub strings (as name/value pairs).ContainerStringCollection
getSessionStrings(ContainerServicesNamespace namespace)
This method returns the contents of the Session Variables as a collection of sub strings (as name/value pairs) from the namespace specified.int
getStatusCode()
Returns the HTTP Status code specified for this response.boolean
hasOutputStream()
void
invalidateHttpSession()
If the security preference is selected, invalidate and create new http session in jsp part set a flag to show whether a new session need to be created in asp partboolean
isJavaURLSessionSupported()
Indicates if the instance of this container services supports cookieless environmentsboolean
isRequestSecure()
Returns a boolean indicating whether this request was made using a secure channel, such as HTTPSboolean
isSessionlessRequest()
Does the request has a pre-established session id.void
sendBinaryContent(MarkupOutput mo)
Outputs binary content of the MarkupOutputboolean
sendError(int sc)
Sends an error response to the client using the specified status code.boolean
sendError(int sc, java.lang.String msg)
Sends an error response to the client using the specified status code.void
setApplicationAttribute(java.lang.String name, java.lang.Object value)
This method sets the value of a Application Attribute.void
setCodePage(int code)
Sets the code page, an integer representing the character formatting.void
setContentType(java.lang.String type)
Stes HTTP response content typevoid
setHeaderValue(java.lang.String name, java.lang.String value)
Sets HTTP response headervoid
setJavaURLSessionSupported(boolean value)
Sets if the instance of this container services supports cookieless environmentsvoid
setRequest(javax.servlet.http.HttpServletRequest request)
This method sets the HttpServletRequest object which is to be associated with this class.void
setRequestAttribute(java.lang.String name, java.lang.Object value)
This method sets the value of a Request Attribute.void
setResponse(javax.servlet.http.HttpServletResponse response)
This method sets the HttpServletResponse object which is to be associated with this class.void
setServletConfig(javax.servlet.ServletConfig newValue)
void
setServletContext(javax.servlet.ServletContext servletContext)
This method sets the ServletContext object which is to be associated with this class.void
setSession(javax.servlet.http.HttpSession session)
This method sets the HttpSession object which is to be associated with this class.void
setSessionAttribute(java.lang.String name, java.lang.Object value)
This method sets the value of a Session Attribute.void
setSessionAttribute(java.lang.String name, java.lang.Object value, ContainerServicesNamespace namespace)
This method sets the value of a Session Attribute in the given namespace.void
setStatusCode(int statusCode)
Sets the HTTP Status code specified for this response.-
Methods inherited from class com.microstrategy.web.platform.AbstractConfigurableContainerServices
decrypt, encrypt, getApplicationParameters, getControllerParameter, getCookie, getCookie, getCookieNamespace, getCookieNamespaceCapacity, getInitParameter, getInitParameterNames, getNamespacePrefix, getNamespaceValue, getRealName, getSessionNamespace, getSessionNamespaceCapacity, initFromPropertiesFile, initGlobalObjects, isEncryptedByRedirect, isEncryptedParameter, isNamespacedName, isQueryParam, newCookie, newCookie, newHiddenInputParameterBuilder, newNamespaceEncoder, newURIParameterBuilder, useNamespace, useNamespaceInCookie
-
-
-
-
Method Detail
-
getRemoteAddress
public java.lang.String getRemoteAddress()
Description copied from interface:ContainerServices
This method returns the client IP address- Returns:
- A
String
with the value of the client IP address
-
getRealPath
public java.lang.String getRealPath(java.lang.String relPath)
Description copied from interface:ContainerServicesContext
This is a low level API call to the outside world - it returns the real path to a server-side resource. Exactly what is returned depends upon the underlying implementation. Note that this may be null if the path is inside an archived file. This call doesn't feature resource caching or MicroStrategy Web application's custom prefix (i.e. ABSOLUTE and RELATIVE) handling. UsingFileLoader.getRealPath(String)
may be more appropriate.- Parameters:
relPath
- AString
that indicates the relative path of the file.- Returns:
- A
String
that indicates the full path of the file. - See Also:
FileLoader.getRealPath(String)
-
getResourceAsStream
public java.io.InputStream getResourceAsStream(java.lang.String relPath)
Description copied from interface:ContainerServicesContext
This method returns the contents of a file resource relative to the web application as an input stream.This is ONLY required to support the Java environment, and in particular, only those Java environments where the WAR file is not expanded. This should return NULL in an ASP environment.
- Parameters:
relPath
- AString
that indicates the relative path of the file.- Returns:
- A
InputStream
that contains the contents of the specified file.
-
getQueryString
public java.lang.String getQueryString()
Description copied from interface:ContainerServices
This method returns the entire Query String.- Returns:
- A
String
that contains the contents of the Query String.
-
getHeaderValue
public java.lang.String getHeaderValue(java.lang.String headerName)
Description copied from interface:ContainerServices
This method returns the value of the requested header- Parameters:
headerName
- AString
with the name of the header to search for- Returns:
- A
String
with the value of the header requested. If the header was not found, it shall return a null value.
-
getRequestAttribute
public java.lang.Object getRequestAttribute(java.lang.String name)
Description copied from interface:ContainerServices
This method returns the value of a Request Attribute. In Java, there is a clear distinction between Request and Session variables. In ASP, the two are combined as there is not a similar concept.- Parameters:
name
- the name of an attribute.- Returns:
- An
Object
representing the value of a named attribute.
-
setRequestAttribute
public void setRequestAttribute(java.lang.String name, java.lang.Object value)
Description copied from interface:ContainerServices
This method sets the value of a Request Attribute. In Java, there is a clear distinction between Request and Session variables. In ASP, the two are combined as there is not a similar concept.- Parameters:
name
- AString
which identifies the name of the attribute.value
- AnObject
representing the value of a named attribute.
-
setSessionAttribute
public void setSessionAttribute(java.lang.String name, java.lang.Object value)
Description copied from interface:ContainerServices
This method sets the value of a Session Attribute. In Java, there is a clear distinction between Request and Session variables. In ASP, the two are combined as there is not a similar concept.- Parameters:
name
- AString
which identifies the name of the attribute.value
- AnObject
representing the value of a named attribute.
-
setSessionAttribute
public void setSessionAttribute(java.lang.String name, java.lang.Object value, ContainerServicesNamespace namespace)
Description copied from interface:ContainerServices
This method sets the value of a Session Attribute in the given namespace. In Java, there is a clear distinction between Request and Session variables. In ASP, the two are combined as there is not a similar concept.- Parameters:
name
- AString
which identifies the name of the attribute.value
- AnObject
representing the value of a named attribute.namespace
- AContainerServicesNamespace
object representing the namespace requirement. If null, no namespace is used.- Since:
- MicroStrategy Web 8.0.2
-
getCookieStrings
public ContainerStringCollection getCookieStrings(ContainerServicesNamespace namespace)
Description copied from interface:ContainerServices
This method returns the contents of all Cookies as a collection of sub strings (as name/value pairs).- Parameters:
namespace
- AContainerServicesNamespace
object representing the namespace requirement. If null, no namespace is used.- Returns:
- A
ContainerStringCollection
object. - Since:
- MicroStrategy Web 8.0.2
-
getCookieStrings
public ContainerStringCollection getCookieStrings()
Description copied from interface:ContainerServices
This method returns the contents of all Cookies as a collection of sub strings (as name/value pairs).- Returns:
- A
ContainerStringCollection
object.
-
getFormAndQueryStrings
public ContainerStringCollection getFormAndQueryStrings()
Description copied from interface:ContainerServices
This method returns the contents of the Form Data and Query String as a collection of sub strings (as name/value pairs).- Returns:
- A
ContainerStringCollection
object.
-
getSessionStrings
public ContainerStringCollection getSessionStrings(ContainerServicesNamespace namespace)
Description copied from interface:ContainerServices
This method returns the contents of the Session Variables as a collection of sub strings (as name/value pairs) from the namespace specified. Only those session variables that return values of type String are considered.- Parameters:
namespace
- AContainerServicesNamespace
object representing the namespace requirement.- Returns:
- A
ContainerStringCollection
object. - Since:
- MicroStrategy Web 8.0.2
-
getSessionStrings
public ContainerStringCollection getSessionStrings()
Description copied from interface:ContainerServices
This method returns the contents of the Session Variables as a collection of sub strings (as name/value pairs). Only those session variables that return values of type String are considered.- Returns:
- A
ContainerStringCollection
object.
-
addCookieToResponse
public void addCookieToResponse(GenericCookie cookie)
Description copied from interface:ContainerServices
This method associates a platform-independent Cookie with a response. When the response is sent back to the client, it will contain this cookie.- Parameters:
cookie
- TheGenericCookie
to be added to the Response.
-
getMultipartRequest
public MultipartRequest getMultipartRequest()
Deprecated.this is only used internally by MicroStrategy methods, and may not be visible in future releases
-
getPostedFile
public PostedFile getPostedFile(java.lang.String name)
Description copied from interface:ContainerServices
Provides a way to access individual files that have been uploaded by a client.- Parameters:
name
- a name of posted file- Returns:
- a posted file
-
getRequestServerName
public java.lang.String getRequestServerName()
Description copied from interface:ContainerServices
This method returns the Web Server Name from the request object- Returns:
- A
String
that indicates the Web Server Name. (i.e. if you access the web server with the URL which reads as http://localhost:8080/MicroStrategy/servlet then this method will return "localhost" as the web server name. If you access the webserver with the URL which reads as http://machine1:8080/MicroStrategy/servlet then this method will return "machine1" as the web server name.
-
getSessionID
public java.lang.String getSessionID()
Description copied from interface:ContainerServices
Returns HTTP session ID- Returns:
- HTTP session ID
-
getControllerName
public java.lang.String getControllerName()
- Specified by:
getControllerName
in classAbstractConfigurableContainerServices
- Since:
- MicroStrategy Web 9.0.0
-
sendBinaryContent
public void sendBinaryContent(MarkupOutput mo)
Description copied from interface:ContainerServices
Outputs binary content of the MarkupOutput- Parameters:
mo
- markup outpu containing binary image
-
setHeaderValue
public void setHeaderValue(java.lang.String name, java.lang.String value)
Description copied from interface:ContainerServices
Sets HTTP response header- Parameters:
name
- header namevalue
- header value
-
getApplicationPath
public java.lang.String getApplicationPath()
This method returns the application full path of the servlet- Returns:
- A
String
that indicates the full application path of the servlet. (i.e. http://localhost:8080/MicroStrategy/servlet/)
-
setContentType
public void setContentType(java.lang.String type)
Description copied from interface:ContainerServices
Stes HTTP response content type- Parameters:
type
- content type
-
getCodePage
public int getCodePage()
Description copied from interface:ContainerServices
Returns an integer that represents the character formatting codepage. The CodePage property specifies how literal (static) strings are encoded in a Web page. A codepage is a character set that can include numbers, punctuation marks, and other glyphs. Codepages are not the same for each language. Some languages have multi-byte characters, while others only need one byte to represent each character.- Returns:
- an integer that represents the character formatting codepage.
-
setCodePage
public void setCodePage(int code)
Description copied from interface:ContainerServices
Sets the code page, an integer representing the character formatting. The CodePage property specifies how literal (static) strings are encoded in a Web page. A codepage is a character set that can include numbers, punctuation marks, and other glyphs. Codepages are not the same for each language. Some languages have multi-byte characters, while others only need one byte to represent each character.- Parameters:
code
- an integer that represents the character formatting codepage.
-
getRequest
public javax.servlet.http.HttpServletRequest getRequest()
This method retrieves the HttpServletRequest object associated with this class.- Returns:
- A
HttpServletRequest
object.
-
setRequest
public void setRequest(javax.servlet.http.HttpServletRequest request)
This method sets the HttpServletRequest object which is to be associated with this class.- Parameters:
request
- AHttpServletRequest
object.
-
getResponse
public javax.servlet.http.HttpServletResponse getResponse()
This method retrieves the HttpServletResponse object associated with this class.- Returns:
- A
HttpServletResponse
object.
-
setResponse
public void setResponse(javax.servlet.http.HttpServletResponse response)
This method sets the HttpServletResponse object which is to be associated with this class.- Parameters:
response
- AHttpServletResponse
object.
-
getServletContext
public javax.servlet.ServletContext getServletContext()
This method retrieves the ServletContext object associated with this class.- Returns:
- A
ServletContext
object.
-
setServletContext
public void setServletContext(javax.servlet.ServletContext servletContext)
This method sets the ServletContext object which is to be associated with this class.- Parameters:
servletContext
- AServletContext
object.
-
getSession
public javax.servlet.http.HttpSession getSession()
This method retrieves the HttpSession object associated with this class.- Returns:
- A
HttpSession
object.
-
setSession
public void setSession(javax.servlet.http.HttpSession session)
This method sets the HttpSession object which is to be associated with this class.- Parameters:
session
- AHttpSession
object.
-
getServletConfig
public javax.servlet.ServletConfig getServletConfig()
-
setServletConfig
public void setServletConfig(javax.servlet.ServletConfig newValue)
-
getSessionAttribute
public java.lang.Object getSessionAttribute(java.lang.String name)
Description copied from interface:ContainerServices
This method returns the value of a Session Attribute. In Java, there is a clear distinction between Request and Session variables. In ASP, the two are combined as there is not a similar concept.- Parameters:
name
- the name of an attribute.- Returns:
- An
Object
representing the value of a named session attribute.
-
getSessionAttribute
public java.lang.Object getSessionAttribute(java.lang.String name, ContainerServicesNamespace namespace)
Description copied from interface:ContainerServices
This method returns the value of a Session Attribute. In Java, there is a clear distinction between Request and Session variables. In ASP, the two are combined as there is not a similar concept.- Parameters:
name
- the name of an attribute.namespace
- the name of the URL parameter that privides the namespace name.- Returns:
- An
Object
representing the value of a named session attribute. - Since:
- MicroStrategy Web 8.0.2
-
getApplicationAttribute
public java.lang.Object getApplicationAttribute(java.lang.String name)
Description copied from interface:ContainerServices
This method returns the value of an Application Attribute.- Parameters:
name
- the name of an attribute.- Returns:
- An
Object
representing the value of a named application attribute.
-
setApplicationAttribute
public void setApplicationAttribute(java.lang.String name, java.lang.Object value)
Description copied from interface:ContainerServices
This method sets the value of a Application Attribute.- Parameters:
name
- AString
which identifies the name of the attribute.value
- AnObject
representing the value of a named attribute.
-
sendError
public boolean sendError(int sc)
Description copied from interface:ContainerServices
Sends an error response to the client using the specified status code.- Parameters:
sc
- The status errror code. We reuse HTTP status code "OK" (200) to mean no error, so please do not use it for any error status.- Returns:
true
to indicate this action succeeded.false
to indicate error in performing this action.
-
sendError
public boolean sendError(int sc, java.lang.String msg)
Description copied from interface:ContainerServices
Sends an error response to the client using the specified status code.- Parameters:
sc
- The errror status code.msg
- The error message.- Returns:
true
to indicate this action succeeded.false
to indicate error in performing this action.
-
isJavaURLSessionSupported
public boolean isJavaURLSessionSupported()
Indicates if the instance of this container services supports cookieless environments- Returns:
- true if cookieless environments are supported
-
setJavaURLSessionSupported
public void setJavaURLSessionSupported(boolean value)
Sets if the instance of this container services supports cookieless environments- Parameters:
value
-true
if cookieless environment is supported
-
getServerVariables
public ContainerStringCollection getServerVariables()
Description copied from interface:ContainerServices
Returns a collection of server variables.- Returns:
- a collection of server variables.
- Since:
- MicroStrategy Web 7.5.4
-
getStatusCode
public int getStatusCode()
Description copied from interface:ContainerServices
Returns the HTTP Status code specified for this response.- Returns:
- The HTTP Status code specified for this response.
- Since:
- MicroStrategy Web 9.0.0
-
setStatusCode
public void setStatusCode(int statusCode)
Description copied from interface:ContainerServices
Sets the HTTP Status code specified for this response.- Parameters:
statusCode
- the HTTP Status code specified for this response.- Since:
- MicroStrategy Web 9.0.0
-
getCookies
protected HashList getCookies(ContainerServicesNamespace namespace)
- Specified by:
getCookies
in classAbstractConfigurableContainerServices
- Since:
- MicroStrategy Web 8.0.2
-
getOutputStream
public java.io.OutputStream getOutputStream()
- Since:
- MicroStrategy Web 9.0.0
-
hasOutputStream
public boolean hasOutputStream()
- Since:
- MicroStrategy Web 9.0.0
-
isRequestSecure
public boolean isRequestSecure()
Description copied from interface:ContainerServices
Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS- Since:
- MicroStrategy Web 9.0.0
-
getResource
public java.net.URL getResource(java.lang.String relPath)
Description copied from interface:ContainerServicesContext
Returns theURL
associated with the given resource path. If the resource does not exist, null is returned (i.e. it cannot return a path to a newFile
). Note that manyURL
implementations are read-only.- Parameters:
relPath
- relative path.- Returns:
- URL associated with given path.
- Since:
- MicroStrategy Web 9.0.0
-
getResourcePaths
public java.util.Set<java.lang.String> getResourcePaths(java.lang.String relPath)
Description copied from interface:ContainerServicesContext
Returns a directory path strings of all the paths to resources within the application whose longest sub-path matches the supplied path.- Parameters:
relPath
- sub-path to match- Returns:
- Set
of directory paths - Since:
- MicroStrategy Web 9.0.0
-
getAppServerInfo
public java.lang.String getAppServerInfo()
- Since:
- MicroStrategy Web 9.0.0
-
getContextPath
public java.lang.String getContextPath()
Description copied from interface:ContainerServicesContext
Returns the context path. In the out of the box Web application deployment, this is usually "/MicroStrategy". Note that subclasses can override this implementation to return different context paths.- Returns:
- the context path.
- Since:
- MicroStrategy Web 9.0.1
-
isSessionlessRequest
public boolean isSessionlessRequest()
Description copied from interface:ContainerServices
Does the request has a pre-established session id.
-
invalidateHttpSession
public void invalidateHttpSession()
Description copied from interface:ContainerServices
If the security preference is selected, invalidate and create new http session in jsp part set a flag to show whether a new session need to be created in asp part
-
getMethod
public java.lang.String getMethod()
Description copied from interface:ContainerServices
Return the request's method is post or get
-
getSessionMaxIdleTime
public int getSessionMaxIdleTime()
Description copied from interface:ContainerServices
Returns the maximum time interval, in seconds, that the container will keep this session open between client accesses.
-
-