Modifying Servlet Filters Request/ Response
Extending custom HttpRequest class with HttpServletRequestWrapper serves many purposes:
- Modiying request body.
- Modiying request headers.
- Modiying response body.
- Modiying response codes.
- Convert GET to POST/PUT or vice-versa.
public class CustomHttpRequest extends HttpServletRequestWrapper{
// TODO
// Code goes here
// Methods implemented here
}
public class CustomHttpResponse extends HttpServletResponseWrapper{
// TODO
// Code goes here
// Methods implemented here
**For more detailed solutions, do leave a comment.
Comments
Post a Comment