As far as I understand you you want to implement servlet that performs HTTP connection to other, external server. If I am right the following discussion will help you:
How do I make HttpURLConnection use a proxy?
Take a look on the answer that explains how to use Proxy
class introduced in java 1.5.