Will Http redirect work without a browser?

151 Views Asked by At

We all know that the browser is responsible for redirecting the request once it receives the response status code 3xx.

But this time, I am sending a request from the back end code of the application using URLConnection. My application is running on a tomcat server.

Now what if I get a response status code 3xx, will the tomcat itself take care of redirecting the request or should I handle it in my application as :

if(urlConnection.getResponseCode() == 302)
{
   // make a new request to URL found in Location Header
}
0

There are 0 best solutions below