Package com.microstrategy.web.controller
Class ResourceFeedController
- java.lang.Object
-
- com.microstrategy.web.controller.AppControllerImpl
-
- com.microstrategy.web.controller.ResourceFeedController
-
- All Implemented Interfaces:
AppController
public class ResourceFeedController extends AppControllerImpl
Controller for the ResourceFeed servlet- Since:
- MicroStrategy Web 9.0.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
INIT_PARAM_CONFIG_FILE
The path the the configuration filestatic java.lang.String
INIT_PARAM_DEFAULT_USER_AGENT
This is the name of the init parameter that will use the value of this parameter to set the User-Agent header if the caller is not a browserstatic java.lang.String
INIT_PARAM_PROXY_PORT
This is the name of the init parameter that refers to the HTTP proxy portstatic java.lang.String
INIT_PARAM_PROXY_URL
This is the name of the init parameter that refers to the HTTP proxy URLstatic java.lang.String
PARAM_TRANSFER_AUTH_HEADER
This is the name of the init parameter that indicates if the Authorization header is transferred.static java.lang.String
SET_STATUS_CODE_FROM_RESPONSE
This is to set the status code from the requested URL if the parameter value is set to true.
-
Constructor Summary
Constructors Constructor Description ResourceFeedController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
contentTypeMatch(java.lang.String contentType, java.lang.String contentTypeExpression)
Whether a content type is allowedprotected boolean
domainMatch(java.lang.String host, java.lang.String domainExpression)
Performs domain-match.void
errorAfterRedirect(RequestState reqState, java.lang.Exception e)
What to do if there is an error after we have redirected to the target page.java.lang.String
extractDomainName(java.lang.String url)
Extracts the domain part of a URLjava.lang.String
getBaseURL(ContainerServices cs)
The Base URL for this application.java.lang.String
getPage(RequestState reqState)
Get the relative path to the Page that should be displayed.void
initializeApp(ContainerServices cs)
Initialize the application.protected boolean
isValidContentType(java.lang.String contentType)
Determines whether a content type is valid based on the allowed content types on the security policy fileprotected boolean
isValidProtocol(java.lang.String protocol)
Determines whether a protocol is valid.protected boolean
isValidUrl(java.lang.String url)
Determines whether a URL is valid based on the domains on the security policy fileExternalSecurity
newExternalSecurity()
Creates a newExternalSecurity
object.RequestState
newRequestState()
Get a newRequestState
object to handle the incoming request.boolean
processRequest(RequestState reqState)
Process the incoming request.protected void
setProxySettings()
Set the proxy settings based on the config parametersINIT_PARAM_PROXY_URL
andINIT_PARAM_PROXY_PORT
protected boolean
skipHeader(java.lang.String key)
void
terminateApp()
Terminate the application.
-
-
-
Field Detail
-
INIT_PARAM_PROXY_URL
public static final java.lang.String INIT_PARAM_PROXY_URL
This is the name of the init parameter that refers to the HTTP proxy URL- See Also:
- Constant Field Values
-
INIT_PARAM_PROXY_PORT
public static final java.lang.String INIT_PARAM_PROXY_PORT
This is the name of the init parameter that refers to the HTTP proxy port- See Also:
- Constant Field Values
-
INIT_PARAM_DEFAULT_USER_AGENT
public static final java.lang.String INIT_PARAM_DEFAULT_USER_AGENT
This is the name of the init parameter that will use the value of this parameter to set the User-Agent header if the caller is not a browser- See Also:
- Constant Field Values
-
SET_STATUS_CODE_FROM_RESPONSE
public static final java.lang.String SET_STATUS_CODE_FROM_RESPONSE
This is to set the status code from the requested URL if the parameter value is set to true.- See Also:
- Constant Field Values
-
INIT_PARAM_CONFIG_FILE
public static final java.lang.String INIT_PARAM_CONFIG_FILE
The path the the configuration file- See Also:
- Constant Field Values
-
PARAM_TRANSFER_AUTH_HEADER
public static final java.lang.String PARAM_TRANSFER_AUTH_HEADER
This is the name of the init parameter that indicates if the Authorization header is transferred.- See Also:
- Constant Field Values
-
-
Method Detail
-
initializeApp
public void initializeApp(ContainerServices cs)
Initialize the application.- Parameters:
cs
- TheContainerServices
object to use to complete the initialization.
-
newRequestState
public RequestState newRequestState()
Get a newRequestState
object to handle the incoming request.- Returns:
- A new
RequestState
object to handle the incoming request.
-
processRequest
public boolean processRequest(RequestState reqState)
Process the incoming request.- Parameters:
reqState
- TheRequestState
object that holds per-request data.- Returns:
- True, if the request was handled; otherwise, false.
-
skipHeader
protected boolean skipHeader(java.lang.String key)
-
setProxySettings
protected void setProxySettings()
Set the proxy settings based on the config parametersINIT_PARAM_PROXY_URL
andINIT_PARAM_PROXY_PORT
-
isValidProtocol
protected boolean isValidProtocol(java.lang.String protocol)
Determines whether a protocol is valid. Default implementation only allows http and https requests.- Parameters:
protocol
- the protocol to evaluate- Returns:
- whether a URL is valid
-
isValidUrl
protected boolean isValidUrl(java.lang.String url)
Determines whether a URL is valid based on the domains on the security policy file- Parameters:
url
- the URL to evaluate- Returns:
- whether a URL is valid
-
isValidContentType
protected boolean isValidContentType(java.lang.String contentType)
Determines whether a content type is valid based on the allowed content types on the security policy file- Parameters:
contentType
- the content type to evaluate- Returns:
- whether a contentType is valid
-
domainMatch
protected boolean domainMatch(java.lang.String host, java.lang.String domainExpression)
Performs domain-match.Host A's name domain-matches host B's if their host name strings string-compare equal
- Parameters:
host
- host name where request is being sent to.domainExpression
- The domain expression read for the policy file- Returns:
- true if the specified host matches the given domainExpression.
-
contentTypeMatch
protected boolean contentTypeMatch(java.lang.String contentType, java.lang.String contentTypeExpression)
Whether a content type is allowedA content type is allowed if
- the expression equals '*'; or
- the content type contains the expression
- Parameters:
contentType
- the content typre returned by the requestcontentTypeExpression
- the expression read form the security policy file- Returns:
- Whether a content type is allowed
-
getPage
public java.lang.String getPage(RequestState reqState)
Get the relative path to the Page that should be displayed.- Parameters:
reqState
- TheRequestState
object that contains per-request data structures.- Returns:
- The path to the Page to internally redirect to.
-
errorAfterRedirect
public void errorAfterRedirect(RequestState reqState, java.lang.Exception e)
What to do if there is an error after we have redirected to the target page.- Parameters:
reqState
- TheRequestState
object that holds per-request data.e
- TheException
was raised.
-
getBaseURL
public java.lang.String getBaseURL(ContainerServices cs)
The Base URL for this application.- Parameters:
cs
- TheContainerServices
object that exposes a variety of services.- Returns:
- The base URL for this application.
-
newExternalSecurity
public ExternalSecurity newExternalSecurity()
Creates a newExternalSecurity
object.- Returns:
- A new
ExternalSecurity
object.
-
terminateApp
public void terminateApp()
Terminate the application.- Specified by:
terminateApp
in interfaceAppController
- Overrides:
terminateApp
in classAppControllerImpl
-
extractDomainName
public java.lang.String extractDomainName(java.lang.String url)
Extracts the domain part of a URL- Parameters:
url
- the URL- Returns:
- the domain part of a URL
-
-