Top "Servlet-filters" questions

In the Servlet API, you normally use a Servlet when you want to control, preprocess and/or postprocess specific requests.

Java filter failing to set response headers

I am trying to create a Java "Filter" which detects a custom HTTP Request Header, and inserts response headers so …

java servlets http-headers request servlet-filters
Adding header in response in filter?

I need to add the header in each response. I am planning to do below public class MyFilter extends OncePerRequestFilter { @…

java spring-mvc filter httpresponse servlet-filters
Which compression (is GZIP the most popular) servlet filter would you suggest?

I am looking for a GZIP servlet filter to be used in a high volume web-app. I doesn't want to …

java servlets jakarta-ee servlet-filters
Is it possible to forward or redirect from a servlet filter after the response has been committed?

The logic is that the filter gets hit, the condition is not true, so it goes through the filter chain. …

java servlets servlet-filters forward
How to use HttpServletRequest#getParts() in a servlet filter running on Tomcat?

I would like to upload a file in my JSF application. I am using a Filter and HttpServletRequestWrapper to access …

tomcat servlets file-upload servlet-filters
@WebFilter exclude url-pattern

I use a filter to check URL patterns for the logged in user. But I have many URL patterns I …

java servlets servlet-filters url-pattern
How to set up filter chain in spring boot?

I have come across spring-boot and intend to add a filter chain for incoming request. Here is the Application: package …

java spring spring-boot servlet-filters
Authenticating the username, password by using filters in Java (contacting with database)

The following is the piece of Java code by using filters that shows the error page at every time if …

jsp authentication servlets login servlet-filters
Tomcat 7.0.35 set HTTP response header Content-Type charset for static HTML files

I am serving some static HTML files and a servlet all in a single war file from a standalone Tomcat 7.0.35 …

tomcat war content-type servlet-filters static-html
What's required to make mockMVC test a filter's init routine?

I have implemented the following CORS filter, which works when the code is executed on the server: /* * Copyright 2013 BrandsEye (http://…

spring-mvc junit mocking servlet-filters