I'm trying to write a servlet which takes the output of another servlet and outputs it without forwarding control to it. I'm using the URL and HttpURLConnection classes. This portion (java.net) seems to be running smoothly. The problem is: I'm trying to "rewrite" the URLs in the output to point to the servlet I'm writing. I'm simply using the String.replaceAll() You got to http://hostA/servlet. This servlet (via the URLConnection class etc.) really points to htp://hostB/servlet and captures it's html output. But - before outputting the stuff from hostB/servlet, I want to change the links addresses to point to hostA/servlet (which will eventaully rewrite them to point to hostB/servlet and go get the html output... and so on...). So: http://hostA/servlet has a login button (http://hostA/servlet/login - user clicks hostA/servlet does a replaceAll("http://hostA", http://hostB"); then I do the URL and HttpConnection to get the output of http://hostB/servlet/login. We're cool up to this point, but now is where everything goes haywire. Once I get the html output back for URLConnection, I want to replaceAll("http://hostB", http://hostA); so that the next click will come back to hostA and so on and so on. First of all, it goes crazy and get stuck in some sort of loop. I also get an error on the console "ERROR threads.ThreadPool - All threads are busy waiting. Please increase max threads or check the servlet status. ??? So - I may be doing this totally wrong - There may be an easier way to do this, but I don't know about it. I'm new to this, so I'm probably doing something foolish. My best guess is that everytime the method encounters an "href" or something similar in the replaceAll method - everything goes nuts - the processing seems to start over at the top. When I remove the final "replaceAll" method, it works fine, but of course then my links point directly to "hostB/servlet" instead of "hostA/servlet" which is what I want. Your assistant is appreciated.