0

Is it possible to fully forward a request from a servlet to an external resource?

For example:

A web has a video component with src = ip-server/servletName

The servlet catches the GET request for that component, validates some cookie parameters and after that processes directly (forward, not redirect) an external resource present in http://localhost/resource.mp4

Is that possible using Java + Servlets or I must use other technologies¿?

Thanks!

PizergSensing
  • 203
  • 3
  • 13
  • Not a duplicate, the solution proposed is to manually execute a new request to the external resource and then pass back the result. I need something that acts like a proxy doing this process automatically as if the web page actually called the resource. Moreover this solution wouldnt allow you to prompt the user to enter user+password if the resource is protected (as in case of some IP-CAMERAS) – PizergSensing Jul 25 '13 at 12:34
  • A proxy will have to 'manually execute' a new request and 'then pass back the result'. This is the same whether the external resource is open or the server sends a challenge requiring a username & password be entered. There's more on how to do this in another SO post here - http://stackoverflow.com/questions/3916214/requestdispatcher-for-remote-server – Nick Holt Jul 25 '13 at 13:07
  • Solved, I used a variation of your suggestion using Apache HttpClient. Thanks! – PizergSensing Jul 25 '13 at 14:17

0 Answers0