You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Pike <pi...@kw.nl> on 2003/08/29 13:51:03 UTC

tomcat as a proxy

Hi

I would like to write a servlet that  intercepts http
requests, and optionally rebuilds and redirects
them to other (remote) servers.

but tomcat doesnt know how to send remote
httprequests, does it ?

so I guess I need to incorporate a httpclient
in my project. is that correct  ? does anyone
have any experience in writing proxies ?

I've found 2 liable http client apis

jakarta-commons'
	http://jakarta.apache.org/commons/httpclient/tutorial.html
and ballard's (looks great!)(supports webdav!!)
	http://www.geocities.com/ballarke/Projects/HttpClient/


cu
*pike

===========
404 Not Found - The weapons you are looking for are currently 
unavailable. The country might be experiencing technical difficulties, 
or you may need to adjust your weapons inspectors mandate.


Re: tomcat as a proxy

Posted by Pike <pi...@kw.nl>.
Hi

>>>> I would like to write a servlet that  intercepts http
>>>> requests, and optionally rebuilds and redirects
>>>> them to other (remote) servers.
>>> Httpclient should work fine.
>> ehm .. which one ? the apache/commons ?
> oops ... Jakarta Httpclient.

ok. but it's too restricted, it only supports some basic methods
	http://jakarta.apache.org/commons/httpclient/methods.html
I think I'll go with ballarke
	http://www.geocities.com/ballarke/Projects/HttpClient/


 >So you will
> - intercept the incoming request.
> - depending on the request, ask another server for data.
> - Mangle the other server data
> - feed back to client.
yep :-)

> This sounds like reinventing the wheel since there is XML-RPC or SOAP.
> (See apache axis project for more info)
? but ... I suppose the remote server should support that, then ?
I was planning to 'proxy' to plain web(dav)services.

but I think I'm right on track now

(hmm .. how a about a HttpRemoteRequestDispatcher class ... hmm...)

thanks,
*-pike
=======
+ give luck a chance


Re: tomcat as a proxy

Posted by Tim Funk <fu...@joedog.org>.
oops ... Jakarta Httpclient.

So you will
- intercept the incoming request.
- depending on the request, ask another server for data.
- Mangle the other server data
- feed back to client.

This sounds like reinventing the wheel since there is XML-RPC or SOAP. (See 
apache axis project for more info)

Still ... jakarta HttpClient should be ok.

-Tim

Pike wrote:

> Hi
> 
> thanks for your response
> 
>>> I would like to write a servlet that  intercepts http
>>> requests, and optionally rebuilds and redirects
>>> them to other (remote) servers.
> 
> 
>> Httpclient should work fine.
> 
> 
> ehm .. which one ? the apache/commons ?
> I'm afraid that's a little too restricted...
> 
>> Ideally, if you wish to have a tomcat servlet act a proxy server,
>> be sure you read the HTTP specs with respect to proxy servers.
>> There are many gotchas.
> 
> I don't think I need to. Tomcat should behave as a plain
> webserver. Behind the scenes it fetches his data from elsewhere
> on the web. The client doesn't need to know that.
> 
> so, maybe I shouldn't call it a proxy.
> 
>> Before writing too much code and IF you are able to use apache,
>> it would be infinitely easier to use mod_proxy.
> 
> mod_proxy doesnt actually _do_ anything does it ? it
> just proxies. I want to intercept the request and rebuild
> it (with some app logic) before sending it on...
> 
> I'm surprised it seems so hard to do.
> I imagined there would be something like
> HttpServletRequest.dispatch(url) for remote
> requests.
> 



Re: tomcat as a proxy

Posted by Pike <pi...@kw.nl>.
Hi

thanks for your response

>> I would like to write a servlet that  intercepts http
>> requests, and optionally rebuilds and redirects
>> them to other (remote) servers.

> Httpclient should work fine.

ehm .. which one ? the apache/commons ?
I'm afraid that's a little too restricted...

> Ideally, if you wish to have a tomcat servlet act a proxy server,
> be sure you read the HTTP specs with respect to proxy servers.
> There are many gotchas.
I don't think I need to. Tomcat should behave as a plain
webserver. Behind the scenes it fetches his data from elsewhere
on the web. The client doesn't need to know that.

so, maybe I shouldn't call it a proxy.

> Before writing too much code and IF you are able to use apache,
> it would be infinitely easier to use mod_proxy.
mod_proxy doesnt actually _do_ anything does it ? it
just proxies. I want to intercept the request and rebuild
it (with some app logic) before sending it on...

I'm surprised it seems so hard to do.
I imagined there would be something like
HttpServletRequest.dispatch(url) for remote
requests.

thanks,
*-pike
====================================
= 1/9671406556917033397649408 yottabyte
= 1/9444732965739290427392 zettabyte
= 1/9223372036854775808 exabyte
= 1/9007199254740992 petabyte
= 1/8796093022208 terabyte
= 1/8589934592 gigabyte
= 1/8388608 megabyte
= 1/1048576 Megabit
= 1/8192 kilobyte
= 1/1024 Kilobit
= 1/8 byte
= 1/4 nibble
bit = 1 bit


Re: tomcat as a proxy

Posted by Tim Funk <fu...@joedog.org>.
Httpclient should work fine. Ideally, if you wish to have a tomcat servlet 
act a proxy server, be sure you read the HTTP specs with respect to proxy 
servers. There are many gotchas.

Before writing too much code and IF you are able to use apache, it would be 
infinitely easier to use mod_proxy.

-Tim

Pike wrote:

> Hi
> 
> I would like to write a servlet that  intercepts http
> requests, and optionally rebuilds and redirects
> them to other (remote) servers.
> 
> but tomcat doesnt know how to send remote
> httprequests, does it ?
> 
> so I guess I need to incorporate a httpclient
> in my project. is that correct  ? does anyone
> have any experience in writing proxies ?
> 
> I've found 2 liable http client apis
> 
> jakarta-commons'
>     http://jakarta.apache.org/commons/httpclient/tutorial.html
> and ballard's (looks great!)(supports webdav!!)
>     http://www.geocities.com/ballarke/Projects/HttpClient/
> 
> 
> cu
> *pike
> 



Newbie:web application

Posted by Webmaster <we...@gymgest.it>.
Hi to all,

I'm developing a web application but I don't understand where i have to put 
my context: I have a folder /myApp, under this I have the standard folders 
for a web application.

I put alla in <tomcat-home>/webapps but nothing!

What i've forgot to do?

thanks,

Tiziana