-
1. Re: Login page is being called continuosly.
jfclere Nov 30, 2011 4:30 AM (in response to srinu_ammina)"the Filter" which Filter? Notes that the Filters are called depending on the mapping, check the mapping.
-
2. Re: Login page is being called continuosly.
srinu_ammina Nov 30, 2011 5:35 AM (in response to jfclere)We have written a LoginFilter and the code of the doFilter method looks in the following manner.
LoginFilter.java
public class LoginFilter implements Filter {
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws java.io.IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;
HttpSession session = req.getSession();
String path = req.getServletPath();
String contextPath = req.getContextPath();
UserDetailsDAO userProfileDAO = (UserDetailsDAO) session.getAttribute("validUser");
System.out.println("Start : Filter - Path - " + path);
if (userProfileDAO == null) {
System.out.println("Session is New - " + session.isNew());
if(path.equalsIgnoreCase("/doLoginAction.do") || path.equalsIgnoreCase("//webapp/pages/Login.jsp")){
System.out.println("New Session");
chain.doFilter(request, response);
}
}
else if (userProfileDAO != null) {
System.out.println("Filter - Valid Session");
chain.doFilter(request, response);
}
System.out.println("End : Filter - ");
}
}
-------------------------------------------------
Configurations in web.xml
<filter>
<filter-name>LoginFilter</filter-name>
<filter-class>com.tcs.telecom.ppm.filter.LoginFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>LoginFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>LoginFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>LoginFilter</filter-name>
<url-pattern>*.to</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>session</servlet-name>
<jsp-file>/webapp/pages/Login.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.to</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>session</servlet-name>
<url-pattern>*.so</url-pattern>
</servlet-mapping>
<welcome-file-list><welcome-file>
/webapp/pages/Login.jsp
</welcome-file></welcome-file-list>
----------------------------------------------------------------------------
Here the issue is we are continuosly seeing the below logs in the server these logs those are coming from the LoginFilter.java even though no users are accessing the application.
[STDOUT] Start : Filter - Path - //webapp/pages/Login.jsp
[STDOUT] Session is New - true
[STDOUT] New Session
Could you please help us in identifying the issue?
-
3. Re: Login page is being called continuosly.
srinu_ammina Dec 1, 2011 1:11 AM (in response to srinu_ammina)Hi apart from the above information we are suspecting that some process might be running in unix system which might be pinging the web application URL for every 2 seconds in the production environment so on accessing the URL it would redirect to the login page and it is displaying the logs in the LoginFilter which is configured for login page.
Here from the above code snippet in the LoginFilter.java we are having the below code.
HttpSession session = req.getSession();
System.out.println("Session is New - " + session.isNew());
And it is displaying the session as new. So will there be any performance impact on the web application? since for every
2 seconds login page is being hitted and every time a new session is being created from the process (not from the web URL) and this session is not being used any more.
Could you please let us know about this ?
-
4. Re: Login page is being called continuosly.
jfclere Dec 1, 2011 3:46 AM (in response to srinu_ammina)"So will there be any performance impact on the web application?"
hm can't answer that question: it is your application
if you run 250 req/s, one more request every 2 seconds should not be a problem...If you run 1 req/s may be
-
5. Re: Login page is being called continuosly.
srinu_ammina Dec 1, 2011 4:51 AM (in response to jfclere)Thanks for the update. We won't be getting that much number of requests but concern here is for every 2 seconds HttpSession session = req.getSession(); statement being called and if we check session.isNew() it is returning 'TRUE' for all the requests if we check in the logs. So by this information can we tell that many number of new session are being created un necessarily?