users@grizzly.java.net

problem with overlapping servlet mappings

From: N R Platts <splendidness_at_hotmail.com>
Date: Tue, 20 Oct 2009 09:53:52 +0100

Salut,

N R Platts wrote:
> Hello,
>
> I'm trying to use an embedded grizzly servlet container with more than
> one servlet.
> However the servlets have overlapping mappings. I want one servlet to
> handle all requests except those made to a url with a specific file
> extension ('.two' in this test case).
>
> Here's my test code, the servlets just return their message so you can
> see which one you got :
>
>
> // start webserver
> int port = 8080;
> GrizzlyWebServer ws = new GrizzlyWebServer(port);
>
>
>
> ServletAdapter mysa1 = new ServletAdapter();
> MyServlet myServlet1 = new MyServlet();
> myServlet1.setMessage("Hello, I am One!");
> mysa1.setServletInstance(myServlet1);
> mysa1.setProperty(ServletAdapter.LOAD_ON_STARTUP, 1);
> mysa1.setContextPath("/");
> mysa1.setServletPath("/*");
> ws.addGrizzlyAdapter(mysa1, new String[] {"/*"});
>
> ServletAdapter mysa2 = new ServletAdapter();
> MyServlet myServlet2 = new MyServlet();
> myServlet2.setMessage("Hello, I am Two!");
> mysa2.setServletInstance(myServlet2);
> mysa2.setProperty(ServletAdapter.LOAD_ON_STARTUP, 1);
> mysa2.setContextPath("/");
> mysa2.setServletPath("/*.two");
> ws.addGrizzlyAdapter(mysa2, new String[] {"/*.two"});
>
>
> ws.start();
>
>
>
> I've tried all sorts of combinations of context path, servlet path and
> 'alias' with varying results - normally one of the servlets taking all
> the requests. Is this achievable?

Which version are you using? That should work...let me check.

Sorry for the delay.

A+

--Jeanfrancois
I'm using grizzly-servlet-webserver-1.9.18a.jar downloaded today.Thanks. Nick.Apologies for the lack of appropriate formatting in this email - hotmail not being helpful.
                                               
_________________________________________________________________
Did you know you can get Messenger on your mobile?
http://clk.atdmt.com/UKM/go/174426567/direct/01/