Skip to content
Advertisement

Tag: http

Authenticated HTTP proxy with Java

How can I configure the username and password to authenticate a http proxy server using Java? I just found the following configuration parameters: But, my proxy server requires authentication. How can I configure my app to use the proxy server? Answer (EDIT: As pointed out by the OP, the using a java.net.Authenticator is required too. I’m updating my answer accordingly

How do I make HttpURLConnection use a proxy?

If I do this… it prints The problem is, I am behind a proxy. Where does the JVM get its proxy information from on Windows? How do I set this up? All my other apps seem perfectly happy with my proxy. Answer Since java 1.5 you can also pass a java.net.Proxy instance to the openConnection(proxy) method: If your proxy requires

Java http call returning response code: 501

I am having an issue with this error: See this code: Answer A 501 response means “not implemented”, and is usually taken to mean that the server didn’t understand the HTTP method that you used (e.g. get, post, etc). I don’t recognise ClientHttpRequest , but you have a line that says and then a line that says I’m not sure

How can I find the response time of a HTTP request through a Socket

I’m using a Java socket, connected to a server. If I send a HEADER http request, how can I measure the response time from the server? Must I use a provided java timer, or is there an easier way? I’m looking for a short answer, I don’t want to use other protocols etc. Obviously do I neither want to have

Advertisement