I need to know can i do this by jst writting simple HTTP Server / Client routine by using JAva.net package. Or do i essentially need to use any Web Server (Tomcat) to receive the request from gateway and send request. here it has to be both Server and Client.
While it is possible to write the server-cum-client just using the java.net package, why reinvent the wheel? It would be much easier to use Tomcat (or some other servlet engine) as the server, and have that make an HTTP request using the java.net package in turn.
I agree with Frank. Writing is simple HTTP request processor is quite easy. Sun supplied a good one in one of internal undocumented packages, but for some reason withdrew it recently. Creation of HTTP client is a bit more work, but httpurlconnection is working in most cases. Writing your own server can be even preferable because you can control keep-alive in better your app specific way.
Tough in space?, <a href="http://tjws.sf.net" target="_blank" rel="nofollow">Get J2EE servlet container under 150Kbytes here</a><br />Love your iPod and want it anywhere?<a href="http://mediachest.sf.net" target="_blank" rel="nofollow">Check it here.</a><br /><a href="http://7bee.j2ee.us/book/Generics%20in%20JDK%201.5.html" target="_blank" rel="nofollow">Curious about generic in Java?</a><br /><a href="http://7bee.j2ee.us/bee/index-bee.html" target="_blank" rel="nofollow">Hate ant? Use bee.</a><br /><a href="http://7bee.j2ee.us/addressbook/" target="_blank" rel="nofollow">Need contacts anywhere?</a><br /><a href="http://searchdir.sourceforge.net/" target="_blank" rel="nofollow">How to promote your business with a search engine</a>
This advice all sounds right on. If you're interested in writing your own HTTP server, see FitNesse.org for another neat example. The code is about 10% as big as the HTTP stuff I wrote for myself. Pretty slick.
Some of the code I read to learn how to do this was peppered with comments like "obsolete version of obscure browser xyz sends an extra newline here" which made it clear it would not be easy to write a robust HTTP server to expose to the world at large. My own is supported only for captive users in my company on standard IE6 configurations and a few of us using FireFox.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi