posted 15 years ago
Guys,
The following piece of code is from the HFSJ book,
public void doFilter(ServletRequest req, ServletResponse response, FilterChain chain) throws IOException, ServletException{
HttpServletRequest request = (HttpServletRequest) req;
HttpSession session = request.getSession();
Object user = session.getAttribute("user");
if (user!=null){
UserRequest ureq = new UserRequest(request, user);
chain.doFilter(ureq, response); //Line 28
}else{
RequestDispatcher rd = request.getRequestDispatcher("/login.jsp");
rd.forward(request, response);
}
}
The questions, Which is true,
Five options were give, and I'm not able to understand the explanation given for the following option,
Line 28 is invalid because request must be passed as the first argument...and they have given the reason for this option as "it is valid for a filter to wrap a request (note that UserRequest must implement ServletRequest)
I'm not able to understand the bold part. Can anyone please explain!
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!