users@grizzly.java.net

Re: Feeding data from the jar (classloader)

From: Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM>
Date: Thu, 12 Aug 2010 18:03:15 +0200

Hi Chris,

there is no ready solution to work with the jar content, but IMO it
shouldn't be difficult to write your own Adapter, which will do that.
As you correctly pointed out, in that Adapter you may try to load a
resource using some classloader via .getResourceAsStream(...) and
return it using Response object.

If you'll have any issues with that - let us know.

Thanks.

WBR,
Alexey.

On Aug 12, 2010, at 17:54 , Christopher Piggott wrote:

> 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
>
>