How to inject a property from Tomcat's context.xml into a Seam component?

The Seam documentation would have you believe that if you define a property in web.xml, or through a -D argument, it will find it and automatically set it on your bean. So if you have a bean called gateway with a property login and a setter, you can make a property called gateway.login in seam.properties, but if you define it in a -D, you have to use org.seam.properties.gateway.login. I got that to work (with the -D that is), but I could not get it to see either &Parameter or &Environment definitions from in context.xml.

I am doing this because I have keys to a merchant gateway that I cannot have in a text file in the project, and would rather not have in catalina.sh, since that might be used for other apps. The nice thing about context.xml is that it's on the server and it can be confined to the one application that uses the gateway.

Answers


You should use the <Parameter/> option, not <Environment/> (to the best of my knowledge Seam does not search initialization parameters in JNDI). The name property should not include the org.jboss.seam.properties prefix (it is only for -D entries), so you should use:

<Parameter name="gateway.login" value="yourvalue" override="false" />

override="false" means that the value set here will have priority over equivalent <context-param/> tags in web.xml, if they exist (if you don't use the override option, context parameters defined in web.xml have priority over the one in context.xml).


Need Your Help

store image to SD card

android android-imageview android-sdcard android-image

i'm using cropping functionality in my android application and it works fine but i want to save cropped image to my SD Card. For that what steps needs to be followed?

Display image feed of `float` thermal images from FLIR camera

c# wpf activex bitmapimage flir

I have been working with a FLIR Thermovision camera the last couple days and have pulled together a very simple application that has a few aspects found in many different places (most of which here...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.