开发者

Java Filter and count of calls

I have written test Filter (javax.servlet.Filter) and started to debug. And I was surprised that one refresh of html page calls twice method doFilter(). Could anybody describe me why it happens ? Tha开发者_JS百科nks.


Perhaps your filter was called also for static elements (images, etc.). Check your filter path declaration in web.xml.

One way to check what's really happening is to use either Fiddler or Firebug. Or both.

Another strategy to use is printing value of request.getRequestURL().toString() before doFilter(), so you can see what requests are being served. It's difficult to pinpoint why are you seeing 2 requests because the cause might be hidden somewhere in your environment or configuration.


Fire up Fiddler and watch the requests being made.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜