Javatpoint Logo
Javatpoint Logo

Java HttpURLConnection setFollowRedirects

The setFollowRedirects is the method of Java HttpURLConnection class. This method is used to set HTTP redirects(requests with response code 3xx). It returns true by default.

Syntax

Parameter

set - It is a Boolean value. Check whether HTTP redirect or not.

Throws

SecurityException - This exception occurs if a security manager exists and checkSetFactory doesn't allow the operation.

Example 1

Test it Now

Output:

getFollowRedirects : true
connecion disconnected

Example 2

Test it Now

Output:

getFollowRedirects :true
www.oracle.com
getFollowRedirects :true
connection disconnected





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA