Question

I have been trying, unsuccessfully, to define some primitive constants in my Spring Portlet that can be used for application defaults. I want them to be defined in an XML file.

This sounds like it should be an easy issue, but the combination of Spring 2.5 and Vignette is making it tough. Because I am using Spring, I already inject data structures into my portlet by defining data structures using things like

<util:list></util:list> 

in the Context Configuration xml file. However, Spring does not allow for a mechanism to introduce single primitives like strings and ints using this paradigm.

I have been trying to introduce this data via the portlet.xml file. I tried adding "init-param" nodes, but it seems to me that this is for specific parameters related to back-end configuration and should not (and can not) be used for application specific variables.

Currently my Controller implements PortletConfigAware and I would somehow expect to be able to define parameters in an XML file that will be available through the PortletConfig object (which contains the PortletConfig.getInitParameter("PARAMETER_NAME") method).

I am using Vignette (OpenText), but want to use a modality that is vendor-independent... ideally.

Was it helpful?

Solution

You may put your config file somewhere in WEB-INF/path/to/config.xml

Then, use the following path to get it back:

String pathToConfig = portletConfig.getPortletContext().getRealPath("/") + File.separator + "WEB-INF" + ...;

Hope this helps, Philippe

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top