Hi Benson,

looks like it, yes. But you could also register the configuration for your
static content as an OSGi service for ContextHandler. [1]

regards, Achim

[1] -
http://ops4j.github.io/pax/web/4.2.x/index.html#_advanced_jetty_configuration

2016-03-30 23:03 GMT+02:00 Benson Margulies <[email protected]>:

> Achim,
>
> We build a Karaf Assembly that contains pax-web. The first time it starts
> up, a jetty.xml appears. I suppose that it is 'installing' pax-web at that
> point.
>
> So, we might want to grab that template and merge our own stuff into it
> rather than just package up a 'small' jetty.xml with our static content
> configuration.
>
>
> --benson
>
>
> On Wed, Mar 30, 2016 at 4:40 PM, Achim Nierbeck <[email protected]>
> wrote:
>
>> I'm pretty sure nothing will write a jetty.xml when karaf is started.
>> If you install pax-web for the first time it'll copy a jetty.xml as
>> "template" to the etc folder [1].
>> The way the feature service handles this, no it won't interfere, cause
>> only if the file doesn't exist it'll be copied.
>>
>> regarding the configuration, again take a look at the feature [1].
>>
>> regards, Achim
>>
>> [1] -
>> https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-features/src/main/resources/features.xml#L91-L96
>>
>>
>>
>> 2016-03-30 22:34 GMT+02:00 Benson Margulies <[email protected]>:
>>
>>> We just noticed another fact.
>>>
>>> When Karaf starts up, pax-web or something writes out a jetty.xml to the
>>> etc directory where there was none before.
>>>
>>> Wouldn't this interfere with trying to change individual config
>>> parameters on the fly from the shell?
>>>
>>> If I have my own jetty.xml, it isn't replaced by some sort of merged-up
>>> config.
>>>
>>> It also writes out a cfg file, but that's less surprising to me.
>>>
>>> javax.servlet.context.tempdir =
>>> /Users/benson/x/rosapi1.5/assemblies/front-end/target/assembly/data/pax-web-jsp
>>> org.ops4j.pax.web.config.file =
>>> /Users/benson/x/rosapi1.5/assemblies/front-end/target/assembly/etc/jetty.xml
>>> org.osgi.service.http.port = 8181
>>>
>>> On Wed, Mar 30, 2016 at 3:52 PM, Achim Nierbeck <[email protected]
>>> > wrote:
>>>
>>>> Hi Benson,
>>>>
>>>> yes, this is it. As demanded by the OSGi spec, the configuration for
>>>> the server is done by configuration admin service.
>>>> The jetty.xml is just available for convenience for specialized
>>>> configurations. The same applies to the other two supported containers,
>>>> Tomcat and Undertow.
>>>>
>>>> regards, Achim
>>>>
>>>>
>>>> 2016-03-30 21:34 GMT+02:00 Benson Margulies <[email protected]>:
>>>>
>>>>> OK, time for me to apologize.
>>>>>
>>>>> In the environment where I have a jetty.xml to add static content, I
>>>>> indeed have the setting in the cfg file.
>>>>>
>>>>> So, I decided to read the source. Here's the process I see, which
>>>>> elaborates on your email.
>>>>>
>>>>>
>>>>>    1. 
>>>>> org.ops4j.pax.web.service.jetty.internal.ServerControllerImpl.Stopped#start
>>>>>    creates the jetty server, passing in several config items from config 
>>>>> admin.
>>>>>    2. If you supply a config.file, it might be a file, or it might be
>>>>>    a directory, presumably containing multiple jetty XML files. You can 
>>>>> also
>>>>>    supply a config.url, which presumably points to a single XML file. 
>>>>> However,
>>>>>    if it's a dir and not a file, it's rejected as invalid. The URL takes
>>>>>    precedence.
>>>>>    3. Config admin wins over a classpath resource
>>>>>    in org.ops4j.pax.web.service.jetty.internal.JettyServerImpl#start.
>>>>>    4. The start method obtains the contents of the file, turns it
>>>>>    into a resource, and passes it to Jetty configuration.
>>>>>    5. The start method passes another set of config admin parameters
>>>>>    to 
>>>>> org.ops4j.pax.web.service.jetty.internal.JettyServer#configureContext.
>>>>>    6. 
>>>>> org.ops4j.pax.web.service.jetty.internal.ServerControllerImpl.Stopped#start
>>>>>    looks to see if there is a 'master connector' as a result of processing
>>>>>    whatever configuration came through above. If there isn't one, it 
>>>>> creates
>>>>>    one programmatically.
>>>>>
>>>>> So, the net of all of this is that there is no jetty.xml file in the
>>>>> universe that represents the 'default configuration', and that a jetty.xml
>>>>> that defines no connectors on the port number from config admin is purely 
>>>>> a
>>>>> supplement to the automatic configuration.
>>>>>
>>>>> I'll see if I can some up with any way to reflect any of this into the
>>>>> doc as a proposed change.
>>>>>
>>>>>
>>>>> On Wed, Mar 30, 2016 at 2:50 PM, Achim Nierbeck <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Hi Benson,
>>>>>>
>>>>>> please take a look at the pax-web documentation [1].
>>>>>> The rule of thumb for Pax-Web is:
>>>>>>
>>>>>> configuration given via configuration admin service overrules
>>>>>> anything configured via jetty.xml
>>>>>>
>>>>>> jetty.xml can be used for additional configuration which isn't
>>>>>> configurable via properties / configuration admin service.
>>>>>>
>>>>>> Handlers are a special case, you can add those either via the
>>>>>> jetty.xml or via OSGi services.
>>>>>>
>>>>>> regards, Achim
>>>>>>
>>>>>> [1] -
>>>>>> http://ops4j.github.io/pax/web/4.2.x/index.html#_advanced_jetty_configuration
>>>>>>
>>>>>>
>>>>>> 2016-03-30 18:26 GMT+02:00 Benson Margulies <[email protected]>:
>>>>>>
>>>>>>> JB, something happens even if you do _not_ add that line to the pax
>>>>>>> web config file. I've added additional static content by just dropping 
>>>>>>> in a
>>>>>>> jetty.xml file that adds a connector. Is the difference that adding the
>>>>>>> web.cfg line causes your file to completely replace the default, 
>>>>>>> instead of
>>>>>>> supplementing it?
>>>>>>>
>>>>>>> I'm on this today because we're trying to establish the answer to
>>>>>>> the question of what idleTimeout is actually being used.
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Mar 30, 2016 at 12:10 PM, Jean-Baptiste Onofré <
>>>>>>> [email protected]> wrote:
>>>>>>>
>>>>>>>> Correct.
>>>>>>>>
>>>>>>>> You can add in etc/org.ops4j.pax.web.cfg:
>>>>>>>>
>>>>>>>> org.ops4j.pax.web.config.file=${karaf.base}/etc/jetty.xml
>>>>>>>>
>>>>>>>> to provision your own jetty.xml.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> JB
>>>>>>>>
>>>>>>>>
>>>>>>>> On 03/30/2016 06:07 PM, Benson Margulies wrote:
>>>>>>>>
>>>>>>>>> Am I correct that none of the jetty.xml files in the Karaf source
>>>>>>>>> tree
>>>>>>>>> are live in the standard package, and that the config falls back
>>>>>>>>> to pax-web?
>>>>>>>>>
>>>>>>>>>
>>>>>>>> --
>>>>>>>> Jean-Baptiste Onofré
>>>>>>>> [email protected]
>>>>>>>> http://blog.nanthrax.net
>>>>>>>> Talend - http://www.talend.com
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>>
>>>>>> Apache Member
>>>>>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>>>>>> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
>>>>>> Committer & Project Lead
>>>>>> blog <http://notizblog.nierbeck.de/>
>>>>>> Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
>>>>>>
>>>>>> Software Architect / Project Manager / Scrum Master
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> Apache Member
>>>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>>>> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
>>>> Committer & Project Lead
>>>> blog <http://notizblog.nierbeck.de/>
>>>> Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
>>>>
>>>> Software Architect / Project Manager / Scrum Master
>>>>
>>>>
>>>
>>
>>
>> --
>>
>> Apache Member
>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer
>> & Project Lead
>> blog <http://notizblog.nierbeck.de/>
>> Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
>>
>> Software Architect / Project Manager / Scrum Master
>>
>>
>


-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master

Reply via email to