Hi Rice
On 05/05/14 05:16, Rice Yeh wrote:
Hi Sergey,
   I ahve multiple http jaxrs server endpoints and would like to use a local
transport for communication between 2 endpoints. Possible?

The simplest approach is to make the same bean accessible over multiple transports, example:

<bean id="serviceBean" class="org.mycompany.ServiceBean"/>
<jaxrs:server address="http://books";>
   <jaxrs:serviceBeans>
      <ref bean="serviceBean"/>
   <jaxrs:serviceBeans>
</jaxrs:server>

<jaxrs:server address="local://books">
   <jaxrs:serviceBeans>
      <ref bean="serviceBean"/>
   <jaxrs:serviceBeans>
</jaxrs:server>

and then inject a local proxy into some other endpoint:

<jaxrs:client id="serviceBeanProxy" address="local://books" serviceClass="org.mycompany.ServiceBean"/>

<bean id="serviceBean2" class="org.mycompany.ServiceBean2">
   <property name="serviceBean" ref="serviceBeanProxy"/>
</bean>
<jaxrs:server address="http://books2";>
   <jaxrs:serviceBeans>
      <ref bean="serviceBean2"/>
   <jaxrs:serviceBeans>
</jaxrs:server>


This should do it. Mandy is also working on a new transport allowing for the efficient inter-war communications, watch
https://issues.apache.org/jira/browse/CXF-5727

Cheers, Sergey

Rice


On Mon, May 5, 2014 at 12:39 AM, Sergey Beryozkin <[email protected]>wrote:

Hi



On 03/05/14 09:03, Rice Yeh wrote:

Hi,
    Is it possible to access resources in a jaxrs:server which started from
CXFServlet with local transport like what is described in
https://cwiki.apache.org/confluence/display/CXF20DOC/JAXRS+Testing, where
the jaxrs:server is started with local protocol. I have this need because
I
need to touch some resources before a request has come in. The biggest
problem for me is that I do not know the port the web server is listening
on, so I cannot use java.net.URL("http://localhost:...) connect to the
server itself.


So you have say one HTTP jaxrs:server and one Local Transport jaxrs:
server and would like to invoke the former from the latter ?
Or do you have multiple HTTP jaxrs server endpoints and would like to use
a local transport for communicating between these 2 endpoints ?

Cheers, Sergey


Rice





Reply via email to