arinte
arinte

Reputation: 3728

Detection of redirect

Is there a way to detect if a servlet was called because of a redirect?

Upvotes: 2

Views: 726

Answers (2)

adarshr
adarshr

Reputation: 62603

I hope you want to distinguish sendRedirect from a forward.

The only difference is that sendRedirect requests the client to issue a new request. So as part of this, headers would change. The hint for you is to compare the values of the request headers obtained by both redirect and forward and identify the difference.

Upvotes: 1

Kaivosukeltaja
Kaivosukeltaja

Reputation: 15735

I think not, because redirects are in no way different from normal page loads.

Upvotes: 1

Related Questions