How to change the default HTTP OPTIONS parameters in Java
http, http-headers, java
Solution
You can't do that with "plain" `java.net.URLConnection`. Consider replacing by Apache Commons HttpClient which is less bloated and more configureable. You can force HTTP 1.0 mode by setting `http.protocol.version` to `HttpVersion.HTTP_1_0` in `HttpClient#getParams()`. You can find an example in this document.
Problem
My java snippet looks like: ``` ... String type = "text/plain;charset=UTF-8"; URL url = new URL("http://xxx/"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setRequestMethod("OPTIONS"); conn.setRequestProperty("Content-Type", type); ... ``` When I sniff what this sends it sends a OPTIONS / HTTP/1.1 which appears to be the default. However, I actually want to send OPTIONS * HTTP/1.0 How would I do this?