java - How to modify the header of a HttpUrlConnection -


I am trying to improve the Java HTML document slightly, but I HttpUrlConntion One thing is that some servers block a request if the user agent is Java VM. Another problem is that HttpUrlConnection referrer or location header The field does not set. Since many sites use this field to verify that the content was accessed from my site, I am also blocking it here. As far as I can see, the only solution is to change the URL handler of the HTTP protocol, or is there a way to modify the default HTTP handler?

open the URL with URL.openConnection . Optionally enter HttpURLConnection . Call URLConnection.setRequestProperty / addRequestProperty .

The default user-agent header value is set to "http.agent" The system property plugin and Webstart allow you to set this property.


Comments