users@grizzly.java.net

Feeding data from the jar (classloader)

From: Christopher Piggott <cpiggott_at_gmail.com>
Date: Thu, 12 Aug 2010 11:54:08 -0400

Hi,

I have an embedded grizzly using jersey-guice, so its ServletInstance is
a com.sun.jersey.spi.container.servlet.ServletContainer, and it works via a
filter:

   servletAdapter.addFilter(new com.google.inject.servletGuiceFilter(),
"guiceFilter", null);


I need to also feed out some static data. I would normally do something
like this:

        GrizzlyWebServer ws = new GrizzlyWebServer(8000, STATIC_DATA_PATH,
 USE_SSL);

where STATIC_DATA_PATH is something like "/var/www/static".

The question is: my entire application is in a .jar file, is there some way
I can just put my static data into the same jar my Server is in, and have
Grizzly be able to find the static content? Or is there another filter that
somebody knows of that can find requests via the classloader and, say,
.getResourceAsStream() and feed it out?

--Chris