0

I need to log the request and response what user has requested. Currently am using filters and logging the request in doFilter() method. But if i forward the request from one servlet to another servlet it is logging twice. I need to find out the forwarded request and skip log for that. Could anyone suggest how to find the forwarded request.

1
  • Thanks Sergii, In that case i need to add this param in all the places where am forwarding request. I think it won't help me. Oct 19, 2016 at 13:57

1 Answer 1

1

Use request.getDispatcherType(). In case of direct request it's request.getDispatcherType().name() be REQUEST, in case of forward - FORWARD

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.