java - not able to open link on index page -
on index page userid , password have given link forgotten password jsp page not able open . on clicking link stays on index page.
my authenticationfilter is-
package bean; import java.io.ioexception; import javax.servlet.filter; import javax.servlet.filterchain; import javax.servlet.filterconfig; import javax.servlet.servletcontext; import javax.servlet.servletexception; import javax.servlet.servletrequest; import javax.servlet.servletresponse; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; import javax.servlet.http.httpsession; public class authenticationfilter implements filter {private servletcontext context; @override public void init(filterconfig fconfig) throws servletexception { this.context = fconfig.getservletcontext(); this.context.log("authenticationfilter initialized"); } @override public void dofilter(servletrequest request, servletresponse response, filterchain chain) throws ioexception, servletexception { httpservletrequest req = (httpservletrequest) request; httpservletresponse res = (httpservletresponse) response; res.setheader("cache-control", "no-cache, no-store, must-revalidate"); // http 1.1. res.setheader("pragma", "no-cache"); // http 1.0. res.setdateheader("expires", 0); // proxies. string uri = req.getrequesturi(); this.context.log("requested resource::"+uri); httpsession session = req.getsession(false);
after adding uri.endswith("jsp") in below if condition started working explain why working , why not working when uri.endswith("jsp") not there.
if(session == null && !(uri.endswith("html") || uri.endswith("loginservlet")|| uri.endswith("jsp"))){ this.context.log("unauthorized access request"); res.sendredirect("index.html"); }else{ // pass request along filter chain chain.dofilter(request, response); } } @override public void destroy() { //close resources here } }
Comments
Post a Comment