Hello,

I apologize, my code example yesterday is incorrect (big thanks to Jan
Bartel for pointing this out to me and helping me with the correct syntax).
A much more simplified way of this would be:

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Get name="initParams">
   <Put
name="propertiesDir">C:/Users/myname/workspaceProva/propertiesDir</Put>
</Get>
</Configure>

You could also do the following, using *setInitParameter* on WebAppContext:

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
 <Call name="setInitParameter">
   <Arg>propertiesDir</Arg>
   <Arg>C:/Users/myname/workspaceProva/propertiesDir</Arg>
</Call>
</Configure>

Best,
Chris

On Tue, Aug 9, 2016 at 12:32 PM, Chris Walker <[email protected]> wrote:

> Hello,
>
> As Simone pointed out, there is no *setInitParams* method, rather it is 
> *getInitParams
> <http://download.eclipse.org/jetty/stable-9/apidocs/org/eclipse/jetty/server/handler/ContextHandler.html#getInitParams-->*.
> In your case this would look like
>
> <Configure class="org.eclipse.jetty.webapp.WebAppContext">
> <Get name="InitParams">
>    <Map>
>      <Entry>
>        <Item>propertiesDir</Item>
>        <Item>C:/Users/myname/workspaceProva/propertiesDir</Item>
>      </Entry>
>    </Map>
> </Get>
> </Configure>
>
> This XML is the same as doing the following in Java:
>
> Map testmap = new HashMap();
> testmap.put("propertiesDir", "C:/Users/myname/workspaceProv
> a/propertiesDir");
>
> You can find documentation on Jetty XML syntax here
> <https://www.eclipse.org/jetty/documentation/current/reference-section.html#jetty-xml-syntax>
> .
>
> Regards,
> Chris
>
> On Tue, Aug 9, 2016 at 12:02 PM, Simone Bordet <[email protected]>
> wrote:
>
>> Hi,
>>
>> On Tue, Aug 9, 2016 at 5:43 PM, Andrea Franceschini <[email protected]>
>> wrote:
>> > Dear Jetty team,
>> >
>> > I am trying to add a context parameter to Jetty, using a jetty-web.xml
>> file:
>> >
>> > <?xml version="1.0"  encoding="UTF-8"?>
>> > <!DOCTYPE Configure PUBLIC
>> >     "-//Mort Bay Consulting//DTD Configure//EN"
>> >     "http://www.eclipse.org/jetty/configure_9_0.dtd";>
>> >
>> > <Configure class="org.eclipse.jetty.webapp.WebAppContext">
>> > <Set name="initParams">
>> >    <Map>
>> >      <Entry>
>> >        <Item>propertiesDir</Item>
>> >        <Item>C:/Users/myname/workspaceProva/propertiesDir</Item>
>> >      </Entry>
>> >    </Map>
>> > </Set>
>> > </Configure>
>> >
>> >
>> > I am getting this exception:
>> >
>> >
>> >   ____    ___                   __    __  __         ___
>> >   / __/___/ (_)__  ___ ___   __ / /__ / /_/ /___ __  / _ \
>> >  / _// __/ / / _ \(_-</ -_) / // / -_) __/ __/ // /  \_, /
>> > /___/\__/_/_/ .__/___/\__/  \___/\__/\__/\__/\_, /  /___/
>> >            /_/                              /___/
>> > 2016-08-09 15:11:57.595:INFO::main: Logging initialized @2166ms
>> >    Configuration:
>> > C:\Users\AD7E7~1.FRA\AppData\Local\Temp\eclipseJettyPlugin.c
>> onfig.ReplyGAjetty.xml
>> >
>> > C:\Users\a.franceschini\workspaceProva\Servers\jetty\jetty-web.xml
>> > 2016-08-09 15:11:57.821:WARN:oejx.XmlConfiguration:main: Config error
>> > at <Set name="initParams">|?
>> > <Map><Entry><Item>propertiesDir</Item><Item>C:/Users/myname/
>> workspaceProva/propertiesDir</Item></Entry></Map>|?</Set>
>> > java.lang.NoSuchMethodException: class
>> > org.eclipse.jetty.webapp.WebAppContext.setInitParams(class
>> > java.util.HashMap) in null
>>
>> There is no such method.
>>
>> You should *get* the initParams map, and then just call put() on it.
>> Jetty's XML can replicate invoking any Java code.
>>
>> --
>> Simone Bordet
>> ----
>> http://cometd.org
>> http://webtide.com
>> Developer advice, training, services and support
>> from the Jetty & CometD experts.
>> _______________________________________________
>> jetty-users mailing list
>> [email protected]
>> To change your delivery options, retrieve your password, or unsubscribe
>> from this list, visit
>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>
>
>
_______________________________________________
jetty-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to