public class HttpConnector extends Object
Subclasses may reconfigure the HttpURLConnection
and pin it to a concrete SSL
certificate.
Constructor and Description |
---|
HttpConnector() |
Modifier and Type | Method and Description |
---|---|
protected void |
configure(HttpURLConnection conn)
Configures the new
HttpURLConnection . |
static String |
defaultUserAgent()
Returns the default User-Agent to be used.
|
HttpURLConnection |
openConnection(URL url)
Opens a
HttpURLConnection to the given URL . |
public HttpConnector()
public static String defaultUserAgent()
public HttpURLConnection openConnection(URL url) throws IOException
HttpURLConnection
to the given URL
.url
- URL
to connect toHttpURLConnection
connected to the URL
IOException
protected void configure(HttpURLConnection conn)
HttpURLConnection
.
This implementation sets reasonable timeouts, forbids caching, and sets an user agent.
conn
- HttpURLConnection
to configure.Copyright © 2015–2019. All rights reserved.