RE: filtering --> 2 servlets

2002-07-21 Thread Hookom, Jacob John

you might want to look at implementing Filters to handle redirection that just checked 
the request and passes the user off.

-Original Message- 
From: Mark Beecroft [mailto:[EMAIL PROTECTED]] 
Sent: Sun 7/21/2002 7:30 PM 
To: Tomcat Users List; Jacob Kjome 
Cc: 
Subject: filtering --> 2 servlets



Good morning/afternoon/evening,

I am using Tomcat 4 and have 2 servlets between which I would like to split
processing. Servlet A needs to process all requests corresponding to the
patterns "*.html", "*.html" and "/". Servlet B needs to process all other
requests. The short question is how can I do this?

I am currently using filters but am finding it difficult to cater for the
pattern "/". The only option seems to be the use of the url mapping "/*"
to invoke a filter class, but then how does processing get to Servlet B? If I
only invoke chain.doFilter() when the pathinfo satisfies the conditions of
Servlet A then I can get Servlet A working normally, but there seems no way
of ever invoking Servlet B with such a configuration. To demonstrate:

http://www.domainname.com/index.html --> Servlet A
http://www.domainname.com/whatever.htm --> Servlet A
http://www.domainname.com/ --> servlet A
http://www.domainname.com/image.jpeg --> no Servlet accessed

What I really would like is a more versatile url-pattern element, but does
anyone have a solution for my current situation... please...

Cheers,
Mark
P.S. If you help me out I'll by you a pint when you next come to England!

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




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


RE: filtering --> 2 servlets

2002-07-22 Thread Cox, Charlie

I'm not sure you need filters for this.

define your servlet mapping in web.xml to be *.html 

Then you can set up a  to go to index.html, which would
route to your servlet based on it ending with .html

it's that simple.

Charlie

> -Original Message-
> From: Mark Beecroft [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, July 21, 2002 8:30 PM
> To: Tomcat Users List; Jacob Kjome
> Subject: filtering --> 2 servlets
> 
> 
> Good morning/afternoon/evening,
> 
> I am using Tomcat 4 and have 2 servlets between which I would 
> like to split 
> processing. Servlet A needs to process all requests 
> corresponding to the 
> patterns "*.html", "*.html" and "/". Servlet B needs to 
> process all other 
> requests. The short question is how can I do this?
> 
> I am currently using filters but am finding it difficult to 
> cater for the 
> pattern "/". The only option seems to be the use of the url 
> mapping "/*" 
> to invoke a filter class, but then how does processing get to 
> Servlet B? If I 
> only invoke chain.doFilter() when the pathinfo satisfies the 
> conditions of 
> Servlet A then I can get Servlet A working normally, but 
> there seems no way 
> of ever invoking Servlet B with such a configuration. To demonstrate:
> 
> http://www.domainname.com/index.html --> Servlet A
> http://www.domainname.com/whatever.htm --> Servlet A
> http://www.domainname.com/ --> servlet A
> http://www.domainname.com/image.jpeg --> no Servlet accessed
> 
> What I really would like is a more versatile url-pattern 
> element, but does 
> anyone have a solution for my current situation... please...
> 
> Cheers,
> Mark
> P.S. If you help me out I'll by you a pint when you next come 
> to England!
> 
> --
> To unsubscribe, e-mail:   
> 
> For additional commands, e-mail: 
> 
> 

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




Re: filtering --> 2 servlets

2002-07-22 Thread Mark Beecroft

Charlie,

Well it's not quite that simple. You see Servlet B is the "default" Servlet 
and its web.xml file gets processed in advance of mine, so I am left with
the problem of how to specify the search pattern "everything but *.html".

Further thoughts?

Cheers,
Mark



On Monday 22 July 2002 12:24 pm, Cox, Charlie wrote:
> I'm not sure you need filters for this.
>
> define your servlet mapping in web.xml to be *.html
>
> Then you can set up a  to go to index.html, which would
> route to your servlet based on it ending with .html
>
> it's that simple.
>
> Charlie
>
> > -Original Message-
> > From: Mark Beecroft [mailto:[EMAIL PROTECTED]]
> > Sent: Sunday, July 21, 2002 8:30 PM
> > To: Tomcat Users List; Jacob Kjome
> > Subject: filtering --> 2 servlets
> >
> >
> > Good morning/afternoon/evening,
> >
> > I am using Tomcat 4 and have 2 servlets between which I would
> > like to split
> > processing. Servlet A needs to process all requests
> > corresponding to the
> > patterns "*.html", "*.html" and "/". Servlet B needs to
> > process all other
> > requests. The short question is how can I do this?
> >
> > I am currently using filters but am finding it difficult to
> > cater for the
> > pattern "/". The only option seems to be the use of the url
> > mapping "/*"
> > to invoke a filter class, but then how does processing get to
> > Servlet B? If I
> > only invoke chain.doFilter() when the pathinfo satisfies the
> > conditions of
> > Servlet A then I can get Servlet A working normally, but
> > there seems no way
> > of ever invoking Servlet B with such a configuration. To demonstrate:
> >
> > http://www.domainname.com/index.html --> Servlet A
> > http://www.domainname.com/whatever.htm --> Servlet A
> > http://www.domainname.com/ --> servlet A
> > http://www.domainname.com/image.jpeg --> no Servlet accessed
> >
> > What I really would like is a more versatile url-pattern
> > element, but does
> > anyone have a solution for my current situation... please...
> >
> > Cheers,
> > Mark
> > P.S. If you help me out I'll by you a pint when you next come
> > to England!
> >
> > --
> > To unsubscribe, e-mail:
> > 
> > For additional commands, e-mail:
> > 

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




Re: filtering --> 2 servlets

2002-07-22 Thread Craig R. McClanahan



On Mon, 22 Jul 2002, Mark Beecroft wrote:

> Date: Mon, 22 Jul 2002 15:21:52 +0100
> From: Mark Beecroft <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>,
>  [EMAIL PROTECTED]
> To: Tomcat Users List <[EMAIL PROTECTED]>,
>  "Cox, Charlie" <[EMAIL PROTECTED]>
> Subject: Re: filtering --> 2 servlets
>
> Charlie,
>
> Well it's not quite that simple. You see Servlet B is the "default" Servlet
> and its web.xml file gets processed in advance of mine, so I am left with
> the problem of how to specify the search pattern "everything but *.html".
>

The default servlet mapping ("/") really is just that -- a default for
requests that are not mapped to *any* other servlet.  Therefore, if you
have a mapping for "/*", for example, the default servlet would never get
invoked.

You might want to rethink trying to use a default servlet mapping in the
first place.  Among other things, that is how Tomcat implements static
file serving, so you will already have to re-implement that if your webapp
needs it.

> Further thoughts?
>
> Cheers,
> Mark
>

Craig


>
>
> On Monday 22 July 2002 12:24 pm, Cox, Charlie wrote:
> > I'm not sure you need filters for this.
> >
> > define your servlet mapping in web.xml to be *.html
> >
> > Then you can set up a  to go to index.html, which would
> > route to your servlet based on it ending with .html
> >
> > it's that simple.
> >
> > Charlie
> >
> > > -Original Message-
> > > From: Mark Beecroft [mailto:[EMAIL PROTECTED]]
> > > Sent: Sunday, July 21, 2002 8:30 PM
> > > To: Tomcat Users List; Jacob Kjome
> > > Subject: filtering --> 2 servlets
> > >
> > >
> > > Good morning/afternoon/evening,
> > >
> > > I am using Tomcat 4 and have 2 servlets between which I would
> > > like to split
> > > processing. Servlet A needs to process all requests
> > > corresponding to the
> > > patterns "*.html", "*.html" and "/". Servlet B needs to
> > > process all other
> > > requests. The short question is how can I do this?
> > >
> > > I am currently using filters but am finding it difficult to
> > > cater for the
> > > pattern "/". The only option seems to be the use of the url
> > > mapping "/*"
> > > to invoke a filter class, but then how does processing get to
> > > Servlet B? If I
> > > only invoke chain.doFilter() when the pathinfo satisfies the
> > > conditions of
> > > Servlet A then I can get Servlet A working normally, but
> > > there seems no way
> > > of ever invoking Servlet B with such a configuration. To demonstrate:
> > >
> > > http://www.domainname.com/index.html --> Servlet A
> > > http://www.domainname.com/whatever.htm --> Servlet A
> > > http://www.domainname.com/ --> servlet A
> > > http://www.domainname.com/image.jpeg --> no Servlet accessed
> > >
> > > What I really would like is a more versatile url-pattern
> > > element, but does
> > > anyone have a solution for my current situation... please...
> > >
> > > Cheers,
> > > Mark
> > > P.S. If you help me out I'll by you a pint when you next come
> > > to England!
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>


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




Re: filtering --> 2 servlets

2002-07-22 Thread Mark Beecroft

Craig,

So to summarise: I should not use URLs such as http://www.domainname.com/ 
unless they are intended to be diverted to a welcome file. If I do I'll 
create a lot more work for myself. Correct?

Thanks,
Mark




On Monday 22 July 2002 4:18 pm, Craig R. McClanahan wrote:
> On Mon, 22 Jul 2002, Mark Beecroft wrote:
> > Date: Mon, 22 Jul 2002 15:21:52 +0100
> > From: Mark Beecroft <[EMAIL PROTECTED]>
> > Reply-To: Tomcat Users List <[EMAIL PROTECTED]>,
> >  [EMAIL PROTECTED]
> > To: Tomcat Users List <[EMAIL PROTECTED]>,
> >  "Cox, Charlie" <[EMAIL PROTECTED]>
> > Subject: Re: filtering --> 2 servlets
> >
> > Charlie,
> >
> > Well it's not quite that simple. You see Servlet B is the "default"
> > Servlet and its web.xml file gets processed in advance of mine, so I am
> > left with the problem of how to specify the search pattern "everything
> > but *.html".
>
> The default servlet mapping ("/") really is just that -- a default for
> requests that are not mapped to *any* other servlet.  Therefore, if you
> have a mapping for "/*", for example, the default servlet would never get
> invoked.
>
> You might want to rethink trying to use a default servlet mapping in the
> first place.  Among other things, that is how Tomcat implements static
> file serving, so you will already have to re-implement that if your webapp
> needs it.
>
> > Further thoughts?
> >
> > Cheers,
> > Mark
>
> Craig
>
> > On Monday 22 July 2002 12:24 pm, Cox, Charlie wrote:
> > > I'm not sure you need filters for this.
> > >
> > > define your servlet mapping in web.xml to be *.html
> > >
> > > Then you can set up a  to go to index.html, which
> > > would route to your servlet based on it ending with .html
> > >
> > > it's that simple.
> > >
> > > Charlie
> > >
> > > > -Original Message-
> > > > From: Mark Beecroft [mailto:[EMAIL PROTECTED]]
> > > > Sent: Sunday, July 21, 2002 8:30 PM
> > > > To: Tomcat Users List; Jacob Kjome
> > > > Subject: filtering --> 2 servlets
> > > >
> > > >
> > > > Good morning/afternoon/evening,
> > > >
> > > > I am using Tomcat 4 and have 2 servlets between which I would
> > > > like to split
> > > > processing. Servlet A needs to process all requests
> > > > corresponding to the
> > > > patterns "*.html", "*.html" and "/". Servlet B needs to
> > > > process all other
> > > > requests. The short question is how can I do this?
> > > >
> > > > I am currently using filters but am finding it difficult to
> > > > cater for the
> > > > pattern "/". The only option seems to be the use of the url
> > > > mapping "/*"
> > > > to invoke a filter class, but then how does processing get to
> > > > Servlet B? If I
> > > > only invoke chain.doFilter() when the pathinfo satisfies the
> > > > conditions of
> > > > Servlet A then I can get Servlet A working normally, but
> > > > there seems no way
> > > > of ever invoking Servlet B with such a configuration. To demonstrate:
> > > >
> > > > http://www.domainname.com/index.html --> Servlet A
> > > > http://www.domainname.com/whatever.htm --> Servlet A
> > > > http://www.domainname.com/ --> servlet A
> > > > http://www.domainname.com/image.jpeg --> no Servlet accessed
> > > >
> > > > What I really would like is a more versatile url-pattern
> > > > element, but does
> > > > anyone have a solution for my current situation... please...
> > > >
> > > > Cheers,
> > > > Mark
> > > > P.S. If you help me out I'll by you a pint when you next come
> > > > to England!
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > > > For additional commands, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> >
> > --
> > To unsubscribe, e-mail:  
> > <mailto:[EMAIL PROTECTED]> For additional
> > commands, e-mail: <mailto:[EMAIL PROTECTED]>

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




Re: filtering --> 2 servlets

2002-07-22 Thread Craig R. McClanahan



On Mon, 22 Jul 2002, Mark Beecroft wrote:

> Date: Mon, 22 Jul 2002 15:44:01 +0100
> From: Mark Beecroft <[EMAIL PROTECTED]>
> To: Craig R. McClanahan <[EMAIL PROTECTED]>,
>  Tomcat Users List <[EMAIL PROTECTED]>
> Cc: "Cox, Charlie" <[EMAIL PROTECTED]>
> Subject: Re: filtering --> 2 servlets
>
> Craig,
>
> So to summarise: I should not use URLs such as http://www.domainname.com/
> unless they are intended to be diverted to a welcome file. If I do I'll
> create a lot more work for myself. Correct?
>

That's a good way to think about it.

The "/" mapping doesn't do a syntactic match against the URLs like other
patterns do -- it's only a special "magic" code that marks the mapping to
use when no other mapping matches.

> Thanks,
> Mark

Craig


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