Package com.zfabrik.util.microweb
Class MicroWebFilter
java.lang.Object
com.zfabrik.util.microweb.MicroWebFilter
- All Implemented Interfaces:
javax.servlet.Filter
All this filter does is to check wether an action should be executed for this
request. If so, it will call the action. The outcome of that action
determines where to go next.
Actions are determined by the path information of the request URL. It will be
cut into segments and actions will be applied according to a longest match
pattern.
The relevant URL can be obtained via
MicroWebUtil#getRelevantPath(HttpServletRequest)
. Actions that
require relative addressing in turn should send a redirect in case of a
missing trailing "/"-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
void
doFilter(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, javax.servlet.FilterChain chain)
static javax.servlet.http.HttpServletRequest
get the current requeststatic String
getLanguageContextPath(javax.servlet.http.HttpServletRequest request, String lang)
construct a new locale specific urlvoid
init(javax.servlet.FilterConfig cfg)
-
Constructor Details
-
MicroWebFilter
public MicroWebFilter()
-
-
Method Details
-
destroy
public void destroy()- Specified by:
destroy
in interfacejavax.servlet.Filter
-
getCurrentRequest
public static javax.servlet.http.HttpServletRequest getCurrentRequest()get the current request -
getLanguageContextPath
public static String getLanguageContextPath(javax.servlet.http.HttpServletRequest request, String lang)construct a new locale specific url -
doFilter
public void doFilter(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException- Specified by:
doFilter
in interfacejavax.servlet.Filter
- Throws:
IOException
javax.servlet.ServletException
-
init
public void init(javax.servlet.FilterConfig cfg) throws javax.servlet.ServletException- Specified by:
init
in interfacejavax.servlet.Filter
- Throws:
javax.servlet.ServletException
-