Skip to content

Instantly share code, notes, and snippets.

@exhesham

exhesham/filter.java

Last active Oct 10, 2018
Embed
What would you like to do?
public class FilterLogin implements Filter {
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain){
// inject cookie
Cookie c = getCookie(httpServletResponse, "WASReqURL");
if(c == null){
// inject the cookie if it is not there
c = new Cookie("WASReqURL", "");
httpServletResponse.addCookie(c);
}
String newUrl = "/my_action_servlet";
// update the cookie value with the new url
c.setValue(newUrl);
// continue to the j_security_check
chain.doFilter(request, response);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.