SendRedirect in Servlet – An example program

 

SenRedirect means lets the Servlet off from the work completely.  It does not handle the request anymore and just redirects the client browser to call someone.  The client browser makes the new call on behalf of user.

 

 

It’s a stupid thing if we try to invoke SendRedirect method when the response has already been sent.  Sent in the sense, that the data has been flushed to the stream.  It will throw IllegalStatException if we try to invoke this method after the response has been committed already.

The same rules applies to setting headers, status codes or content-types. 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: