Skip to main content

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

Hi Eirik,

The Servlet 3.0 (greater) emphasis on WEB-INF/lib is
certainly annoying to users used to greater flexibility :(

I agree we should think of a way to make it easier to use with
non-standard webapp deployments, such as an embedded scenario. While
that's happening, if you subclass WebInfConfiguration and override the
protected List<Resources> findJars(WebAppContext c) method to return
the set of jars you want to use, then all should be well. You can use
one of the WebAppContext.setConfigurations() or WebAppContext.setConfigurationClasses() methods to introduce your
WebInfConfiguration subclass.

cheers
Jan


On 12/04/11 20:41, Eirik Bjørsnøs wrote:
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.
_______________________________________________
jetty-dev mailing list
jetty-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-dev

--
Jan Bartel, Webtide LLC | janb@xxxxxxxxxxx | http://www.webtide.com


Back to the top