Package lumis.portal.url
Class WebResourceDiscoveryFilter
- java.lang.Object
-
- lumis.portal.url.WebResourceDiscoveryFilter
-
- All Implemented Interfaces:
Filter
public class WebResourceDiscoveryFilter extends Object implements Filter
Detects the web resource for the a request. Stores the web resource as a request attribute for further access.- Since:
- 5.0.0
- Version:
- $Revision: 24571 $ $Date: 2021-07-01 18:47:19 -0300 (Thu, 01 Jul 2021) $
-
-
Field Summary
Fields Modifier and Type Field Description protected FilterConfig
filterConfig
This filter's configuration object.static String
SAFE_MODE_PATH
Safe mode path.static String
WEB_RESOURCE_ATTRIBUTE_NAME
The attribute name used to store web resource in the request.
-
Constructor Summary
Constructors Constructor Description WebResourceDiscoveryFilter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
void
doFilter(ServletRequest req, ServletResponse resp, FilterChain chain)
protected lumis.portal.url.RequestedURI
findRequestedURI(HttpServletRequest request)
Returns the URI information about the request.protected WebResource
findWebResource(HttpServletRequest request, WebsiteDiscoveryFilter.WebsiteRequest websiteRequest, HttpServletResponse response)
Returns the web resource for the given request.static String
getRequestedPath(HttpServletRequest request)
Returns the requested path, adjusted according to the destination web resource.static IRequestedURI
getRequestedURI(HttpServletRequest request)
Returns theIRequestedURI
for the given request.static WebResource
getWebResource(ServletRequest request)
Returns the web resource for the given request.void
init(FilterConfig filterConfig)
static void
redirectToLoginPage(HttpServletRequest request, HttpServletResponse response, int error)
Redirects to the login page.protected void
setSessionLocale(HttpServletRequest request, HttpServletResponse response, Locale locale)
Sets the given locale in user's session.
-
-
-
Field Detail
-
WEB_RESOURCE_ATTRIBUTE_NAME
public static final String WEB_RESOURCE_ATTRIBUTE_NAME
The attribute name used to store web resource in the request.- Since:
- 5.0.0
- See Also:
- Constant Field Values
-
SAFE_MODE_PATH
public static final String SAFE_MODE_PATH
Safe mode path.- Since:
- 6.2.0
- See Also:
- Constant Field Values
-
filterConfig
protected FilterConfig filterConfig
This filter's configuration object.- Since:
- 5.0.0
-
-
Method Detail
-
init
public void init(FilterConfig filterConfig) throws ServletException
- Specified by:
init
in interfaceFilter
- Throws:
ServletException
-
doFilter
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException
- Specified by:
doFilter
in interfaceFilter
- Throws:
IOException
ServletException
-
redirectToLoginPage
public static void redirectToLoginPage(HttpServletRequest request, HttpServletResponse response, int error) throws UnsupportedEncodingException, IOException
Redirects to the login page.- Parameters:
request
- the request.response
- the response.error
- theAccessError
constant to indicate error to show in login page.- Throws:
UnsupportedEncodingException
IOException
- Since:
- 7.1.0
-
findRequestedURI
protected lumis.portal.url.RequestedURI findRequestedURI(HttpServletRequest request) throws IOException, ServletException
Returns the URI information about the request.- Parameters:
request
- the request.- Returns:
- the requested URI information.
- Throws:
IOException
ServletException
- Since:
- 5.0.0
-
findWebResource
protected WebResource findWebResource(HttpServletRequest request, WebsiteDiscoveryFilter.WebsiteRequest websiteRequest, HttpServletResponse response) throws PortalException
Returns the web resource for the given request.- Parameters:
request
- the request.websiteRequest
- the website base URL for the request.response
- the response.- Returns:
- the web resource, or
null
if it was not found. - Throws:
PortalException
- Since:
- 6.2.0
-
setSessionLocale
protected void setSessionLocale(HttpServletRequest request, HttpServletResponse response, Locale locale)
Sets the given locale in user's session.- Parameters:
request
- the request.response
- the response.locale
- the locale.- Since:
- 8.1.0
-
getWebResource
public static WebResource getWebResource(ServletRequest request)
Returns the web resource for the given request.- Parameters:
request
- the request.- Returns:
- the web resource, or
null
if there is no web resource discovered for the request. - Since:
- 5.0.0
-
getRequestedURI
public static IRequestedURI getRequestedURI(HttpServletRequest request)
Returns theIRequestedURI
for the given request.- Parameters:
request
- the request.- Returns:
- the
IRequestedURI
for the given request. - Since:
- 8.0.0
-
getRequestedPath
public static String getRequestedPath(HttpServletRequest request)
Returns the requested path, adjusted according to the destination web resource.- Parameters:
request
- the request.- Returns:
- the path, or
null
if it not known. - Since:
- 5.0.0
-
-