sreehari
sreehari

Reputation: 189

How can I replace my code in servlet filter with spring Interceptor?

I am new to the development of Web applications. For pre-processing of every request, I am using a servlet filter in which i get the requested uri and redirect it to a new uri if needed. Can i do the same with an interceptor class? Also , what is the best way to redirect a user to the login screen if he is not logged in?

Thanks in advance

Upvotes: 0

Views: 445

Answers (1)

Mehdi
Mehdi

Reputation: 578

Can i do the same with an interceptor class

: Yes you can do the same, here is a simple tutorial to get you started with interceptors: https://dzone.com/tutorials/java/spring/spring-interceptor.html

what is the best way to redirect a user to the login screen if he is not logged in?

If you are already using Spring then use Spring security it comes with a lot of features.

Upvotes: 1

Related Questions