hi i have doubt whats the flow that will be to send data from filterchain.dofilter(request,reponse) to controller class actually before coming to controller i have a jsondata = "{"Exch":"cv"}" ,but after reaching the Controller i can see Exch is null..... i noticed in other project of my frd ,before going to controller from filterchain.dofilter method it will call the getInputStream which implemented(override) in his customized wrapper class.....and there i willl get correct Exch as cv. pls can any one help with this issue.........................
Please Subscribe and Support me
Good One!
Wah! Can't thank you enough, man. Thanks a ton! Keep going.
hi
i have doubt whats the flow that will be to send data from filterchain.dofilter(request,reponse) to controller class
actually before coming to controller i have a jsondata = "{"Exch":"cv"}" ,but after reaching the Controller i can see Exch is null.....
i noticed in other project of my frd ,before going to controller from filterchain.dofilter method it will call the getInputStream which implemented(override) in his customized wrapper class.....and there i willl get correct Exch as cv.
pls can any one help with this issue.........................
at 21:15 why does it log the same info twice?
what if I it log only [Message filter] whenenver I enter the /customer route and log only [Product filter] whenever enter the route /product?
@Slf4j
@Order(1) // Ensure this filter executes before MessageFilter
public class ProductFilter implements Filter {
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
String requestURI = httpServletRequest.getRequestURI();
if ("/customer".equals(requestURI)) {
chain.doFilter(request, response);
return; // Skip the rest of the filter
}
log.info("[ProductFilter] - Inside doFilter method");
log.info("Local Port : " + request.getLocalPort());
log.info("Server Name : " + request.getServerName());
log.info("Method Name : " + httpServletRequest.getMethod());
log.info("Request URI : " + requestURI);
log.info("Servlet Path : " + httpServletRequest.getServletPath());
chain.doFilter(request, response);
}
}
Add condition before performing chain.doFilter