Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is setFollowRedirects(boolean auto) a static method of HttpURLConnection

Why is the the setFollowRedirects method static? I am in a situation where I would like to follow redirects or not on a per-connection basis, and while its not hard to change the global flag before each connection, I'm curious why it was implemented that way.

like image 565
Drew Avatar asked Mar 06 '12 20:03

Drew


1 Answers

Looks like you can use setInstanceFollowRedirects() to alter the default behaviour defined in setFollowRedirects() on a per connection basis.

Once setFollowRedirects() is called, all connections created afterwards will use this value as default.

like image 100
Tomasz Nurkiewicz Avatar answered Nov 10 '22 07:11

Tomasz Nurkiewicz