lumis.portal.url
Class WebResourceDiscoveryFilter

Package class diagram package WebResourceDiscoveryFilter
java.lang.Object
  extended by 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

Field Summary
protected  FilterConfig filterConfig
          This filter's configuration object.
 
Constructor Summary
WebResourceDiscoveryFilter()
           
 
Method Summary
 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)
          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 WebResource getWebResource(ServletRequest request)
          Returns the web resource for the given request.
 void init(FilterConfig filterConfig)
           
static void redirectToLoginPage(HttpServletRequest request, HttpServletResponse response, AccessDeniedException e)
          Redirects to the login page.
protected  boolean shouldRedirectPath(HttpServletRequest request, WebResource webResource)
          Checks if there is a need to perform a redirect to the web resource's path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filterConfig

protected FilterConfig filterConfig
This filter's configuration object.

Since:
5.0.0
Constructor Detail

WebResourceDiscoveryFilter

public WebResourceDiscoveryFilter()
Method Detail

init

public void init(FilterConfig filterConfig)
          throws ServletException
Specified by:
init in interface Filter
Throws:
ServletException

doFilter

public void doFilter(ServletRequest req,
                     ServletResponse resp,
                     FilterChain chain)
              throws IOException,
                     ServletException
Specified by:
doFilter in interface Filter
Throws:
IOException
ServletException

redirectToLoginPage

public static void redirectToLoginPage(HttpServletRequest request,
                                       HttpServletResponse response,
                                       AccessDeniedException e)
                                throws UnsupportedEncodingException,
                                       IOException
Redirects to the login page.

Parameters:
request - the request.
response - the response.
e - the thrown exception.
Throws:
UnsupportedEncodingException
IOException
Since:
6.2.0

findRequestedURI

protected lumis.portal.url.RequestedURI findRequestedURI(HttpServletRequest request)
Returns the URI information about the request.

Parameters:
request - the request.
Returns:
the requested URI information.
Since:
5.0.0

shouldRedirectPath

protected boolean shouldRedirectPath(HttpServletRequest request,
                                     WebResource webResource)
Checks if there is a need to perform a redirect to the web resource's path.

Parameters:
request - the request.
webResource - the web resource.
Returns:
true if the redirect should be done, false otherwise.
Since:
6.2.0

destroy

public void destroy()
Specified by:
destroy in interface Filter

findWebResource

protected WebResource findWebResource(HttpServletRequest request,
                                      WebsiteDiscoveryFilter.WebsiteRequest websiteRequest)
                               throws PortalException
Returns the web resource for the given request.

Parameters:
request - the request.
websiteRequest - the website base URL for the request.
Returns:
the web resource, or null if it was not found.
Throws:
PortalException
Since:
6.2.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

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


Lumisportal  6.2.0.120405 - Copyright © 2006–2012 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.