Hello, (Earlier today I tried to send this email. It seems it was lost somewhere, I fail to understand how tigris mail server works. Anyway, here it is again, but this time with a new information, and may be a way to produce a patch)
I have troubles to integrate Restlet into a GWT (GXT actually, but it should not make any difference) project. My starting point is a GWT 1.7 project generated with the webAppCreator script, under a Mac OSX (10.5.6) laptop. I kept jetty as the web server, and the only one-project architecture with the following layout: /project_root/ +-> src/mypackage.name/ | +-> client/Proto.java | +-> server/ | +-> Proto.gwt.xml +-> war/ +-> WEB-INF/ | +-> classes/ | +-> lib/gwt-servlet.jar | +-> web.xml +-> Proto.html, .css Then I tried to integrate Reslet 2.0m4. On the client side, everything seems fine -- org.restlet.jar (from restlet-gwt-2.0m4) has been added to eclipse's project classpath. However on the server side, I made the following modifications to the initial project: ------------------ [web.xml] %< ------------------ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <servlet> <servlet-name>greetServlet</servlet-name> <servlet-class>org.restlet.ext.gwt.GwtShellServletWrapper</servlet-class> <init-param> <param-name>org.restlet.component</param-name> <param-value>mypackage.name.proto.server.ProtoServer</param-value> </init-param> <init-param> <param-name>module</param-name> <param-value>mypackage.name.proto.Proto</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>greetServlet</servlet-name> <url-pattern>/ping</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>Proto.html</welcome-file> </welcome-file-list> </web-app> ------------------ %< ------------------ ------------------ [server/ProtoServerApplication.java]%< ------------------ package mypackage.name.proto.server; import org.restlet.Application; import org.restlet.Restlet; import org.restlet.resource.Directory; import org.restlet.routing.Router; import org.restlet.security.Guard; import org.restlet.data.ChallengeScheme; import com.google.gwt.core.client.GWT; public class ProtoServerApplication extends Application { �...@override public Restlet createRoot() { GWT.log("[ERROR] ProtoServerApplication::createRoot", null); Router router = new Router(getContext()); router.attach("/ping", PingRessource.class); return router; } } ------------------ %< ------------------ ------------------ [server/ProtoServer.java] %< ------------------ package mypackage.name.proto.server; import org.restlet.Component; import org.restlet.data.Protocol; public class ProtoServer extends Component { static public void main(String[] args) throws Exception { Component c = new ProtoServer(); c.getServers().add(Protocol.HTTP, 8888); c.start(); } public ProtoServer() { getDefaultHost().attach(new ProtoServerApplication()); } } ------------------ %< ------------------ and I've added the following jar in the WEB-INF/lib directory: - gwt-dev-mac - gwt-serlet.jar (the following come from restlet-jee-2.0m4) - org.osgi.compendium.jar - org.osgi.core.jar - org.restlet.ext.gwt.jar - org.restlet.ext.serlet.jar - org.restlet.jar When I launch the project from eclipse with the following options, prog args: -startupUrl Proto.html mypackage.name.Proto VM args: -Xmx512M -Xss64m -XstartOnFirstThread -Dfile.encoding=UTF-8 (the last two VM arguments fixe MacOSX issues) and then try to access the /ping address, the HostedMode GUI catches the following exception: ------------------ %< ------------------ [WARN] /ping java.lang.NullPointerException: null at org.restlet.ext.gwt.GwtShellServletWrapper.service(GwtShellServletWrapper.java:182) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:324) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:829) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488) ------------------ %< ------------------ When I extract the server part to a new project, and without all the war/WEB-INF stuff, I don't see this error (I have other problems to copy the client automatically generated results). What I see, is that GwtShellServeltWrappe#service accesses request#getPathInfo() which happens to be null, hence the null pointer exception. I guess testing the path against null should fix it. However I can't tell if having this path null is expectable or not from jetty. Last thing, in case it helps, here is the content of the request: ------------------ %< ------------------ GET /ping HTTP/1.1 User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; fr-fr) AppleWebKit/525.27.1 (KHTML, like Gecko) Referer: http://localhost:8888/proto/hosted.html?proto Accept: */* Accept-Language: fr-fr Accept-Encoding: gzip, deflate Connection: keep-alive Host: localhost:8888 ------------------ %< ------------------ -- Luc Hermitte ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2389819

