If the servlet is that simple. I would
1) rewrite it as a filter
2) Put it in the root webapp
3) Map the filter to all requests
4) Use a config file to handle all your mappings
5) make the filter smart enough to re-read the config file (servletContext.getResourceAsStream()) to detect changes so you don't have to restart the webapp. Timing on how often to detect for changes is your call.
6) Done

If you can keep the config file used by the filter as a file outside of the webapp root - then you can replace the config file without touching the webapp.

-Tim

Leon Rosenberg wrote:

asking again...
any ideas, anyone?

thanx
leon

On 11/15/05, Leon Rosenberg <[EMAIL PROTECTED]> wrote:

Hi,

I have following situation:

Business wishes (God knows why) to have a proxy proxying 6 different
context's on our server and fetching context from another server:

http://ourserver/foo/bla.html (internally fetched from )
http://anotherserver/ourname/foo/bla.html
http://ourserver/bar/bla.html -> http://anotherserver/ourname/bar/bla.html
...and so on.

I wrote a small webapp (1 servlet, 1 url-fetcher) which maps the
context and path, fetches the content of the url and delivers it to
the user. Let's say it's xxx webapp. I didn't want to make a copy of
it for any of foo,bar, etc context's, so I droped following xml files
into my $catalina_home/conf/Catalina/localhost:
foo.xml with content:
<Context path="/foo" docBase="xxx"/>,
bar.xml with content:
<Context path="/bar" docBase="xxx"/>,
and so on, for each context.

Everything is working fine, except, that the webapp is loaded once per
context which makes 6 times for now and probably 60 in half year. I
think it's a waste of resources and am searching for another solution.

Note that I already have a ROOT webapp (otherwise I'd place it under
root with servlet mapping instead of contexts) which I'd like not to
touch, because of different release cycles of both applications.

What is the best strategy to achieve my goal (having multiple context
mappings to one instantiated webapp) ?

Virtual hosts?
URL Rewriting Filter in ROOT webapp?
Something else?

Thanx in advance :-)

Regards
Leon



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to