Servlet filter
A servlet filter is a Java web component that intercepts requests and responses in a servlet-based application to process, modify, or reject them.
ASP.NET Core in Action, 3e
IActionFilter is an ASP.NET Core interface for synchronous MVC filters that run before and after action-method execution.
- How it is used
- Extracts shared checks and other cross-cutting logic from MVC action methods.
- How deep it goes
- Explains execution timing, context access, short-circuiting, scope, and dependency injection for synchronous action filters.
- Examples
- Uses ModelState validation and a recipe existence check to demonstrate returning errors before an action executes.
- What you can do after
- Apply synchronous action filters to MVC actions and configure short-circuit results and injected services.
Read how ASP.NET Core in Action, 3e explains servlet filter →
Spring Security in Action, Second Edition
An HTTP filter is a web-processing component that intercepts and can modify or reject HTTP requests and responses.
- How it is used
- Intercepts requests to validate input, extend authentication, audit events, or alter processing before responses reach clients.
- How deep it goes
- Descends from chain ordering to doFilter implementation and stops short of enumerating every framework-provided filter.
- Examples
- Uses Request-Id validation, authentication-event logging, curl requests, HTTP 400 responses, and OncePerRequestFilter.
- What you can do after
- Build it from scratch by implementing Filter, control chain placement with HttpSecurity, and select a Spring base class when justified.
Read how Spring Security in Action, Second Edition explains servlet filter →
Kubernetes in Action, Second Edition
A Gateway API filter is a route-rule operation that modifies, mirrors, or otherwise processes requests and responses.
- How it is used
- Processes matched HTTP or gRPC traffic by modifying, rewriting, redirecting, mirroring, or extending route behavior.
- How deep it goes
- Defines filter types and concrete manifests, then demonstrates results with requests and logs, stopping at route configuration and behavior.
- Examples
- Uses header manifests, path replacement, HTTPS redirection, service mirroring, curl requests, and backend pod logs.
- What you can do after
- Operate/configure HTTPRoute and GRPCRoute rules for header changes, path rewrites, redirects, traffic mirrors, and custom filters.
Read how Kubernetes in Action, Second Edition explains servlet filter →
Also covered in
What to know first
- authorizationAuthorization is the determination of which actions or resources an identity or other entity is permitted to access under defined permissions or policies.
- handlerA handler is a software routine or component invoked to process an event, request, message, or other input.
- HTTP requestAn HTTP request is a message sent by a client to a server using the Hypertext Transfer Protocol, specifying a method and target and optionally including headers and a body.
- HTTP status codeAn HTTP status code is a standardized three-digit code in an HTTP response that indicates the outcome of processing a request.
Related concepts
- authorization filterincludes · An authorization filter applies authorization rules to determine whether a request or action is permitted to access a resource or functionality.
- csrf protectionused by · CSRF protection is a web security mechanism that prevents forged state-changing requests from an authenticated user's browser from being accepted.
- exception filterincludes · An exception filter is an ASP.NET Core MVC filter that processes exceptions not handled by an endpoint or other applicable filters.
- filter chainpart of · A filter chain is an ordered sequence of filters through which a request is processed, with each filter able to pass processing to the next.
Questions about servlet filter
What is servlet filter?
A servlet filter is a Java web component that intercepts requests and responses in a servlet-based application to process, modify, or reject them.
Which Manning books explain servlet filter?
ASP.NET Core in Action, 3e, Spring Security in Action, Second Edition and Kubernetes in Action, Second Edition.
What should I know before learning servlet filter?
Manning books that teach servlet filter usually introduce authorization, handler, HTTP request and HTTP status code first.
What kinds of servlet filter are there?
Kinds of servlet filter include authorization filter, exception filter and ExtensionRef.
What is servlet filter part of?
Servlet filter is part of filter chain. A filter chain is an ordered sequence of filters through which a request is processed, with each filter able to pass processing to the next.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


