I have an architecture where my server component will be deployed on separate host and client component (UI) will be deployed on separate.
I am stuck with RestTemplate Proxy, can someone please help me how can I achieve it.
Below is the example, I am trying to follow, but not sure if its the right approach.
@Value("${generic.proxyHost}")
private String proxyHost;
@Value("${generic.proxyPort}")
private Integer proxyPort;
@Bean
public RestTemplate restTemplate() {
LOGGER.info("Setting up proxy with HOSTNAME => " + proxyHost + " and PORT => " + proxyPort);
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
Proxy proxy= new Proxy(Type.HTTP, new InetSocketAddress(proxyHost, proxyPort));
requestFactory.setProxy(proxy);
return new RestTemplate(requestFactory);
}
Also it would be help if I can know how to handle multipart file request.
Any help will be greatly appericiated.