Camel CXFRS and WADL generation

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Camel CXFRS and WADL generation

Goodwin, Matthew
I am using Camel version 2.14.2 and CXF version 2.7.15 and I have been unable to get the publishedEndpointUrl property to work with WADL generation.  Here is my Camel config:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:jaxws="http://cxf.apache.org/jaxws"
       xmlns:util="http://www.springframework.org/schema/util" xmlns:cxf="http://camel.apache.org/schema/cxf"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
              http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
              http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
              http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
              http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">

       <import resource="classpath:spring-shiro-core.xml" />
       <import resource="classpath:spring-tx-config.xml" />

       <bean id="messageSource"
              class="org.springframework.context.support.ResourceBundleMessageSource">
              <property name="basenames">
                     <list>
                           <value>messages</value>
                     </list>
              </property>
              <property name="fallbackToSystemLocale" value="true" />
       </bean>

       <!-- Wire up and configure web service end points -->

       <bean id="railincEtaService"
              class="com.railinc.reta.web.services.r2015v1.rest.impl.RailincEtaServiceImpl">
              <property name="retaRequestService" ref="retaRequestService" />
              <property name="messageSource" ref="messageSource" />
       </bean>

       <cxf:rsServer id="rsServer" address="/reta" bus="cxf"
              loggingFeatureEnabled="true" loggingSizeLimit="20" >
              <cxf:properties>
                     <entry key="publishedEndpointUrl" value="http://myhost:8080/reta/services"/>
              </cxf:properties>
              <cxf:serviceBeans>
                     <ref bean="railincEtaService" />
              </cxf:serviceBeans>
       </cxf:rsServer>
</beans>

When I step through the code I can see the publishedEndpointUrl is getting placed in the properties map of the Endpoint but this snip of code in the org.apache.cxf.jaxrs.model.wadl.WadlGenerator doesn't use properties on the EndpointUrl but instead uses the properties map on the EndpointInfo class which I'm not sure how is set.  Here is the code I am referencing in that class:

private String getBaseURI(Message m, UriInfo ui) {
        EndpointInfo ei = m.getExchange().get(Endpoint.class).getEndpointInfo();
        String publishedEndpointUrl = (String)ei.getProperty("publishedEndpointUrl");
        if (publishedEndpointUrl == null) {
            return ui.getBaseUri().toString();
        } else {
            return publishedEndpointUrl;
        }
    }

So I guess my question is how do I set the publishedEndpointUrl property correctly on the cxfrs component?

Thanks,

Matt


________________________________

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.
Reply | Threaded
Open this post in threaded view
|

Re: Camel CXFRS and WADL generation

Sergey Beryozkin
Hi

This is probably more of a CXF question, you can directly configure
org.apache.cxf.jaxrs.model.wadl.WADLGenerator, set it as a bean inside
cxf:rsServer/cxf:providers, and configure it with the
publishedEndpoitUrl property,

HTH, Sergey
On 13/06/15 01:27, Goodwin, Matthew wrote:

> I am using Camel version 2.14.2 and CXF version 2.7.15 and I have been unable to get the publishedEndpointUrl property to work with WADL generation.  Here is my Camel config:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
>         xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:jaxws="http://cxf.apache.org/jaxws"
>         xmlns:util="http://www.springframework.org/schema/util" xmlns:cxf="http://camel.apache.org/schema/cxf"
>         xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
>                http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
>                http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
>                http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
>                http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
>                http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
>
>         <import resource="classpath:spring-shiro-core.xml" />
>         <import resource="classpath:spring-tx-config.xml" />
>
>         <bean id="messageSource"
>                class="org.springframework.context.support.ResourceBundleMessageSource">
>                <property name="basenames">
>                       <list>
>                             <value>messages</value>
>                       </list>
>                </property>
>                <property name="fallbackToSystemLocale" value="true" />
>         </bean>
>
>         <!-- Wire up and configure web service end points -->
>
>         <bean id="railincEtaService"
>                class="com.railinc.reta.web.services.r2015v1.rest.impl.RailincEtaServiceImpl">
>                <property name="retaRequestService" ref="retaRequestService" />
>                <property name="messageSource" ref="messageSource" />
>         </bean>
>
>         <cxf:rsServer id="rsServer" address="/reta" bus="cxf"
>                loggingFeatureEnabled="true" loggingSizeLimit="20" >
>                <cxf:properties>
>                       <entry key="publishedEndpointUrl" value="http://myhost:8080/reta/services"/>
>                </cxf:properties>
>                <cxf:serviceBeans>
>                       <ref bean="railincEtaService" />
>                </cxf:serviceBeans>
>         </cxf:rsServer>
> </beans>
>
> When I step through the code I can see the publishedEndpointUrl is getting placed in the properties map of the Endpoint but this snip of code in the org.apache.cxf.jaxrs.model.wadl.WadlGenerator doesn't use properties on the EndpointUrl but instead uses the properties map on the EndpointInfo class which I'm not sure how is set.  Here is the code I am referencing in that class:
>
> private String getBaseURI(Message m, UriInfo ui) {
>          EndpointInfo ei = m.getExchange().get(Endpoint.class).getEndpointInfo();
>          String publishedEndpointUrl = (String)ei.getProperty("publishedEndpointUrl");
>          if (publishedEndpointUrl == null) {
>              return ui.getBaseUri().toString();
>          } else {
>              return publishedEndpointUrl;
>          }
>      }
>
> So I guess my question is how do I set the publishedEndpointUrl property correctly on the cxfrs component?
>
> Thanks,
>
> Matt
>
>
> ________________________________
>
> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.
>

Reply | Threaded
Open this post in threaded view
|

RE: Camel CXFRS and WADL generation

Goodwin, Matthew
Ok. Thanks. I will go that approach.

Matt

-----Original Message-----
From: Sergey Beryozkin [mailto:[hidden email]]
Sent: Monday, June 15, 2015 5:44 AM
To: [hidden email]
Subject: Re: Camel CXFRS and WADL generation

Hi

This is probably more of a CXF question, you can directly configure org.apache.cxf.jaxrs.model.wadl.WADLGenerator, set it as a bean inside cxf:rsServer/cxf:providers, and configure it with the publishedEndpoitUrl property,

HTH, Sergey
On 13/06/15 01:27, Goodwin, Matthew wrote:

> I am using Camel version 2.14.2 and CXF version 2.7.15 and I have been unable to get the publishedEndpointUrl property to work with WADL generation.  Here is my Camel config:
>
> <?xml version="1.0" encoding="UTF-8"?> <beans
> xmlns="http://www.springframework.org/schema/beans"
>         xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:jaxws="http://cxf.apache.org/jaxws"
>         xmlns:util="http://www.springframework.org/schema/util" xmlns:cxf="http://camel.apache.org/schema/cxf"
>         xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
>                http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
>                http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
>                http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
>                http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
>                http://www.springframework.org/schema/tx
> http://www.springframework.org/schema/tx/spring-tx.xsd">
>
>         <import resource="classpath:spring-shiro-core.xml" />
>         <import resource="classpath:spring-tx-config.xml" />
>
>         <bean id="messageSource"
>                class="org.springframework.context.support.ResourceBundleMessageSource">
>                <property name="basenames">
>                       <list>
>                             <value>messages</value>
>                       </list>
>                </property>
>                <property name="fallbackToSystemLocale" value="true" />
>         </bean>
>
>         <!-- Wire up and configure web service end points -->
>
>         <bean id="railincEtaService"
>                class="com.railinc.reta.web.services.r2015v1.rest.impl.RailincEtaServiceImpl">
>                <property name="retaRequestService" ref="retaRequestService" />
>                <property name="messageSource" ref="messageSource" />
>         </bean>
>
>         <cxf:rsServer id="rsServer" address="/reta" bus="cxf"
>                loggingFeatureEnabled="true" loggingSizeLimit="20" >
>                <cxf:properties>
>                       <entry key="publishedEndpointUrl" value="http://myhost:8080/reta/services"/>
>                </cxf:properties>
>                <cxf:serviceBeans>
>                       <ref bean="railincEtaService" />
>                </cxf:serviceBeans>
>         </cxf:rsServer>
> </beans>
>
> When I step through the code I can see the publishedEndpointUrl is getting placed in the properties map of the Endpoint but this snip of code in the org.apache.cxf.jaxrs.model.wadl.WadlGenerator doesn't use properties on the EndpointUrl but instead uses the properties map on the EndpointInfo class which I'm not sure how is set.  Here is the code I am referencing in that class:
>
> private String getBaseURI(Message m, UriInfo ui) {
>          EndpointInfo ei = m.getExchange().get(Endpoint.class).getEndpointInfo();
>          String publishedEndpointUrl = (String)ei.getProperty("publishedEndpointUrl");
>          if (publishedEndpointUrl == null) {
>              return ui.getBaseUri().toString();
>          } else {
>              return publishedEndpointUrl;
>          }
>      }
>
> So I guess my question is how do I set the publishedEndpointUrl property correctly on the cxfrs component?
>
> Thanks,
>
> Matt
>
>
> ________________________________
>
> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.
>


________________________________

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.