doFilter called twice, intended behaviour?
问题 I'm working through the Java EE servlet tutorial and tried the mood example. I noticed the doFilter is getting called twice, once the servlet call is in the chain and the second time it isnt. I added some printlns in the TimeOfDayFilter.java and in the MoodServlet.java to show this. TimeOfDayFilter.java: ... System.out.println("TimeOfDay before"); //added chain.doFilter(req, res); System.out.println("TimeOfDay after"); //added ... MoodServlet.java: ... response.setContentType("text/html