I'm trying to do REST calls with Spring. As I understand, the right way to go is using RestTemplate
(?). Problem is, I'm behind a proxy.
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 at the proxy, but how is this done? The Proxy
type as well as the SimpleClientHttpRequestFactory
type don't seem to handle credentials. Without credentials, I'm getting just 407...