I am trying to make REST calls using Spring. As far as I understand, the correct way is to use RestTemplate (?). The problem is what kind of proxy I am.
This is my code right now:
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); InetSocketAddress address = new InetSocketAddress(host, 3128); Proxy proxy = new Proxy(Proxy.Type.HTTP, address); factory.setProxy(proxy); RestTemplate restTemplate = new RestTemplate(); restTemplate.setRequestFactory(factory);
It seems to work, but I need to authenticate with the proxy, but how do I do this? The Proxy type, as well as the SimpleClientHttpRequestFactory type, do not seem to handle credentials. Without credentials, I get only 407 ...
java spring spring-mvc proxy
yogiginger
source share