Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #5674
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!.POSTED!ipv6.urchin.earth.li!twic |
|---|---|
| From | Tom Anderson <twic@urchin.earth.li> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: HTTP traffic over a custom proxy server? |
| Date | Sat, 25 Jun 2011 23:49:34 +0100 |
| Organization | Stack Usenet News Service |
| Lines | 42 |
| Message-ID | <alpine.DEB.2.00.1106252300500.10866@urchin.earth.li> (permalink) |
| References | <60701286-eb78-421a-8d54-b48762480994@glegroupsg2000goo.googlegroups.com> |
| NNTP-Posting-Host | ipv6.urchin.earth.li |
| Mime-Version | 1.0 |
| Content-Type | TEXT/PLAIN; format=flowed; charset=US-ASCII |
| X-Trace | mud.stack.nl 1309042175 65343 2001:ba8:0:1b4::6 (25 Jun 2011 22:49:35 GMT) |
| X-Complaints-To | abuse@stack.nl |
| NNTP-Posting-Date | Sat, 25 Jun 2011 22:49:35 +0000 (UTC) |
| User-Agent | Alpine 2.00 (DEB 1167 2008-08-23) |
| In-Reply-To | <60701286-eb78-421a-8d54-b48762480994@glegroupsg2000goo.googlegroups.com> |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5674 |
Show key headers only | View raw
On Fri, 24 Jun 2011, Knorpi wrote: > I would like to setup a server "myserver" that acts as a proxy for its > clients. The clients pass the url of the web page they want in a query > string: > > - client sends a HTTP request: > http://myserver?url=www.foreignurl.com&par2=val1 > > - Servlet on myserver extracts url from query string: > www.foreignurl.com > > - Servlet sends HTTP request to other server with query string: > http://www.foreignurl.com?par1=val1 This seems a mildly odd way of doing this. As Stefan suggests, it might be better to do whatever it is you're doing as a normal, proper, proxy server. > - Servlet renders complete response from other server > into a String "content" > > - Servlet changes every link in the content to point to myserver > so that all links are accessed the same way > > - Servlet sends response to client > > The most important part would be to change all links in the response. > Can you give me some hints how to do this? If you're going to do it properly, you really need to parse the HTML, identify all the a elements which have hrefs, rewrite each of those, and write out the modified HTML. Doing this in the face of bad HTML, and doing it in such a way that it won't radically alter the pages, may be quite tricky. tom -- IMPORTANCE MEMO: >>> WHEN YOU BUY AN N-GAGE QD <<< PLEASE, please CONTINUE TO TALK ON THE SIDE!!$ Note: the other party will not be able to hear you, BUT WHO REALLY CRAPS A THING, SIDETALKIN' 2009++!!!
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
HTTP traffic over a custom proxy server? Knorpi <alpineblaster@googlemail.com> - 2011-06-24 03:24 -0700 Re: HTTP traffic over a custom proxy server? Tom Anderson <twic@urchin.earth.li> - 2011-06-25 23:49 +0100 Re: HTTP traffic over a custom proxy server? Roedy Green <see_website@mindprod.com.invalid> - 2011-06-25 16:08 -0700 Re: HTTP traffic over a custom proxy server? Esmond Pitt <esmond.pitt@bigpond.com> - 2011-06-27 20:28 +1000 Re: HTTP traffic over a custom proxy server? Silvio <silvio@moc.com> - 2011-06-28 09:22 +0200
csiph-web