Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Understanding Property tag use

Hi,

On Sat, Apr 13, 2019 at 9:22 PM Peter Boughton <jetty@xxxxxxxxxxxxxxxxx> wrote:
>
> I'm trying to understand the relationship between start.ini parameters and the <Property> tag.
>
> What I thought was the case (and this is backed up by the `start.jar --help` text) is that any a=b lines in start.ini can be referred to from an XML config file as <Property name="a" /> to use "b" in that value.
>
> An example being jetty.http.port which can be set in start.ini and appears to pass the value through in jetty-http.xml with:
>         <Set name="port"><Property name="jetty.http.port" deprecated="jetty.port" default="8080" /></Set>
>
> However, when trying to use the same in WebAppContext with resourceBase, I get the default (not the ini value):
>         <Set name="resourceBase"><Property name="jetty.http.port" deprecated="jetty.port" default="8080" />/path</Set>
>
> Likewise, setting my.property=something in start.ini the following property is replaced by the string "null" (or the default if one is added), instead of the expected "something":
>         <Set name="resourceBase"><Property name="my.property" />/path</Set>
>
> If I use -Dmy.property=something and switch from Property to SystemProperty tag it works as expected.
> If I use Property tag with name="jetty.base" it also resolves as expected.
>
> The documentation at https://www.eclipse.org/jetty/documentation/current/jetty-xml-usage.html says that the Property tag is for .properties files, but doing `echo "my.property=something" > myjetty.properties` and passing the file to start.jar still ends up with null/default. (However, adding jetty.http.port to myjetty.properties does change the port.)
>
> So, can anyone explain what I'm missing?

If you want to modify an existing Jetty XML file, you need to copy it
from $JETTY_HOME/etc to $JETTY_BASE/etc and then modify the
$JETTY_BASE/etc XML file.
Of course, for that XML file to be considered, the correspondent
module should be enabled.

If you are writing a custom module, then your custom XML file needs to
be in $JETTY_BASE/etc.

If you have done the above and my.property does not work, then seems like a bug.
If that's the case, please open an issue at
https://github.com/eclipse/jetty.project/issues?

-- 
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.


Back to the top