That's currently not possible with the StaticHttpHandler.
I think it may be a useful feature, so I'd like to invite you to log an
issue [1].
That said, you could also write your own HttpHandler to do this as a
short term solution. As long as your JAR is in the classpath when you
start the server, your handler
would only need to call
Thread.currentThread().getContextClassLoader().getResourceAsStream().
[1]
http://java.net/jira/browse/GRIZZLY
> Macbeth, Andrew (US SSA) <mailto:andrew.macbeth_at_baesystems.com>
> February 14, 2013 8:11 AM
>
> I have a jersey REST app running with Grizzly. The app is jar'd up via
> maven. I have a static .html file that I want to be able to serve. The
> file is packaged into the root of the .jar file. I can't figure out
> how to tell Grizzly to look into the jar file.
>
> The root of the .jar file
>
> /com
>
> /META-INF
>
> test.html
>
> From main():
>
> ResourceConfig resourceConfig = new
> PackagesResourceConfig("com.xyz.demo");
>
> httpServer =
> GrizzlyServerFactory.createHttpServer(uri, resourceConfig);
>
> StaticHttpHandler staticHttpHandler =
> new StaticHttpHandler("/");
>
>
> httpServer.getServerConfiguration().addHttpHandler(staticHttpHandler,
> "/static");
>
> From pom.xml:
>
> <dependency>
>
> <groupId>com.sun.jersey</groupId>
>
> <artifactId>jersey-grizzly2</artifactId>
>
> <version>1.17</version>
>
> </dependency>
>
> Andrew J. Macbeth
>