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.StringINIT_PARAM_CONFIG_FILEThe path the the configuration filestatic java.lang.StringINIT_PARAM_DEFAULT_USER_AGENTThis 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.StringINIT_PARAM_PROXY_PORTThis is the name of the init parameter that refers to the HTTP proxy portstatic java.lang.StringINIT_PARAM_PROXY_URLThis is the name of the init parameter that refers to the HTTP proxy URLstatic java.lang.StringPARAM_TRANSFER_AUTH_HEADERThis is the name of the init parameter that indicates if the Authorization header is transferred.static java.lang.StringSET_STATUS_CODE_FROM_RESPONSEThis 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 booleancontentTypeMatch(java.lang.String contentType, java.lang.String contentTypeExpression)Whether a content type is allowedprotected booleandomainMatch(java.lang.String host, java.lang.String domainExpression)Performs domain-match.voiderrorAfterRedirect(RequestState reqState, java.lang.Exception e)What to do if there is an error after we have redirected to the target page.java.lang.StringextractDomainName(java.lang.String url)Extracts the domain part of a URLjava.lang.StringgetBaseURL(ContainerServices cs)The Base URL for this application.java.lang.StringgetPage(RequestState reqState)Get the relative path to the Page that should be displayed.voidinitializeApp(ContainerServices cs)Initialize the application.protected booleanisValidContentType(java.lang.String contentType)Determines whether a content type is valid based on the allowed content types on the security policy fileprotected booleanisValidProtocol(java.lang.String protocol)Determines whether a protocol is valid.protected booleanisValidUrl(java.lang.String url)Determines whether a URL is valid based on the domains on the security policy fileExternalSecuritynewExternalSecurity()Creates a newExternalSecurityobject.RequestStatenewRequestState()Get a newRequestStateobject to handle the incoming request.booleanprocessRequest(RequestState reqState)Process the incoming request.protected voidsetProxySettings()Set the proxy settings based on the config parametersINIT_PARAM_PROXY_URLandINIT_PARAM_PROXY_PORTprotected booleanskipHeader(java.lang.String key)voidterminateApp()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- TheContainerServicesobject to use to complete the initialization.
-
newRequestState
public RequestState newRequestState()
Get a newRequestStateobject to handle the incoming request.- Returns:
- A new
RequestStateobject to handle the incoming request.
-
processRequest
public boolean processRequest(RequestState reqState)
Process the incoming request.- Parameters:
reqState- TheRequestStateobject 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_URLandINIT_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- TheRequestStateobject 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- TheRequestStateobject that holds per-request data.e- TheExceptionwas raised.
-
getBaseURL
public java.lang.String getBaseURL(ContainerServices cs)
The Base URL for this application.- Parameters:
cs- TheContainerServicesobject that exposes a variety of services.- Returns:
- The base URL for this application.
-
newExternalSecurity
public ExternalSecurity newExternalSecurity()
Creates a newExternalSecurityobject.- Returns:
- A new
ExternalSecurityobject.
-
terminateApp
public void terminateApp()
Terminate the application.- Specified by:
terminateAppin interfaceAppController- Overrides:
terminateAppin 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
-
-