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 theContainerServicesinterface 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.DisconnectedContainerServicesand 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 voidaddCookieToResponse(GenericCookie cookie)This method associates a platform-independent Cookie with a response.java.lang.ObjectgetApplicationAttribute(java.lang.String name)This method returns the value of an Application Attribute.java.lang.StringgetApplicationPath()This method returns the application full path of the servletjava.lang.StringgetAppServerInfo()intgetCodePage()Returns an integer that represents the character formatting codepage.java.lang.StringgetContextPath()Returns the context path.java.lang.StringgetControllerName()protected HashListgetCookies(ContainerServicesNamespace namespace)ContainerStringCollectiongetCookieStrings()This method returns the contents of all Cookies as a collection of sub strings (as name/value pairs).ContainerStringCollectiongetCookieStrings(ContainerServicesNamespace namespace)This method returns the contents of all Cookies as a collection of sub strings (as name/value pairs).ContainerStringCollectiongetFormAndQueryStrings()This method returns the contents of the Form Data and Query String as a collection of sub strings (as name/value pairs).java.lang.StringgetHeaderValue(java.lang.String headerName)This method returns the value of the requested headerjava.lang.StringgetMethod()Return the request's method is post or getMultipartRequestgetMultipartRequest()Deprecated.this is only used internally by MicroStrategy methods, and may not be visible in future releasesjava.io.OutputStreamgetOutputStream()PostedFilegetPostedFile(java.lang.String name)Provides a way to access individual files that have been uploaded by a client.java.lang.StringgetQueryString()This method returns the entire Query String.java.lang.StringgetRealPath(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.StringgetRemoteAddress()This method returns the client IP addressjavax.servlet.http.HttpServletRequestgetRequest()This method retrieves the HttpServletRequest object associated with this class.java.lang.ObjectgetRequestAttribute(java.lang.String name)This method returns the value of a Request Attribute.java.lang.StringgetRequestServerName()This method returns the Web Server Name from the request objectjava.net.URLgetResource(java.lang.String relPath)Returns theURLassociated with the given resource path.java.io.InputStreamgetResourceAsStream(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.HttpServletResponsegetResponse()This method retrieves the HttpServletResponse object associated with this class.ContainerStringCollectiongetServerVariables()Returns a collection of server variables.javax.servlet.ServletConfiggetServletConfig()javax.servlet.ServletContextgetServletContext()This method retrieves the ServletContext object associated with this class.javax.servlet.http.HttpSessiongetSession()This method retrieves the HttpSession object associated with this class.java.lang.ObjectgetSessionAttribute(java.lang.String name)This method returns the value of a Session Attribute.java.lang.ObjectgetSessionAttribute(java.lang.String name, ContainerServicesNamespace namespace)This method returns the value of a Session Attribute.java.lang.StringgetSessionID()Returns HTTP session IDintgetSessionMaxIdleTime()Returns the maximum time interval, in seconds, that the container will keep this session open between client accesses.ContainerStringCollectiongetSessionStrings()This method returns the contents of the Session Variables as a collection of sub strings (as name/value pairs).ContainerStringCollectiongetSessionStrings(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.intgetStatusCode()Returns the HTTP Status code specified for this response.booleanhasOutputStream()voidinvalidateHttpSession()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 partbooleanisJavaURLSessionSupported()Indicates if the instance of this container services supports cookieless environmentsbooleanisRequestSecure()Returns a boolean indicating whether this request was made using a secure channel, such as HTTPSbooleanisSessionlessRequest()Does the request has a pre-established session id.voidsendBinaryContent(MarkupOutput mo)Outputs binary content of the MarkupOutputbooleansendError(int sc)Sends an error response to the client using the specified status code.booleansendError(int sc, java.lang.String msg)Sends an error response to the client using the specified status code.voidsetApplicationAttribute(java.lang.String name, java.lang.Object value)This method sets the value of a Application Attribute.voidsetCodePage(int code)Sets the code page, an integer representing the character formatting.voidsetContentType(java.lang.String type)Stes HTTP response content typevoidsetHeaderValue(java.lang.String name, java.lang.String value)Sets HTTP response headervoidsetJavaURLSessionSupported(boolean value)Sets if the instance of this container services supports cookieless environmentsvoidsetRequest(javax.servlet.http.HttpServletRequest request)This method sets the HttpServletRequest object which is to be associated with this class.voidsetRequestAttribute(java.lang.String name, java.lang.Object value)This method sets the value of a Request Attribute.voidsetResponse(javax.servlet.http.HttpServletResponse response)This method sets the HttpServletResponse object which is to be associated with this class.voidsetServletConfig(javax.servlet.ServletConfig newValue)voidsetServletContext(javax.servlet.ServletContext servletContext)This method sets the ServletContext object which is to be associated with this class.voidsetSession(javax.servlet.http.HttpSession session)This method sets the HttpSession object which is to be associated with this class.voidsetSessionAttribute(java.lang.String name, java.lang.Object value)This method sets the value of a Session Attribute.voidsetSessionAttribute(java.lang.String name, java.lang.Object value, ContainerServicesNamespace namespace)This method sets the value of a Session Attribute in the given namespace.voidsetStatusCode(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:ContainerServicesThis method returns the client IP address- Returns:
- A
Stringwith the value of the client IP address
-
getRealPath
public java.lang.String getRealPath(java.lang.String relPath)
Description copied from interface:ContainerServicesContextThis 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- AStringthat indicates the relative path of the file.- Returns:
- A
Stringthat 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:ContainerServicesContextThis 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- AStringthat indicates the relative path of the file.- Returns:
- A
InputStreamthat contains the contents of the specified file.
-
getQueryString
public java.lang.String getQueryString()
Description copied from interface:ContainerServicesThis method returns the entire Query String.- Returns:
- A
Stringthat contains the contents of the Query String.
-
getHeaderValue
public java.lang.String getHeaderValue(java.lang.String headerName)
Description copied from interface:ContainerServicesThis method returns the value of the requested header- Parameters:
headerName- AStringwith the name of the header to search for- Returns:
- A
Stringwith 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:ContainerServicesThis 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
Objectrepresenting the value of a named attribute.
-
setRequestAttribute
public void setRequestAttribute(java.lang.String name, java.lang.Object value)Description copied from interface:ContainerServicesThis 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- AStringwhich identifies the name of the attribute.value- AnObjectrepresenting the value of a named attribute.
-
setSessionAttribute
public void setSessionAttribute(java.lang.String name, java.lang.Object value)Description copied from interface:ContainerServicesThis 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- AStringwhich identifies the name of the attribute.value- AnObjectrepresenting the value of a named attribute.
-
setSessionAttribute
public void setSessionAttribute(java.lang.String name, java.lang.Object value, ContainerServicesNamespace namespace)Description copied from interface:ContainerServicesThis 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- AStringwhich identifies the name of the attribute.value- AnObjectrepresenting the value of a named attribute.namespace- AContainerServicesNamespaceobject 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:ContainerServicesThis method returns the contents of all Cookies as a collection of sub strings (as name/value pairs).- Parameters:
namespace- AContainerServicesNamespaceobject representing the namespace requirement. If null, no namespace is used.- Returns:
- A
ContainerStringCollectionobject. - Since:
- MicroStrategy Web 8.0.2
-
getCookieStrings
public ContainerStringCollection getCookieStrings()
Description copied from interface:ContainerServicesThis method returns the contents of all Cookies as a collection of sub strings (as name/value pairs).- Returns:
- A
ContainerStringCollectionobject.
-
getFormAndQueryStrings
public ContainerStringCollection getFormAndQueryStrings()
Description copied from interface:ContainerServicesThis method returns the contents of the Form Data and Query String as a collection of sub strings (as name/value pairs).- Returns:
- A
ContainerStringCollectionobject.
-
getSessionStrings
public ContainerStringCollection getSessionStrings(ContainerServicesNamespace namespace)
Description copied from interface:ContainerServicesThis 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- AContainerServicesNamespaceobject representing the namespace requirement.- Returns:
- A
ContainerStringCollectionobject. - Since:
- MicroStrategy Web 8.0.2
-
getSessionStrings
public ContainerStringCollection getSessionStrings()
Description copied from interface:ContainerServicesThis 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
ContainerStringCollectionobject.
-
addCookieToResponse
public void addCookieToResponse(GenericCookie cookie)
Description copied from interface:ContainerServicesThis 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- TheGenericCookieto 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:ContainerServicesProvides 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:ContainerServicesThis method returns the Web Server Name from the request object- Returns:
- A
Stringthat 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:ContainerServicesReturns HTTP session ID- Returns:
- HTTP session ID
-
getControllerName
public java.lang.String getControllerName()
- Specified by:
getControllerNamein classAbstractConfigurableContainerServices- Since:
- MicroStrategy Web 9.0.0
-
sendBinaryContent
public void sendBinaryContent(MarkupOutput mo)
Description copied from interface:ContainerServicesOutputs 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:ContainerServicesSets 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
Stringthat 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:ContainerServicesStes HTTP response content type- Parameters:
type- content type
-
getCodePage
public int getCodePage()
Description copied from interface:ContainerServicesReturns 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:ContainerServicesSets 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
HttpServletRequestobject.
-
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- AHttpServletRequestobject.
-
getResponse
public javax.servlet.http.HttpServletResponse getResponse()
This method retrieves the HttpServletResponse object associated with this class.- Returns:
- A
HttpServletResponseobject.
-
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- AHttpServletResponseobject.
-
getServletContext
public javax.servlet.ServletContext getServletContext()
This method retrieves the ServletContext object associated with this class.- Returns:
- A
ServletContextobject.
-
setServletContext
public void setServletContext(javax.servlet.ServletContext servletContext)
This method sets the ServletContext object which is to be associated with this class.- Parameters:
servletContext- AServletContextobject.
-
getSession
public javax.servlet.http.HttpSession getSession()
This method retrieves the HttpSession object associated with this class.- Returns:
- A
HttpSessionobject.
-
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- AHttpSessionobject.
-
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:ContainerServicesThis 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
Objectrepresenting the value of a named session attribute.
-
getSessionAttribute
public java.lang.Object getSessionAttribute(java.lang.String name, ContainerServicesNamespace namespace)Description copied from interface:ContainerServicesThis 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
Objectrepresenting 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:ContainerServicesThis method returns the value of an Application Attribute.- Parameters:
name- the name of an attribute.- Returns:
- An
Objectrepresenting the value of a named application attribute.
-
setApplicationAttribute
public void setApplicationAttribute(java.lang.String name, java.lang.Object value)Description copied from interface:ContainerServicesThis method sets the value of a Application Attribute.- Parameters:
name- AStringwhich identifies the name of the attribute.value- AnObjectrepresenting the value of a named attribute.
-
sendError
public boolean sendError(int sc)
Description copied from interface:ContainerServicesSends 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:
trueto indicate this action succeeded.falseto indicate error in performing this action.
-
sendError
public boolean sendError(int sc, java.lang.String msg)Description copied from interface:ContainerServicesSends an error response to the client using the specified status code.- Parameters:
sc- The errror status code.msg- The error message.- Returns:
trueto indicate this action succeeded.falseto 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-trueif cookieless environment is supported
-
getServerVariables
public ContainerStringCollection getServerVariables()
Description copied from interface:ContainerServicesReturns 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:ContainerServicesReturns 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:ContainerServicesSets 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:
getCookiesin 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:ContainerServicesReturns 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:ContainerServicesContextReturns theURLassociated 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 manyURLimplementations 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:ContainerServicesContextReturns 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:ContainerServicesContextReturns 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:ContainerServicesDoes the request has a pre-established session id.
-
invalidateHttpSession
public void invalidateHttpSession()
Description copied from interface:ContainerServicesIf 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:ContainerServicesReturn the request's method is post or get
-
getSessionMaxIdleTime
public int getSessionMaxIdleTime()
Description copied from interface:ContainerServicesReturns the maximum time interval, in seconds, that the container will keep this session open between client accesses.
-
-