Craig,

I forgot - there's an even easier way to do this!

Just define inside your bundle manifest the header
"Jetty-defaultWebXmlFilePath" with either an absolute file location or url,
or a relative location inside the bundle of a webdefault.xml file. The
BundleWebAppProvider will see it when it deploys the bundle as a webapp and
apply it.

Sorry I didn't think of that earlier - I'm going back over the osgi
documentation even as we speak to ensure its comprehensive!

Jan


On 24 May 2013 10:01, Craig Ching <[email protected]> wrote:

> Thanks Jan, I appreciate the response!
>
> I did start on trying to configure a DeploymentManager and a
> BundleWebAppProvider, but without documentation to go with it, I was afraid
> I was heading down the wrong path ;-)
>
>
> On Thu, May 23, 2013 at 6:47 PM, Jan Bartel <[email protected]> wrote:
>
>> Hi Craig,
>>
>> Ooops, looks like I forgot to document a feature of webapp bundles on the
>> jetty-osgi doco page here:
>> http://www.eclipse.org/jetty/documentation/current/framework-jetty-osgi.html
>>
>> I will update it.
>>
>> What you can do is to include a META-INF/jetty-webapp-context.xml file
>> (name must be exactly as shown)  in your bundle. That is a normal context
>> xml file that will be applied to the webapp to configure it. So you can set
>> the location of the webdefault.xml file if you like eg:
>>
>> <?xml version="1.0"  encoding="ISO-8859-1"?>
>> <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "
>> http://www.eclipse.org/jetty/configure_9_0.dtd";>
>> <Configure class="org.eclipse.jetty.webapp.WebAppContext">
>>   <Set name="defaultsDescriptor">file:///tmp/webdefault.xml</Set>
>> </Configure>
>>
>> At the moment, the location of the webdefault.xml has to be absolute and
>> external to the bundle, but I've opened an issue here:
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=408910
>> to change it so that it can also name a bundle-relative location. Should
>> get that done before the next jetty-9 release.
>>
>>
>> As an alternative, you could also provide your own jetty configuration
>> files instead of using those in the jettyhome/ dir of the jetty osgi boot
>> core bundle - you would need to define at least a DeploymentManager and the
>> BundleWebAppProvider, and then tell the BundleWebAppProvider the location
>> of the webdefault files you want to apply to all webapps that it deploys.
>> However, that is more complicated, and something I should document rather
>> than trying to explain it in an email :)
>>
>> Jan
>>
>>
>> On 21 May 2013 04:06, Craig Ching <[email protected]> wrote:
>>
>>> How do I set the default web descriptor (webdefault.xml) when running in
>>> OSGi?  Merely putting one in ${jetty.home}/etc/ should have worked I would
>>> think, but it doesn't appear to have.
>>>
>>> Cheers,
>>> Craig
>>>
>>> _______________________________________________
>>> jetty-users mailing list
>>> [email protected]
>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>>
>>>
>>
>>
>> --
>> Jan Bartel <[email protected]>
>> www.webtide.com – Developer advice, services and support
>> from the Jetty & CometD experts.
>>
>> _______________________________________________
>> jetty-users mailing list
>> [email protected]
>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>
>>
>
> _______________________________________________
> jetty-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
>


-- 
Jan Bartel <[email protected]>
www.webtide.com – Developer advice, services and support
from the Jetty & CometD experts.
_______________________________________________
jetty-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to