Hi,

being fairly new with Restlet, I have encountered a problem 
when trying to run an application in Tomcat via the
com.noelios.restlet.ext.servlet.ServerServlet
that runs fine standalone:

I am routing GET requests such as:
http://myserver/myapp/foo/mypic.gif

to a corresponding FooResource:

Router router = new Router( getContext() );
router.attach( "/foo/{filename}", FooResource.class );

In the handleGet() method of FooResource, I need to 
access the "{filename}" attribute:

public void handleGet()
{
  String name = ( String ) getRequest().getAttributes().get( "filename" );
  ...
}

When running the application standalone, I get name = "mypic.gif" - everything
as expected.

Running the same code in a Tomcat 5.5 or Tomcat 6.0, however, the code results
in name = "mypic" - the suffix is omitted.

To my surprise, this is only the case for some endings, e.g. ".gif" or ".html". 
Endings which are (apparently) not connected to known mime types, such as 
".xyz" are passed on correctly. 

I use the following web.xml to run the application under Tomcat:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" 
xmlns="http://java.sun.com/xml/ns/j2ee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
        
<!-- Application class name -->
<context-param>
 <param-name>org.restlet.application</param-name>
 <param-value>de.myapp.MyApplication</param-value>
</context-param>

<!-- Restlet adapter -->
<servlet>
  <servlet-name>RestletServlet</servlet-name>
  <servlet-class>com.noelios.restlet.ext.servlet.ServerServlet
  </servlet-class>
</servlet>

</web-app>

Is there anything I can do to ensure that under Tomcat, too, 
I get the complete name including the suffix? I would greatly 
appreciate any help anyone can provide.

Thanks in advance,
Lutz 

Reply via email to