Apologies for starting a new post on an existing thread but 
everytime I try and follow up I get a top posting error.

Here is the thread on the issue

Rhett,

Thanks for the reply.

I tried mapping to something specific and it still does not 
work, 404 error.

I set up a route like so

router.attach("/testServlet/dog",HelloWorldResource.class);


and set up a mapping in the web.xml like so

   <servlet-mapping>
      <servlet-name>RestletServlet</servlet-name>
      <url-pattern>/testServlet/dog</url-pattern>
   </servlet-mapping>


I tried the URLs /testServlet/dog and also /testServlet/testServlet/dog 
and no luck.

The only way it appears to work is if attachDefault is used with 
a url-pattern of /*

Does anyone have an example of a route and url-pattern that they know works on
their setup?

Ted

Hi Ted,


What Stephan was pointing out is that that _won't_ happen because the  
container will continue to route requests to the other servlets --  
even if your restlet servlet wanted to handle the other requests, it  
won't ever see them.

I'm not sure, but if I had to guess I'd suggest that your problem is  
that your servlet was mapped to /testServlet/* and you were trying to  
request /testServlet.  The containers I've used (okay, just Tomcat)  
are very literal minded.  Try requesting /testServlet/ or /testServlet/ 
somethingElse.

Rhett

Helo TA,

try to request /testServlet/testServlet/*, because you give the 
"testServlet" double: one times in the web.xml and one times while 
attaching to the router. I think, you should remove the "testServlet" 
from the attach method.

best regards
   Stephan

New user and I'm playing around with the firstStepsApplication using it in a
tomcat web container.

I'm trying to play with the routing.

Instead of 

  Router router = new Router(getContext());
  router.attachDefault(HelloWorldResource.class);

I'm trying to do

router.attach("/testServlet",HelloWorldResource.class);

and correspondingly, I've changed the entry in web.xml

from

   <servlet-mapping>
      <servlet-name>RestletServlet</servlet-name>
      <url-pattern>/*</url-pattern>
   </servlet-mapping>

to 

<url-pattern>/testServlet/*</url-pattern>

and I can't get it to work, keep getting 404 error.

I don't want to default route to the app for all URIs in the url mapping, just
ones that start with /testServlet

Appreciate any help.

Ted


Reply via email to