|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javawebparts.filter.URLRedirectFilter
This filter allows you to redirect incoming requests to another URL based
on requested URL. For instance, you can redirect http://www.me.com/search
to http://www.google.com. You can in fact redirect or forward, and all of
this is driven by XML config file.
Init parameters are:
Field Summary | |
private java.util.ArrayList |
entries
This is the collection of configured items read from the config file. |
private static org.apache.commons.logging.Log |
log
Log instance. |
Constructor Summary | |
URLRedirectFilter()
|
Method Summary | |
private void |
addEntry(java.lang.String type,
java.lang.String from,
java.lang.String to)
Add an entry to the entries collection. |
void |
addForward(java.lang.String from,
java.lang.String to)
Add a forward item from the config file. |
void |
addRedirect(java.lang.String from,
java.lang.String to)
Add a redirect item from the config file. |
void |
destroy()
Destroy. |
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain filterChain)
Do filter's work. |
void |
init(javax.servlet.FilterConfig filterConfig)
Initialize this filter. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static org.apache.commons.logging.Log log
private java.util.ArrayList entries
Constructor Detail |
public URLRedirectFilter()
Method Detail |
private void addEntry(java.lang.String type, java.lang.String from, java.lang.String to)
type
- This is the type of the entry, either "redirect" or "forward".from
- The URL we want to redirect from.to
- The URL we want to redirect to.public void addRedirect(java.lang.String from, java.lang.String to)
from
- The URL we want to redirect from.to
- The URL we want to redirect to.public void addForward(java.lang.String from, java.lang.String to)
from
- The URL we want to redirect from.to
- The URL we want to redirect to.public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
init
in interface javax.servlet.Filter
filterConfig
- The configuration information for this filter.
javax.servlet.ServletException
- ServletException.public void destroy()
destroy
in interface javax.servlet.Filter
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain filterChain) throws javax.servlet.ServletException, java.io.IOException
doFilter
in interface javax.servlet.Filter
request
- The current request object.response
- The current response object.filterChain
- The current filter chain.
javax.servlet.ServletException
- ServletException.
java.io.IOException
- IOException.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |