5

I've on WebApp in JBoss server on Port 9944, I need one security layer above this layer, which accepts the request then internally forward(not redirect) the request to that JBoss server without any change in URL at client side, So its like I need Proxy kind of layer above my WebApp layer.

I need this kind of thing for security kind of reason.

So any request comes from browser, it will first hit on that Proxy layer then it will internally forward the request to my Jboss WebApp instance without any change in browser Address Bar.

Any idea how I can proceed?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
SmartSolution
  • 2,320
  • 5
  • 37
  • 49
  • Where does FitNesse come into this picture? – anubhava Mar 28 '11 at 16:55
  • Possible duplicate of [Forward a servlet request to another server](http://stackoverflow.com/questions/10860569/forward-a-servlet-request-to-another-server) – vahapt Oct 17 '15 at 22:37

2 Answers2

4

If the proxy is in the same web application then you can use RequestDispatcher.forward() in the Servlet API.

If the proxy is in a separate web application then you'll need to open a HTTP connection to the primary application and make the request. There are a bunch of different ways to do this, including Apache HTTPClient, Spring RestTemplate, Jersey Client, etc.

sourcedelica
  • 23,940
  • 7
  • 66
  • 74
  • Thanks for your response, I tried with HttpClient it helped me out but thing is I need to take care of resource files (css, js files) attached inside that html file, i mean to say that from the servlet which requests for proxy then after receiving the response, i need to modify the – SmartSolution Mar 29 '11 at 09:33
  • So its like we are wrapping HTTP request & response but Is there any way by which dont need above stuff to do? Like proxy server, we can directly connect to some website but its log will be available in proxy server ? – SmartSolution Mar 29 '11 at 09:37
1

HTTP-Proxy-Servlet does what you need.

Please see Forward a servlet request to another server for details.

Community
  • 1
  • 1
vahapt
  • 1,685
  • 1
  • 21
  • 26