>From memory we had heaps of trouble using getResource, and ended up using getResourceAsStream. Give that a go?
InputStream stream = configuration.getServletContext().getResourceAsStream(location); On Feb 10, 6:09 pm, Lucas86 <[email protected]> wrote: > I've been trying to read an XML in my RPC servlet and I'm having > trouble reading the file in development mode using > ServletContext.getResource(). This is my first try, and I think I must > be missing something simple but I haven't been able to find what the > missing piece is. Every path I've passed to getResource has returned > null, but when I call getResourcePaths() on the same context I get a > full list of expected paths. When I any of these paths to getResource, > it still returns null. > > ==Not complete code, but just copied from my running project== > ServletContext context = getServletContext(); > String paths = context.getResourcePaths("/ > myapp/").toString(); //Returns a list, including "/myapp/ > hosted.html" > java.net.URL testUrl = context.getResource("/myapp/hosted.html"); // > Returns null (Not really what I'm looking for, but I need to get it > finding something first) > ==== > > I realize this isn't strictly a GWT question, but that's where I'm > working and I've heard so many unhelpful not-quite-related solutions > (that usually just say "use getResource") that I really wanted to ask > here in case there are any special cases when working with the > imbedded jetty server in GWT 2.0. Does anyone know why > getResourcePaths sees what I'm looking for but the same paths fail > when passed to getResource? > > Thanks for any help. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
