You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Alex Shneyderman <a....@gmail.com> on 2007/12/26 10:38:24 UTC
How to substitute the placeholders in the config files ?
I have a cxf.xml that contains a section like this :
<sec:trustManagers>
<sec:keyStore type="${securitystore.type}"
password="${securitystore.password}"
file="${securitystore.file}" />
</sec:trustManagers>
how do I substitute all those ${} placeholders ?
I tried to use PropertyPlaceholderConfigurer that of course did not work.
Any ideas ?
--
Thanks,
Alex.
Re: How to substitute the placeholders in the config files ?
Posted by Benson Margulies <bi...@gmail.com>.
If you don't like XML, that's another story.
I'm fairly sure that there's another overload that does not include the
poll time parameter.
On Wed, 2007-12-26 at 15:44 +0100, Alex Shneyderman wrote:
> > You seem to have leapt from 'spring in cxf' to 'no spring at all'? Why
> > not take Glen's suggestion and use an app context with a property
> > configurator?
>
> Sorry, but the links do not help to see the solution to my particular
> problem. I can see how to do it with APIs but not with bunch of XML
> (maybe my vision is also blurred by the distaste to XML
> configuration).
>
> Alex.
Re: How to substitute the placeholders in the config files ?
Posted by Alex Shneyderman <a....@gmail.com>.
> You seem to have leapt from 'spring in cxf' to 'no spring at all'? Why
> not take Glen's suggestion and use an app context with a property
> configurator?
Sorry, but the links do not help to see the solution to my particular
problem. I can see how to do it with APIs but not with bunch of XML
(maybe my vision is also blurred by the distaste to XML
configuration).
Alex.
Re: How to substitute the placeholders in the config files ?
Posted by Benson Margulies <bi...@gmail.com>.
You seem to have leapt from 'spring in cxf' to 'no spring at all'? Why
not take Glen's suggestion and use an app context with a property
configurator?
Re: How to substitute the placeholders in the config files ?
Posted by Alex Shneyderman <a....@gmail.com>.
Allright, thanks guys. So I gather for now I have no other options but
to do programmatic setup. In this case I have to ask another question.
Here is a sample of how to do it from the web:
URL wsdl = getClass().getResource("wsdl/greeting.wsdl");
SOAPService service = new SOAPService(wsdl, serviceName);
Greeter greeter = service.getPort(portName, Greeter.class);
// Okay, are you sick of configuration files ?
// This will show you how to configure the http conduit dynamically
Client client = ClientProxy.getClient(poltim);
HTTPConduit http = (HTTPConduit) client.getConduit();
in this code what is "poltim" ? in the call ClientProxy.getClient() ...
Thanks,
Alex.
On Dec 26, 2007 2:10 PM, Benson Margulies <bi...@gmail.com> wrote:
> The code Willem quoted was code I wrote, and it assumes that you are, as
> Glen suggests, using regular Spring configuration. Otherwise, you have
> no way to attach the Property code to CXF's bus as far as I know.
>
> We could have a JIRA suggesting that CXF allow ${} references to system
> properties in cxf.xml or cxf-servlet.xml, or even some scheme
> (-Dcxf.config.property.file?) to allow others. As far as I know,
> however, we haven't got that now.
>
>
> On Wed, 2007-12-26 at 08:03 -0500, Glen Mazza wrote:
> > Do a search on "staticResourceURL" in both of the files for what Willem
> > is referring to. I have not done this before, however.
> >
> > Also, IIRC cxf.xml is primarily for bus (generic endpoint)
> > configuration. I suspect you would want to use a regular Spring
> > configuration file (either a more hardwired cxf-servlet.xml or a manual
> > ApplicationContext file, see here[1][2]) for what you are doing. Making
> > such a switch might make it easier for you to modify properties in the
> > manner you desire below.
> >
> > Glen
> >
> > [1]
> > http://cwiki.apache.org/confluence/display/CXF20DOC/Configuration#Configuration-Serverconfigurationfiles
> >
> > [2] http://cwiki.apache.org/confluence/display/CXF20DOC/Standalone+HTTP
> > +Transport
> >
> >
Re: How to substitute the placeholders in the config files ?
Posted by Benson Margulies <bi...@gmail.com>.
The code Willem quoted was code I wrote, and it assumes that you are, as
Glen suggests, using regular Spring configuration. Otherwise, you have
no way to attach the Property code to CXF's bus as far as I know.
We could have a JIRA suggesting that CXF allow ${} references to system
properties in cxf.xml or cxf-servlet.xml, or even some scheme
(-Dcxf.config.property.file?) to allow others. As far as I know,
however, we haven't got that now.
On Wed, 2007-12-26 at 08:03 -0500, Glen Mazza wrote:
> Do a search on "staticResourceURL" in both of the files for what Willem
> is referring to. I have not done this before, however.
>
> Also, IIRC cxf.xml is primarily for bus (generic endpoint)
> configuration. I suspect you would want to use a regular Spring
> configuration file (either a more hardwired cxf-servlet.xml or a manual
> ApplicationContext file, see here[1][2]) for what you are doing. Making
> such a switch might make it easier for you to modify properties in the
> manner you desire below.
>
> Glen
>
> [1]
> http://cwiki.apache.org/confluence/display/CXF20DOC/Configuration#Configuration-Serverconfigurationfiles
>
> [2] http://cwiki.apache.org/confluence/display/CXF20DOC/Standalone+HTTP
> +Transport
>
>
> Am Mittwoch, den 26.12.2007, 12:05 +0100 schrieb Alex Shneyderman:
> > Could you explain how does it demo my case here?
> > I can not make sense of the XML you linked to.
> >
> >
> > On Dec 26, 2007 10:46 AM, Willem Jiang <wi...@gmail.com> wrote:
> > > Hi Alex ,
> > >
> > > Here is an example for your replace the ${} palceholders in the spring
> > > configuration file.
> > > Code :
> > > [1]https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
> > > Configuration file :
> > > [2]https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/jetty-engine.xml
> > >
> > > Willem.
> > >
> > >
> > > Alex Shneyderman wrote:
> > > > I have a cxf.xml that contains a section like this :
> > > >
> > > > <sec:trustManagers>
> > > > <sec:keyStore type="${securitystore.type}"
> > > > password="${securitystore.password}"
> > > > file="${securitystore.file}" />
> > > > </sec:trustManagers>
> > > >
> > > > how do I substitute all those ${} placeholders ?
> > > >
> > > > I tried to use PropertyPlaceholderConfigurer that of course did not work.
> > > >
> > > > Any ideas ?
> > > >
> > > >
> > >
> > >
> >
> >
> >
>
Re: How to substitute the placeholders in the config files ?
Posted by Glen Mazza <gl...@verizon.net>.
Do a search on "staticResourceURL" in both of the files for what Willem
is referring to. I have not done this before, however.
Also, IIRC cxf.xml is primarily for bus (generic endpoint)
configuration. I suspect you would want to use a regular Spring
configuration file (either a more hardwired cxf-servlet.xml or a manual
ApplicationContext file, see here[1][2]) for what you are doing. Making
such a switch might make it easier for you to modify properties in the
manner you desire below.
Glen
[1]
http://cwiki.apache.org/confluence/display/CXF20DOC/Configuration#Configuration-Serverconfigurationfiles
[2] http://cwiki.apache.org/confluence/display/CXF20DOC/Standalone+HTTP
+Transport
Am Mittwoch, den 26.12.2007, 12:05 +0100 schrieb Alex Shneyderman:
> Could you explain how does it demo my case here?
> I can not make sense of the XML you linked to.
>
>
> On Dec 26, 2007 10:46 AM, Willem Jiang <wi...@gmail.com> wrote:
> > Hi Alex ,
> >
> > Here is an example for your replace the ${} palceholders in the spring
> > configuration file.
> > Code :
> > [1]https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
> > Configuration file :
> > [2]https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/jetty-engine.xml
> >
> > Willem.
> >
> >
> > Alex Shneyderman wrote:
> > > I have a cxf.xml that contains a section like this :
> > >
> > > <sec:trustManagers>
> > > <sec:keyStore type="${securitystore.type}"
> > > password="${securitystore.password}"
> > > file="${securitystore.file}" />
> > > </sec:trustManagers>
> > >
> > > how do I substitute all those ${} placeholders ?
> > >
> > > I tried to use PropertyPlaceholderConfigurer that of course did not work.
> > >
> > > Any ideas ?
> > >
> > >
> >
> >
>
>
>
Re: How to substitute the placeholders in the config files ?
Posted by Willem Jiang <wi...@gmail.com>.
Hi Alex ,
Maybe this code can help your out.
applicationContext = new GenericApplicationContext();
readBeans(new ClassPathResource("cxf.xml"));
readBeans(new ClassPathResource("META-INF/cxf/cxf.xml"));
readBeans(new ClassPathResource("META-INF/cxf/cxf-extension-soap.xml"));
readBeans(new ClassPathResource("META-INF/cxf/cxf-extension-http.xml"));
readBeans(new ClassPathResource("META-INF/cxf/cxf-extension-http-jetty.xml"));
readBeans(new ClassPathResource("jetty-engine.xml", getClass()));
if (includeService) {
readBeans(new ClassPathResource("server-lifecycle-beans.xml", getClass()));
}
/**** bring in some property values from a Properties file ***/
PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
Properties properties = new Properties();
properties.setProperty("staticResourceURL", getStaticResourceURL());
cfg.setProperties(properties);
// now actually do the replacement
cfg.postProcessBeanFactory(applicationContext.getBeanFactory());
applicationContext.refresh();
Willem
Alex Shneyderman wrote:
> Could you explain how does it demo my case here?
> I can not make sense of the XML you linked to.
>
>
> On Dec 26, 2007 10:46 AM, Willem Jiang <wi...@gmail.com> wrote:
>
>> Hi Alex ,
>>
>> Here is an example for your replace the ${} palceholders in the spring
>> configuration file.
>> Code :
>> [1]https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
>> Configuration file :
>> [2]https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/jetty-engine.xml
>>
>> Willem.
>>
>>
>> Alex Shneyderman wrote:
>>
>>> I have a cxf.xml that contains a section like this :
>>>
>>> <sec:trustManagers>
>>> <sec:keyStore type="${securitystore.type}"
>>> password="${securitystore.password}"
>>> file="${securitystore.file}" />
>>> </sec:trustManagers>
>>>
>>> how do I substitute all those ${} placeholders ?
>>>
>>> I tried to use PropertyPlaceholderConfigurer that of course did not work.
>>>
>>> Any ideas ?
>>>
>>>
>>>
>>
>
>
>
>
Re: How to substitute the placeholders in the config files ?
Posted by Alex Shneyderman <a....@gmail.com>.
Could you explain how does it demo my case here?
I can not make sense of the XML you linked to.
On Dec 26, 2007 10:46 AM, Willem Jiang <wi...@gmail.com> wrote:
> Hi Alex ,
>
> Here is an example for your replace the ${} palceholders in the spring
> configuration file.
> Code :
> [1]https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
> Configuration file :
> [2]https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/jetty-engine.xml
>
> Willem.
>
>
> Alex Shneyderman wrote:
> > I have a cxf.xml that contains a section like this :
> >
> > <sec:trustManagers>
> > <sec:keyStore type="${securitystore.type}"
> > password="${securitystore.password}"
> > file="${securitystore.file}" />
> > </sec:trustManagers>
> >
> > how do I substitute all those ${} placeholders ?
> >
> > I tried to use PropertyPlaceholderConfigurer that of course did not work.
> >
> > Any ideas ?
> >
> >
>
>
--
Thanks,
Alex.
Re: How to substitute the placeholders in the config files ?
Posted by Willem Jiang <wi...@gmail.com>.
Hi Alex ,
Here is an example for your replace the ${} palceholders in the spring
configuration file.
Code :
[1]https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
Configuration file :
[2]https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/jetty-engine.xml
Willem.
Alex Shneyderman wrote:
> I have a cxf.xml that contains a section like this :
>
> <sec:trustManagers>
> <sec:keyStore type="${securitystore.type}"
> password="${securitystore.password}"
> file="${securitystore.file}" />
> </sec:trustManagers>
>
> how do I substitute all those ${} placeholders ?
>
> I tried to use PropertyPlaceholderConfigurer that of course did not work.
>
> Any ideas ?
>
>