tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reynir Þór Hübner <>
Subject Re: sendRedirect without changing the URL possible ?
Date Fri, 30 Apr 2004 15:58:25 GMT

Shapira, Yoav wrote:

> (A RequestDispatcher#forward is one way to keep the URL the same,

Another way would be using streams, then you could either proxy requests 
via URLConnection or HTTPClient or similar, or use for static 
files, and then write the inputstream to the response :

URL url = new URL(yourpath);
InputStream instr = url.getInputStream ();
OutputStream outstr = res.getOutputStream();
while ( (true))
	// write file to response.
	if ((in==-1)) break;
catch (Exception e)

This is maybe not a good idea in all senses (and the code above has not 
been tested, and is probably not very fast), but may help you doing what 
ever you are trying to do.  This way you can reach remote hosts. You 
need to add some functionality if you need keep track of sessions, 
cookies, authentications etc. Anything is possible...

hope it helps

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message