==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.
InputStream stream =
configuration.getServletContext().getResourceAsStream(location);
public class DataServiceImpl extends RemoteServiceServlet implements
DataService {
public String getData() {
ServletContext context = getServletContext();
ServletContext context = getServletContext();
InputStream t1, t2, t3, t4, t5, t6, t7;
InputStream isr;
InputStream stream;
String paths = "Dummy start value";
try {
//This is lifted straight from the google groups answer, what is
the configuration?
//Tried on 2/10, all of these get null too
stream = getServletContext().getResourceAsStream("/");
paths = context.getResourcePaths("/").toString(); //Gets: /, /
MyApp.css, /MyApp.html, /WEB-INF/...
isr = context.getResourceAsStream("/");
t1 = context.getResourceAsStream("/MyApp.css");
t2 = context.getResourceAsStream("/MyApp.html");
t3 = context.getResourceAsStream("MyApp.css");
t4 = context.getResourceAsStream("MyApp.html");
t5 = context.getResourceAsStream("/WEB-INF/");
t6 = context.getResourceAsStream("WEB-INF/");
t7 = context.getResourceAsStream("WEB-INF");
} catch (Exception e) {
System.out.println("Problem!");
}
}
}
Am I doing something wrong in how I get the context? I could
understand if I was doing something totally wrong, but again, the
getPaths call lists exactly what I expect. I'm also working on a Mac,
if anyone's heard of that making any difference. Thanks again.
On Feb 10, 12:32 am, Joe Cole <profilercorporat...@gmail.com> wrote:
> 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 <lucaslo...@gmail.com> wrote:
>
>
>
> > I've been trying toreadanXMLin my RPC servlet and I'm having