Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-dev] Servlet 3.0 fragments and META-INF/resources

Hi,

I'm trying to get the very nice web-fragment.xml and
META-INF/resources features from Servlet 3.0 working in embedded
Jetty.

Running a webapp right from my IDE with just a few lines of code is a
place where Jetty shines, but it doesn't seem to work with the 3.0
features. They seem to require that the jars considered for scanning
live in WEB-INF/lib.

I notice that jetty:run in the Maven plugin works out of the box.
(JettyWebAppContext seems to "fake" WEB-INF/lib placement of jars by
overriding WebAppContext.getResource/getResourcePaths.

Is there an easy way of using Servlet 3 features when embedding from
an IDE or other scenario where WEB-INF/lib is not populated? If now,
can we make one?

I tried adding jars using the
WebInfConfiguration.CONTAINER_JAR_PATTERN attribute. That seems to add
META-INF/resources. Fragments are processed by FragmentConfiguration,
but they don't seem to be applied when starting the webapp. (Servlets
and listeners aren't picked up somehow).

Here's how I start Jetty:

        Server server = new Server(8080);
        //context.setAttribute(WebInfConfiguration.CONTAINER_JAR_PATTERN,
".*/*\\.jar");
        server.setHandler(new WebAppContext("src/main/webapp", "/"));

        server.start();
        server.join();

Eirik.


Back to the top