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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -