SyntaxFix
Write A Post
Hire A Developer
Questions
Have a look at the HttpURLConnection class API documentation, especially setInstanceFollowRedirects().
HttpURLConnection
setInstanceFollowRedirects()