# Filter vs Interceptor

<figure><img src="https://www.baeldung.com/wp-content/uploads/2021/05/filters_vs_interceptors.jpg" alt=""><figcaption><p>Reference from : <a href="https://www.baeldung.com/wp-content/uploads/2021/05/filters_vs_interceptors.jpg">https://www.baeldung.com/wp-content/uploads/2021/05/filters_vs_interceptors.jpg</a></p></figcaption></figure>

From this image , Filter isn't a part of Spring framework. It mainpulates request and response. It can block the request from client and also block response before reach client.

Interceptor is similar to **Filter** but it will intercept request between **Dispatcher Servlet** and **Controller**   &#x20;

**Use Case Filter**

* Authentication
* Logging and auditing

**Use Case Interceptor**

* Detailed authorization checks
* Manipulating the Spring context or model


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev7days.gitbook.io/dev7days/java/filter-vs-interceptor.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
