Thanks - got it to work!

Now to the fancy stuff...

Can I use variables to set properties in my jetty.xml?

I now have this jetty.xml:

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "
http://www.eclipse.org/jetty/configure_9_0.dtd";>

<Configure id="Server" class="org.eclipse.jetty.server.Server">
  <Get name="handler">
    <Call name="addHandler">
      <Arg>
        <New class="org.eclipse.jetty.server.handler.ContextHandler">
          <Set name="contextPath">/logo</Set>
          <Set name="handler">
            <New class="org.eclipse.jetty.server.handler.ResourceHandler">
              <Set name="resourceBase">/temp/resource/logo</Set>
              <Set name="directoriesListed">true</Set>
            </New>
          </Set>
        </New>
      </Arg>
    </Call>
  </Get>
</Configure>

But would like to do something like this:

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "
http://www.eclipse.org/jetty/configure_9_0.dtd";>

<Configure id="Server" class="org.eclipse.jetty.server.Server">
  <Get name="handler">
    <Call name="addHandler">
      <Arg>
        <New class="org.eclipse.jetty.server.handler.ContextHandler">
          <Set name="contextPath">${contextPath}</Set>
          <Set name="handler">
            <New class="org.eclipse.jetty.server.handler.ResourceHandler">
              <Set name="resourceBase">${resourceBase}</Set>
              <Set name="directoriesListed">true</Set>
            </New>
          </Set>
        </New>
      </Arg>
    </Call>
  </Get>
</Configure>

I normally set some variables in Karaf custom.properties and use them to
configure different parts of my application. Is this possible?

/Bengt


2016-11-07 15:32 GMT+01:00 'Achim Nierbeck' via OPS4J <
[email protected]>:

> Hi Bengt,
>
> still easy ;)
>
> take a look at [1], you need a functional jetty.xml. You can use your own
> jetty.xml and adapt the part already configured.
> Therefore make sure you call get** and add some of your own stuff there.
>
> regards, Achim
>
> [1] - https://github.com/ops4j/org.ops4j.pax.web/blob/master/
> samples/jetty-config-fragment/src/main/resources/jetty.xml#L65-L79
>
> 2016-11-07 13:55 GMT+01:00 Bengt Rodehav <[email protected]>:
>
>> Here's one already....
>>
>> If I want to add special context handlers (or even my own connector). Do
>> I then have to provide the whole jetty.xml myself or just the additions?
>>
>> I changed the "org.ops4j.pax.web.config.file" property to my own file
>> but only put a fragment in there (<Get name="handler">....</Get>). It does
>> not work. I assume then that I need to either use the default jetty.xml or
>> provide the whole jetty.xml myself. Is that correct?
>>
>> /Bengt
>>
>> 2016-11-07 13:02 GMT+01:00 Bengt Rodehav <[email protected]>:
>>
>>> Wait a while and you'll get some trickier :-)
>>>
>>>
>>> 2016-11-07 9:49 GMT+01:00 'Achim Nierbeck' via OPS4J <
>>> [email protected]>:
>>>
>>>> No problem ... those are the more easier questions to answer :D
>>>>
>>>>
>>>>
>>>> 2016-11-07 9:44 GMT+01:00 Bengt Rodehav <[email protected]>:
>>>>
>>>>> Thanks again Achim,
>>>>>
>>>>> Looks like good documentation. Sorry I didn't look there first. Will
>>>>> try to follow them.
>>>>>
>>>>> /Bengt
>>>>>
>>>>> 2016-11-04 17:26 GMT+01:00 'Achim Nierbeck' via OPS4J <
>>>>> [email protected]>:
>>>>>
>>>>>> hi
>>>>>>
>>>>>> might want to take a look at the docs here [1].
>>>>>> In short. Use a specialized context handler for static resources
>>>>>> outside the container.
>>>>>>
>>>>>> regards, Achim
>>>>>>
>>>>>>
>>>>>> [1] - http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html#ad
>>>>>> ding-specialized-contexthandlers
>>>>>>
>>>>>> 2016-11-04 17:02 GMT+01:00 Bengt Rodehav <[email protected]>:
>>>>>>
>>>>>>> I'm using Pax-Web in Karaf 4.0.7.
>>>>>>>
>>>>>>> I have most of the resources I need for the web application packaged
>>>>>>> in my bundle but some need to exist outside the bundle in a normal disk
>>>>>>> folder. How can I access a normal disk folder with Pax-Web?
>>>>>>>
>>>>>>> Today I register resources as follows:
>>>>>>>
>>>>>>> mWebService.registerResources("/root", "/webroot", mHttpContext);
>>>>>>>
>>>>>>> The "/webroot" resides in the root of my bundle (jar). How can I
>>>>>>> register resoures that exists in the folder: C:\resources?
>>>>>>>
>>>>>>> /Bengt
>>>>>>>
>>>>>>> --
>>>>>>> --
>>>>>>> ------------------
>>>>>>> OPS4J - http://www.ops4j.org - [email protected]
>>>>>>>
>>>>>>> ---
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "OPS4J" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send an email to [email protected].
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>>
>>>>>> 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
>>>>>>
>>>>>> --
>>>>>> --
>>>>>> ------------------
>>>>>> OPS4J - http://www.ops4j.org - [email protected]
>>>>>>
>>>>>> ---
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "OPS4J" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>> --
>>>>> --
>>>>> ------------------
>>>>> OPS4J - http://www.ops4j.org - [email protected]
>>>>>
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "OPS4J" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> 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
>>>>
>>>> --
>>>> --
>>>> ------------------
>>>> OPS4J - http://www.ops4j.org - [email protected]
>>>>
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "OPS4J" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>> --
>> --
>> ------------------
>> OPS4J - http://www.ops4j.org - [email protected]
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "OPS4J" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
>
> 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
>
> --
> --
> ------------------
> OPS4J - http://www.ops4j.org - [email protected]
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OPS4J" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - [email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to