I'm guessing the difference is in the attachment point.  Is it the
case, in hosted mode, the GWT adapter servlet is attached to /, and in
your deployed version the ServerServlet is attached to /items?

Since the base reference in the deployed version is already /items,
you'd effectively have to be hitting /items/items for your application
to route the requests.  (Try this from a browser to see if the
hypothesis is correct)

One path would be to modify your hosted mode installation to simulate
the production installation, or you could modify your client to
support a configurable base reference location.  Personally I like to
do the latter, because the web application configuration may change
and force my application to be "rooted" anywhere in the URI space.

On Thu, Feb 19, 2009 at 5:30 PM, Neha Verma <[email protected]> wrote:
> I am having problems deploying my application on tomcat. I am using the 
> Restlet GWT extension and while the application works on the hosted mode, it 
> doesn't work when I deploy it on Tomcat.
>
> My Application file (snippet)
> -----------------------
> ...
> @Override
> public synchronized Restlet createRoot() {
> Router router = new Router(getContext());
> router.attach("/items",ItemsResource.class);
> router.attach("/items/{itemName}", ItemResource.class);
> return router;
> }
> ...
>
>
> On the client,
> -------------------
> grid.addRecordClickHandler(new RecordClickHandler() {
> public void onRecordClick(RecordClickEvent event) {
> final Client client = new Client(Protocol.HTTP);
> client.get("http://localhost:8080/CaseManager/items";, new Callback(){
> @Override
> public void onEvent(Request request, Response response) {
> try{
> com.google.gwt.user.client.Window.alert( response.getEntity().getText() );
> }
> catch(Exception e){
> e.printStackTrace();
> }
> }
> });
> }
> });
>
> -----
> My web.xml when deployed on tomcat is
> ------------------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app>
> <display-name>Test servlet</display-name>
> <context-param>
>            <param-name>org.restlet.application</param-name>
>            <param-value>
>               com.test.server.FirstResourceApplication
>            </param-value>
>    </context-param>
>
>    <!-- Restlet adapter -->
>    <servlet>
>            <servlet-name>ServerServlet</servlet-name>
>            <servlet-class>
>               org.restlet.ext.servlet.ServerServlet
>            </servlet-class>
>    </servlet>
>
>    <!-- Catch all requests -->
>    <servlet-mapping>
>            <servlet-name>ServerServlet</servlet-name>
>            <url-pattern>/items</url-pattern>
>    </servlet-mapping>
>
>    <servlet-mapping>
>            <servlet-name>ServerServlet</servlet-name>
>            <url-pattern>/items/*</url-pattern>
>    </servlet-mapping>
>
>  <welcome-file-list>
>        <welcome-file>CaseManager.html</welcome-file>
>  </welcome-file-list>
>
>
> </web-app>
>
> When I access the URL
> http://localhost:8080/CaseManager/CaseManager.html
> the call in the client fails with a 404 error.
>
> Feb 19, 2009 5:26:38 PM org.apache.catalina.core.ApplicationContext log
> INFO: ServerServlet: [Noelios Restlet Engine] - Attaching application: 
> com.testapp.server.firstresourceapplicat...@dec8b3 to URI:
> /CaseManager/items
>
> Feb 19, 2009 5:26:38 PM org.restlet.engine.LogFilter afterHandle
> INFO: 2009-02-19        17:26:38        127.0.0.1       -       127.0.0.1     
>   8080    GET     /CaseManager/items      -       404     330     -       31  
>     http://localhost:8080   Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 
> 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)      -
> Feb 19, 2009 5:26:42 PM org.restlet.engine.LogFilter afterHandle
> INFO: 2009-02-19        17:26:42        127.0.0.1       -       127.0.0.1     
>   8080    GET     /CaseManager/items      -       404     330     -       0   
>     http://localhost:8080   Noelios-Restlet-Engine/1.2.m1   
> http://localhost:8080/CaseManager/782D6C746CFC4EFC288789EE2C72C8F3.cache.html
>
>
> From this it looks like the request is going to FirstResourceApplication, but 
> its unable to find the appropriate router. I know that the issue is in the 
> web.xml (as that's the only thing that changed between the hosted mode and 
> the tomcat deplopyment).
> Has anyone faced this issue??
>
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1194885
>

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

Reply via email to