Java HttpURLConnection setAuthenticatorThe setAuthenticator(Authenticator auth) is a method of Java HttpURLConnection class. This method is used to set the authentication request through HTTP protocol. If no authentication is sent then default authentication is used. SyntaxParameterAuth - It is used by this HttpURLConnection. ThrowUnsupportedOperationException - This exception occurred when implementation of authentication is not supported. IllegalStateException - This exception occurred when URLConnection is already connected. NullPointerException - This exception occurred when the supplied auth is null. Example 1Test it NowOutput: https://www.javatpoint.com Basic :SmF2YXRwb2ludDoxMjM= Example 2Test it NowOutput: https://www.facebook.com Basic : ZmFjZWJvb2s6NTYz Next TopicJava HttpURLConnection class |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India