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

Simone wrote:
> 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?
> 

I don't think my previous message was clear, but I would expect the Property tag to work for any (enabled) Jetty Configure XML file.

In this instance I'm trying to use it within $JETTY_BASE/webapps, like so:

start.ini
	test.prop=testprop
	-Dtest.sysprop=testsysprop
	--module=deploy
	--module=http

webapps/test.xml
	<?xml version="1.0"?>
	<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd";>
	<Configure class="org.eclipse.jetty.webapp.WebAppContext">
		<Set name="resourceBase"><Property name="test.prop" />/path</Set>
	</Configure>

webapps/systest.xml
	<?xml version="1.0"?>
	<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd";>
	<Configure class="org.eclipse.jetty.webapp.WebAppContext">
		<Set name="resourceBase"><SystemProperty name="test.sysprop" />/path</Set>
	</Configure>

Running:
$ java -jar ../jetty-distribution-9.4.16.v20190411/start.jar

The relevant output shows only the system property works:
> 2019-04-14 16:14:22.786:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@52a86356{/,file:///S:/jetty/property-testing/testsysprop/path,AVAILABLE}
> 2019-04-14 16:14:22.817:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@59906517{/,file:///S:/jetty/property-testing/null/path,AVAILABLE}


I guess that's either a bug or something which should be documented, so I'll go create an issue.


Back to the top