Open the URL
with URL.openConnection
. Optionally cast to HttpURLConnection
. Call URLConnection.setRequestProperty
/addRequestProperty
.
The default User-Agent header value is set from the "http.agent"
system property. The PlugIn and WebStart allow you to set this property.
More Related Contents:
- How to use java.net.URLConnection to fire and handle HTTP requests
- Java – sending HTTP parameters via POST method easily
- How do I do a HTTP GET in Java? [duplicate]
- How to enable wire logging for a java HttpURLConnection traffic?
- Send HTTP request manually via socket
- How to get response body using HttpURLConnection, when code other than 2xx is returned?
- How to Reuse HttpUrlConnection? [duplicate]
- Read error response body in Java
- How can I retrieve IP address from HTTP header in Java [duplicate]
- How to get host name with port from a http or https request
- Can I override the Host header where using java’s HttpUrlConnection class?
- Send HTTP GET request with header
- Illegal characters in HTTP headers
- Android’s HttpURLConnection throws EOFException on HEAD requests
- How to send HTTP request in java? [duplicate]
- org.apache.http.entity.FileEntity is deprecated in Android 6 (Marshmallow)
- POST request send JSON data Java HttpUrlConnection
- How do I make an http request using cookies on Android?
- How to send PUT, DELETE HTTP request in HttpURLConnection?
- What is the difference between CloseableHttpClient and HttpClient in Apache HttpClient API?
- How to get HTTP response code for a URL in Java?
- how to resume an interrupted download – part 2
- Create a simple HTTP server with Java?
- Sending HTTP Post Request with Android
- How to get HttpClient returning status code and response body?
- What is the best Java library to use for HTTP POST, GET etc.? [closed]
- Safe use of HttpURLConnection
- How do I serve https and http for Jetty from one port?
- How do I persist cookies when using HTTPUrlConnection?
- How to set Cookies at Http Get method using Java