Hi all, This is the same issue indeed. I've added a test to prevent the NPE and log a warning message in the log instead. Committed to SVN.
Best regards, Jerome > -----Message d'origine----- > De : Jeff Walter [mailto:[EMAIL PROTECTED] > Envoyé : lundi 23 avril 2007 13:55 > À : discuss@restlet.tigris.org > Objet : Re: Directory restlet > > Hey Chuck, > > I had this same issue earlier this month -- it seems now when > creating your application object, you need to pass it the > component Context. > > Application application = new ProxyEngine(component.getContext ()); > > Hope this helps, > Jeff > > > On 4/20/07, Chuck Hinson <[EMAIL PROTECTED]> wrote: > > > I thought I had done this before and had it working. > Can somebody tell > me what I' m doing wrong? > I'm using the 1.0.0 release. > > --Chuck > > public Restlet createRoot() { > > Context context = getContext(); > Router router = new Router(getContext()); > > // router.attach("/provider/", ProviderResource.class); > Directory directory = new Directory(getContext(), > " file:///D:/tmp/"); > router.attach("/files/",directory); > > return router; > > } > > public static void main(String[] args) > throws Exception > { > > Component component = new Component(); > component.getServers().add(Protocol.HTTP, 8003); > component.getClients().add(Protocol.FILE); > > Application application = new ProxyEngine(); > > VirtualHost host = component.getDefaultHost(); > if (host == null) throw new RuntimeException("test"); > host.attach("", application); > > component.start(); > > } > > > When I put http://localhost:8003/files/ in my browser, > an exception is > thrown: > > > Apr 20, 2007 4:20:00 PM > com.noelios.restlet.StatusFilter getStatus > SEVERE: Unhandled exception or error intercepted > java.lang.NullPointerException > at > > com.noelios.restlet.application.ApplicationDispatcher.handle(Applicat > ionDispatcher.java:81) > at > com.noelios.restlet.TemplateDispatcher.handle > (TemplateDispatcher.java > :89) > at org.restlet.Uniform.handle(Uniform.java:97) > at org.restlet.Uniform.get(Uniform.java:74) > at > > com.noelios.restlet.local.DirectoryResource.<init>(DirectoryResource. > java:142) > at > > com.noelios.restlet.Engine.createDirectoryResource(Engine.java:253) > at org.restlet.Directory.findTarget(Directory.java:145) > at org.restlet.Finder.handle(Finder.java:268) > at org.restlet.Filter.doHandle(Filter.java:105) > at org.restlet.Filter.handle(Filter.java:134) > at org.restlet.Router.handle(Router.java:441) > at org.restlet.Filter.doHandle(Filter.java :105) > at org.restlet.Filter.handle(Filter.java:134) > at org.restlet.Filter.doHandle(Filter.java:105) > at > com.noelios.restlet.StatusFilter.doHandle(StatusFilter.java:87) > at org.restlet.Filter.handle (Filter.java:134) > at org.restlet.Filter.doHandle(Filter.java:105) > at org.restlet.Filter.handle(Filter.java:134) > at > > com.noelios.restlet.application.ApplicationHelper.handle(ApplicationH > elper.java:92) > at org.restlet.Application.handle(Application.java:290) > at org.restlet.Filter.doHandle(Filter.java:105) > at org.restlet.Filter.handle(Filter.java:134) > at org.restlet.Router.handle (Router.java:441) > at org.restlet.Filter.doHandle(Filter.java:105) > at org.restlet.Filter.handle(Filter.java:134) > at org.restlet.Router.handle(Router.java:441) > at org.restlet.Filter.doHandle (Filter.java:105) > at > com.noelios.restlet.StatusFilter.doHandle(StatusFilter.java:87) > at org.restlet.Filter.handle(Filter.java:134) > at org.restlet.Filter.doHandle(Filter.java:105) > at org.restlet.Filter.handle(Filter.java:134) > at > > com.noelios.restlet.component.ComponentHelper.handle(ComponentHelper. > java:115) > at org.restlet.Component.handle(Component.java:228) > at org.restlet.Server.handle (Server.java:281) > at > com.noelios.restlet.ServerHelper.handle(ServerHelper.java:99) > at > > com.noelios.restlet.http.HttpServerHelper.handle(HttpServerHelper.jav > a:94) > at > > com.noelios.restlet.ext.simple.SimpleProtocolHandler.handle (SimplePro > tocolHandler.java:66) > at simple.http.Dispatcher.run(Unknown Source) > at simple.util.process.Daemon.execute(Unknown Source) > at simple.util.process.Daemon.run(Unknown Source) > Apr 20, 2007 4:20:00 PM com.noelios.restlet.LogFilter > afterHandle > INFO: 2007-04-20 16:20:00 127.0.0.1 > - - > 8003 > GET /files/ - 500 366 - 80 > http://localhost:8003 > Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: > 1.8.1.3 <http://1.8.1.3> ) > Gecko/20070309 Firef > ox/2.0.0.3 - > > > ------------------------------------ > Chuck Hinson > Gestalt LLC > phone: 610.994.2833 > IM: chucking24 (Yahoo) > > > > >