RE: Re: servlet mapping question

2010-01-14 Thread webpost
thank you!

i already tried this and it didn't work. but now i changed the following:

TemplateRoute mainroute = router.attach("/", new Directory(getContext(), 
"war:///")); 
mainrouteroute.setMatchingMod​e(Template.MODE_EQUALS);

and this works :)

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2437419


Re: servlet mapping question

2010-01-14 Thread Thierry Boileau
Hi Robert,

in this case, I suggest the following:

router.attach("/", new Directory(getContext(), "war:///")); // equals mode
TemplateRoute route = router.attach("/restlet", MyResourceA.class); // 
starts with
route.setMatchingMode(Template.MODE_STARTS_WITH);
router.attachDefault(MyResourceB.class); // The others

Does it suit your needs?

Best regards,
Thierry Boileau

> ok no problem:
>
> - localhost/MyApp/ ->  returns index.html of the web content directory
>
> - localhost/MyApp/*relRef* ->  MyResourceA (does something with the relative 
> reference *relRef* and return a html representation)
>
> - localhost/MyApp/restlet/* ->  MyResourceB
> (returns a json representation)
>
> best regards, robert
>
>
>> Hi,
>>
>> could you list the distinct URIs you want to define and their taret
>> (resource, static files, etc) ?
>>
>> Best regards,
>> Thierry Boileau
>>
>>  
>>> I can't get this to work like I want:
>>>
>>> TemplateRoute route = router.attach( "/", MyResourceA.class );
>>> route.setMatchingMode(Template.MODE_STARTS_WITH);
>>> router.attachDefault(new Directory(getContext(), "war:///"));
>>>
>>> this always loads MyResourceA, because the main url ("localhost/MyApp/") 
>>> also starts with a "/". But this should be attached to the war:/// 
>>> directory instead of MyResourceA
>>>
>>> So I tried to attach MyResourceA as default and in this resource I evaluate 
>>> the relative reference with getRequest().getResourceRef().getRelativeRef()
>>>
>>> But how can I forward to Directory(getContext(), "war:///") in case the 
>>> relativeRef is "." ?
>>>
>>>
>>>
>>>
>>>
 Hi,

 by default, the router matches the routes using the "equals" mode.
 In your case, you seem to need something which is more like "starts with":

 TemplateRoute route = router.attach( "/", MyResourceB.class );
 route.setMatchingMode(Template.MODE_STARTS_WITH);



 Best regards,
 Thierry Boileau


  
> thank you very much!
>
> I used your solution and it works good. But there is still a small 
> problem:
>
> application class:
>
> router.attach( "/restlet/myresource",MyResourceA.class );
> router.attach( "/*", MyResourceB.class );
> router.attachDefault(new Directory(getContext(), "war:///"));
>
> I want to call MyResourceB when I type something like 
> "localhost/MyRestletApp/requesturl" but this doesn't work. It always 
> tries to convert the target to "war:///requesturl"
>
> What is wrong?
> Thanks in advance!
>
>
>
>
>>>
>

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2437345

RE: Re: servlet mapping question

2010-01-14 Thread webpost
ok no problem:

- localhost/MyApp/ -> returns index.html of the web content directory 

- localhost/MyApp/*relRef* -> MyResourceA (does something with the relative 
reference *relRef* and return a html representation)

- localhost/MyApp/restlet/* -> MyResourceB 
(returns a json representation)

best regards, robert

> Hi,
> 
> could you list the distinct URIs you want to define and their taret 
> (resource, static files, etc) ?
> 
> Best regards,
> Thierry Boileau
> 
> > I can't get this to work like I want:
> >
> > TemplateRoute route = router.attach( "/", MyResourceA.class );
> > route.setMatchingMode(Template.MODE_STARTS_WITH);
> > router.attachDefault(new Directory(getContext(), "war:///"));
> >
> > this always loads MyResourceA, because the main url ("localhost/MyApp/") 
> > also starts with a "/". But this should be attached to the war:/// 
> > directory instead of MyResourceA
> >
> > So I tried to attach MyResourceA as default and in this resource I evaluate 
> > the relative reference with getRequest().getResourceRef().getRelativeRef()
> >
> > But how can I forward to Directory(getContext(), "war:///") in case the 
> > relativeRef is "." ?
> >
> >
> >
> >
> >> Hi,
> >>
> >> by default, the router matches the routes using the "equals" mode.
> >> In your case, you seem to need something which is more like "starts with":
> >>
> >> TemplateRoute route = router.attach( "/", MyResourceB.class );
> >> route.setMatchingMode(Template.MODE_STARTS_WITH);
> >>
> >>
> >>
> >> Best regards,
> >> Thierry Boileau
> >>
> >>  
> >>> thank you very much!
> >>>
> >>> I used your solution and it works good. But there is still a small 
> >>> problem:
> >>>
> >>> application class:
> >>>
> >>> router.attach( "/restlet/myresource",MyResourceA.class );
> >>> router.attach( "/*", MyResourceB.class );
> >>> router.attachDefault(new Directory(getContext(), "war:///"));
> >>>
> >>> I want to call MyResourceB when I type something like 
> >>> "localhost/MyRestletApp/requesturl" but this doesn't work. It always 
> >>> tries to convert the target to "war:///requesturl"
> >>>
> >>> What is wrong?
> >>> Thanks in advance!
> >>>
> >>>
> >>>
> >

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2437341


Re: servlet mapping question

2010-01-13 Thread Thierry Boileau
Hi,

could you list the distinct URIs you want to define and their taret 
(resource, static files, etc) ?

Best regards,
Thierry Boileau

> I can't get this to work like I want:
>
> TemplateRoute route = router.attach( "/", MyResourceA.class );
> route.setMatchingMode(Template.MODE_STARTS_WITH);
> router.attachDefault(new Directory(getContext(), "war:///"));
>
> this always loads MyResourceA, because the main url ("localhost/MyApp/") also 
> starts with a "/". But this should be attached to the war:/// directory 
> instead of MyResourceA
>
> So I tried to attach MyResourceA as default and in this resource I evaluate 
> the relative reference with getRequest().getResourceRef().getRelativeRef()
>
> But how can I forward to Directory(getContext(), "war:///") in case the 
> relativeRef is "." ?
>
>
>
>
>> Hi,
>>
>> by default, the router matches the routes using the "equals" mode.
>> In your case, you seem to need something which is more like "starts with":
>>
>> TemplateRoute route = router.attach( "/", MyResourceB.class );
>> route.setMatchingMode(Template.MODE_STARTS_WITH);
>>
>>
>>
>> Best regards,
>> Thierry Boileau
>>
>>  
>>> thank you very much!
>>>
>>> I used your solution and it works good. But there is still a small problem:
>>>
>>> application class:
>>>
>>> router.attach( "/restlet/myresource",MyResourceA.class );
>>> router.attach( "/*", MyResourceB.class );
>>> router.attachDefault(new Directory(getContext(), "war:///"));
>>>
>>> I want to call MyResourceB when I type something like 
>>> "localhost/MyRestletApp/requesturl" but this doesn't work. It always tries 
>>> to convert the target to "war:///requesturl"
>>>
>>> What is wrong?
>>> Thanks in advance!
>>>
>>>
>>>
>

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2437227

RE: Re: servlet mapping question

2010-01-13 Thread webpost
I can't get this to work like I want:

TemplateRoute route = router.attach( "/", MyResourceA.class );
route.setMatchingMode(Template.MODE_STARTS_WITH);
router.attachDefault(new Directory(getContext(), "war:///"));

this always loads MyResourceA, because the main url ("localhost/MyApp/") also 
starts with a "/". But this should be attached to the war:/// directory instead 
of MyResourceA

So I tried to attach MyResourceA as default and in this resource I evaluate the 
relative reference with getRequest().getResourceRef().getRelativeRef()

But how can I forward to Directory(getContext(), "war:///") in case the 
relativeRef is "." ?



> Hi,
> 
> by default, the router matches the routes using the "equals" mode.
> In your case, you seem to need something which is more like "starts with":
> 
> TemplateRoute route = router.attach( "/", MyResourceB.class );
> route.setMatchingMode(Template.MODE_STARTS_WITH);
> 
> 
> 
> Best regards,
> Thierry Boileau
> 
> > thank you very much!
> >
> > I used your solution and it works good. But there is still a small problem:
> >
> > application class:
> >
> > router.attach( "/restlet/myresource",MyResourceA.class );
> > router.attach( "/*", MyResourceB.class );
> > router.attachDefault(new Directory(getContext(), "war:///"));
> >
> > I want to call MyResourceB when I type something like 
> > "localhost/MyRestletApp/requesturl" but this doesn't work. It always tries 
> > to convert the target to "war:///requesturl"
> >
> > What is wrong?
> > Thanks in advance!
> >
> >

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2437099


Re: servlet mapping question

2010-01-13 Thread Thierry Boileau
Hi,

by default, the router matches the routes using the "equals" mode.
In your case, you seem to need something which is more like "starts with":

TemplateRoute route = router.attach( "/", MyResourceB.class );
route.setMatchingMode(Template.MODE_STARTS_WITH);



Best regards,
Thierry Boileau

> thank you very much!
>
> I used your solution and it works good. But there is still a small problem:
>
> application class:
>
> router.attach( "/restlet/myresource",MyResourceA.class );
> router.attach( "/*", MyResourceB.class );
> router.attachDefault(new Directory(getContext(), "war:///"));
>
> I want to call MyResourceB when I type something like 
> "localhost/MyRestletApp/requesturl" but this doesn't work. It always tries to 
> convert the target to "war:///requesturl"
>
> What is wrong?
> Thanks in advance!
>
>

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2437074

RE: Re: servlet mapping question

2010-01-13 Thread webpost
thank you very much!

I used your solution and it works good. But there is still a small problem:

application class:

router.attach( "/restlet/myresource",MyResourceA.class );
router.attach( "/*", MyResourceB.class );
router.attachDefault(new Directory(getContext(), "war:///"));

I want to call MyResourceB when I type something like 
"localhost/MyRestletApp/requesturl" but this doesn't work. It always tries to 
convert the target to "war:///requesturl"

What is wrong?
Thanks in advance!

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2437065


Re: servlet mapping question

2010-01-13 Thread Thierry Boileau
Hello,

I think your question is a matter of configuration of the web.xml file 
which is specific to jee and not to the Restlet framework.
Another solution is to let your Restlet application catch all incoming 
requests and route them:
Router router = new Router(getContext());

// handle the "restlet" routes
router.attach("/restlet" ...);
// if the other resources are static files, let us use the Directory
router.attachDefault(new Directory(getContext(), "war:///");


best regards,
Thierry Boileau

> Isn't there a possibility to map all other requests (except "/restlet/*" and 
> "/index.html") to a resource?
>
> In the end it should be like this:
> resourceA ->  localhost/myapp/restlet/*
> index.html ->  localhost/myapp/
> resourceB ->  localhost/myapp/*
>
> Please help :)
>
>
>> hello!
>>
>> I run a restlet application inside a j2ee container.
>>
>> in my web xml are the following entries:
>>
>> 
>>   RestletServlet
>>   /restlet/*
>> 
>>
>> and
>>
>> 
>>   index.html
>> 
>>
>> Now every call to the server like "localhost:8080/MyApplication/restlet/*" 
>> is mapped to the application.
>> If I just type localhost:8080/MyApplication/ i get redirected to 
>> "localhost:8080/MyApplication/index.html"
>>
>> How can I redirect every other call (i.e. 
>> "localhost:8080/MyApplication/othercall" to 
>> "localhost:8080/MyApplication/error.html" ?
>>
>> Thanks in advance!
>>  
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2437032
>
>

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2437054


RE: servlet mapping question

2010-01-13 Thread webpost
Isn't there a possibility to map all other requests (except "/restlet/*" and 
"/index.html") to a resource?

In the end it should be like this:
resourceA -> localhost/myapp/restlet/*
index.html -> localhost/myapp/
resourceB -> localhost/myapp/*

Please help :)

> hello!
> 
> I run a restlet application inside a j2ee container.
> 
> in my web xml are the following entries:
> 
>   
>  RestletServlet  
>  /restlet/*
> 
> 
> and
> 
> 
>  index.html
> 
> 
> Now every call to the server like "localhost:8080/MyApplication/restlet/*" is 
> mapped to the application.
> If I just type localhost:8080/MyApplication/ i get redirected to 
> "localhost:8080/MyApplication/index.html"
> 
> How can I redirect every other call (i.e. 
> "localhost:8080/MyApplication/othercall" to 
> "localhost:8080/MyApplication/error.html" ?
> 
> Thanks in advance!

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2437032


Re: servlet mapping question

2008-02-29 Thread Leshek
This thread helps me understand some things too, thank you!

Since we are trying to complete the picture :-)

The myWar war name Thierry mentions becomes the default , but 
that can be changed.
When you package the war into ear, in the application deployment descriptor 
in myEar/META-INF/application.xml.  Ex to have URI like:
http://localhost/myrest/testServlet/testResource
in application.xml specify:

myEar
...
myWar.war
myrest
...

"Thierry Boileau" <[EMAIL PROTECTED]> wrote in message

> Let's say that the name of the WAR file is myWar.
>
> 1- Let's say that the RestletServlet is configured like this :
>/testServlet/*
> and the application as follow:
>router.attach("/testResource",HelloWorldResource.class);
> then, the resource'URI is something like this:
> http://localhost/myWar/testServlet/testResource





Re: Re: re servlet mapping question

2008-02-29 Thread TA

Mitch and Thierry thank you both very much, I understand now and got it working.






RE: Re: re servlet mapping question

2008-02-29 Thread Mitch Stewart
Ted,

You do not want to duplicate the servlet mappings with Router URL
attachments, as that will only work with "double" URLs. So in your
example your URL would have to be:

http://localhost/testServlet/dog/testServlet/dog

This is assuming that you are installing your webapp under /ROOT (for
Tomcat) or /root (for jetty) 

There is a level of routing that happens in the servlet container
outside of the Restlet engine, and it is determined by either the name
of the WAR file or directory in the /webapps directory (again, assuming
Tomcat/Jetty). For instance, if your directory structure looks like
this:

/ServletContainer
/webapps
/testServlet
... Files for webapp

Then your url, with this given web.xml, should REALLY be:

http://localhost/testServlet/testServlet/dog/testServlet/dog

Because the first "/testServlet" tells the servlet container to route it
to the /testServlet webapp in the /webapps directory. The next
/testServlet/dog is your mapping within the web.xml file. The last
/testServlet/dog is the Router attachment.

A more appropriate mapping would be this:



RestletServlet
/*


Then you would be able to get to your page using:

http://localhost/testServlet/testServlet/dog

But, if you just want "dog", then you should attach the Router like
this:

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

Then you could go to:

http://localhost/testServlet/dog


Again, this is because the servlet container will do an initial routing
of the context name based on the webapps you have installed. The Restlet
engine works within this context, so Router does not use the initial
context (which is "testServlet") to map its URLs.

As for worries about other servlets, because the Servlet container is
routing initially based on context, all other webapps will take
precedence. But, this is only a consideration if you install your
servlet into the ROOT context. However, the servlet container will still
look for installed contexts first before routing the request to the ROOT
context.

Hope that helps.

Also, you may want to check to see if you are getting into the Restlet
engine itself. Are you getting a 404 error from your servlet engine, or
from the Restlet engine. They will produce different looking pages
(unless you are using IE7, in which case the page will be hidden and you
will see a generic 404 error displayed by IE itself).

Mitch



> -Original Message-
> From: news [mailto:[EMAIL PROTECTED] On Behalf Of TA
> Sent: Friday, February 29, 2008 10:28 AM
> To: discuss@restlet.tigris.org
> Subject: Re: re servlet mapping question
> 
> 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
> 
>
>   RestletServlet
>   /testServlet/dog
>
> 
> 
> 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
> 
>
>   RestletServlet
>   /*
>
> 
> to 
> 
> /testServlet/*
> 
> 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
> 
> 
> 


Re: re servlet mapping question

2008-02-29 Thread Thierry Boileau
Hello Ted,

some words to complete Stephan's answer.

Let's say that the name of the WAR file is myWar.

1- Let's say that the RestletServlet is configured like this :
   /testServlet/*
and the application as follow:
   router.attach("/testResource",HelloWorldResource.class);
then, the resource'URI is something like this:
http://localhost/myWar/testServlet/testResource

1- Let's say that the RestletServlet is configured like this :
   /*
and the application as follow:
   router.attach("/testResource",HelloWorldResource.class);
then, the resource'URI is something like this:
http://localhost/myWar/testResource

best regards,
Thierry Boileau

On Fri, Feb 29, 2008 at 4:27 PM, TA <[EMAIL PROTECTED]> wrote:
> 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
>
>
>   RestletServlet
>   /testServlet/dog
>
>
>
>  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
>
>
>   RestletServlet
>   /*
>
>
>  to
>
>  /testServlet/*
>
>  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
>
>
>


Re: re servlet mapping question

2008-02-29 Thread TA
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

   
  RestletServlet
  /testServlet/dog
   


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

   
  RestletServlet
  /*
   

to 

/testServlet/*

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




Re: servlet mapping question

2008-02-29 Thread Thierry Boileau
Hello all,

some words to complete Stephan's answer.

Let's say that the name of the WAR file is myWar.

1- Let's say that the RestletServlet is configured like this :
/testServlet/*
and the application as follow:
router.attach("/testResource",HelloWorldResource.class);
then, the resource'URI is something like this:
http://localhost/myWar/testServlet/testResource

1- Let's say that the RestletServlet is configured like this :
/*
and the application as follow:
router.attach("/testResource",HelloWorldResource.class);
then, the resource'URI is something like this:
http://localhost/myWar/testResource

best regards,
Thierry Boileau
On Thu, Feb 28, 2008 at 11:21 PM, Stephan Koops <[EMAIL PROTECTED]> wrote:
> 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
>
>  TA schrieb:
>
>
> > 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
>  >
>  >
>  >   RestletServlet
>  >   /*
>  >
>  >
>  > to
>  >
>  > /testServlet/*
>  >
>  >
>  > 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
>  >
>  >
>  >
>  >
>


Re: re servlet mapping question

2008-02-28 Thread Rhett Sutphin

Hi Ted,

On Feb 28, 2008, at 5:11 PM, TA wrote:
I'm not sure I follow your suggestion - if I remove the url mapping  
from the
defaultAttach call, all URLs will map to the servlet/restlet and I  
don't want

that because I have other servlets running the web container.


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




Re: servlet mapping question

2008-02-28 Thread Stephan Koops

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

TA schrieb:

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

   
  RestletServlet
  /*
   

to 


/testServlet/*


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