Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] problem with webapp deployed as WebAppContext

Some more details on this issue if anybody is interested. This problem has gone away when I have unpacked the bundle in a folder. Nonetheless, I wonder why it fails when the bundle is a jar.

On 24.10.2011 15:00, Ivan Larionov wrote:
Hi All,

I use jetty embedded in the equinox and the following code in bundle activator's start method to run my web application:

        WebAppContext webAppContext = new WebAppContext();
        ShopServlet shopServlet = new ShopServlet(this);
        ServletHolder servletHolder = new ServletHolder(shopServlet);
        webAppContext
.addServlet(servletHolder, ShopServlet.SERVLET_PATH + "/*");
        Properties settings = new Properties();
        settings.put(OSGiWebappConstants.SERVICE_PROP_WAR, "webfiles");
        settings.put(OSGiWebappConstants.SERVICE_PROP_CONTEXT_PATH,
                SHOP_CONTEXT);
settings.put(OSGiWebappConstants.SERVICE_PROP_DEFAULT_WEB_XML_PATH,
                "etc/webdefault.xml");
        webappRegistration = bundleContext.registerService(
                ContextHandler.class.getName(), webAppContext, settings);

It works fine in the Debug run under IDE. When I export my product and run it as a standalone equinox app, It fails to retrieve resource files from webfiles if those resources are located in the subfolders. For instance, webfiles/css/some.css or webfiles/img/some.png. It succeeds to return webfiles/main.css though. Would anybody advise on this matter?



--
Best regards,
Ivan Larionov



Back to the top