cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r755959 - in /cxf/branches/2.1.x-fixes: ./ rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/ rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ rt/frontend/jaxrs/src/main/java/o...
Date Thu, 19 Mar 2009 12:09:14 GMT
Author: sergeyb
Date: Thu Mar 19 12:09:13 2009
New Revision: 755959

URL: http://svn.apache.org/viewvc?rev=755959&view=rev
Log:
Merged revisions 747070 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r747070 | sergeyb | 2009-02-23 16:31:18 +0000 (Mon, 23 Feb 2009) | 1 line
  
  JAXRS : introducing jaxrs:client bean definition, tightening WebClient interface
........

Added:
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSClientFactoryBeanDefinitionParser.java
      - copied unchanged from r747070, cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSClientFactoryBeanDefinitionParser.java
Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/WrapperHelperCompiler.java
  (props changed)
    cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBWrapperHelperTest.java
  (props changed)
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactory.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/NamespaceHandler.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/resources/schemas/jaxrs.xsd
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSoapRestImpl.java
    cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Mar 19 12:09:13 2009
@@ -1 +1 @@
-/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997,705150,705235,705274,705340,705446,705548,705614,705692,705708,706482,706631,706675,706900,706909,707034,707089,707100,707902,708035,708044,708074,708410,708417,708550,708554,709353-709354,709425,710076,710150,71015
 4,711193,711388,711410,711490,711635,711949,711975,712194,712198,712238,712272,712299,712312,712670,712893,713082,713095-713096,713099,713584,713597,713737,713804,713899,714167-714168,714245,714255,717937-717961,718281-718448,718565,718620,718640,718665,718970,719017,719210,719215-719218,719222-719273,719305,719327-719680,720053,720119-720218,720238,720293-720316,720497,721221,721241,721501,722117,722129,722412,722988,723024,723338,723378,723716-723791,724333-724372,724433-724438,724449,724481,724485,724668,724780,724782,724785,724793,724795,724940,725071,725316,725332,725335,725348,725364,725418,725425-725426,725455,725506,725554,725562,725651,725671,725688,725754,725773,725799,725839,726342,726524,726631,726634,726637,726639,726692,726724,726769,726992,727096,727445,727521,727568,727692,727754,727781,727792,728070,728087,728696,728897,729051,729430,729449,729460,729863,730082,730139,730889,730891,731598,731604,731615,731631,731635,732036,732050,732320,732363,732411,732450,
 732710,732773,732827,732829,733512,733582,733901,734367,734462,734666,734762,734772,734812,734836,734965,735113,735252,735722-735723,735729,735734,735751,735782,735787,735987,736332,736343,736352,736358-736362,736408,736423,736448,736491,736621,736726,736736,736738-736739,736766,736825,736852,737032,737046,737061,737069,737124,737237,737246,737299,737356,737494,737498,737761,737817,737849,737855,737994,738166,738178,738201,738210,738242,738244,738265,738516,738583,738863,738937,738983,739366-739367,739451-739452,739799-739800,739867,739876-739877,739922,739937,739990,740045,740108,740154,740186,740197,740255,740706,740730,740810,740844,740886,740902,740923,740994,741058,741124,741152,741188,741521,741529,741879,742914,743087,743439,743441,743459,743469,743825,743965,743967,744104-744138,744175,744195,744237,744756,745214,745243,745472,745474,745560,745578,745586,745592,745638,745950,746012,746019-746020,746256,746266,746306,746357,746373-746374,746947,747026,747217,747386,74
 7406,747454,747649,747766,747986,748159,748192,748223,748305,748313,748603-748604,748768,749420,749449,749454-749456,749505,749511,749513,749584,749767,749771,749799,749890,750059-750060,750302,750591,750689,750935,751067-751110,751233,751527,751567,751576,751607,751732,751740,751787,751828,751840,751972-751974,752122,752132,752136,752558,752613,752680,752728,752753,752849,752880-752881,752883,752961,752992,753205,753293,753335,753338,753388,755153,755514,755806
+/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997,705150,705235,705274,705340,705446,705548,705614,705692,705708,706482,706631,706675,706900,706909,707034,707089,707100,707902,708035,708044,708074,708410,708417,708550,708554,709353-709354,709425,710076,710150,71015
 4,711193,711388,711410,711490,711635,711949,711975,712194,712198,712238,712272,712299,712312,712670,712893,713082,713095-713096,713099,713584,713597,713737,713804,713899,714167-714168,714245,714255,717937-717961,718281-718448,718565,718620,718640,718665,718970,719017,719210,719215-719218,719222-719273,719305,719327-719680,720053,720119-720218,720238,720293-720316,720497,721221,721241,721501,722117,722129,722412,722988,723024,723338,723378,723716-723791,724333-724372,724433-724438,724449,724481,724485,724668,724780,724782,724785,724793,724795,724940,725071,725316,725332,725335,725348,725364,725418,725425-725426,725455,725506,725554,725562,725651,725671,725688,725754,725773,725799,725839,726342,726524,726631,726634,726637,726639,726692,726724,726769,726992,727096,727445,727521,727568,727692,727754,727781,727792,728070,728087,728696,728897,729051,729430,729449,729460,729863,730082,730139,730889,730891,731598,731604,731615,731631,731635,732036,732050,732320,732363,732411,732450,
 732710,732773,732827,732829,733512,733582,733901,734367,734462,734666,734762,734772,734812,734836,734965,735113,735252,735722-735723,735729,735734,735751,735782,735787,735987,736332,736343,736352,736358-736362,736408,736423,736448,736491,736621,736726,736736,736738-736739,736766,736825,736852,737032,737046,737061,737069,737124,737237,737246,737299,737356,737494,737498,737761,737817,737849,737855,737994,738166,738178,738201,738210,738242,738244,738265,738516,738583,738863,738937,738983,739366-739367,739451-739452,739799-739800,739867,739876-739877,739922,739937,739990,740045,740108,740154,740186,740197,740255,740706,740730,740810,740844,740886,740902,740923,740994,741058,741124,741152,741188,741521,741529,741879,742914,743087,743439,743441,743459,743469,743825,743965,743967,744104-744138,744175,744195,744237,744756,745214,745243,745472,745474,745560,745578,745586,745592,745638,745950,746012,746019-746020,746256,746266,746306,746357,746373-746374,746947,747026,747070,747217,74
 7386,747406,747454,747649,747766,747986,748159,748192,748223,748305,748313,748603-748604,748768,749420,749449,749454-749456,749505,749511,749513,749584,749767,749771,749799,749890,750059-750060,750302,750591,750689,750935,751067-751110,751233,751527,751567,751576,751607,751732,751740,751787,751828,751840,751972-751974,752122,752132,752136,752558,752613,752680,752728,752753,752849,752880-752881,752883,752961,752992,753205,753293,753335,753338,753388,755153,755514,755806

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Propchange: cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/WrapperHelperCompiler.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Mar 19 12:09:13 2009
@@ -1 +1 @@
-/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/WrapperHelperCompiler.java:743825,744104-744138,745472,745474,746947,747026,755514,755806
+/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/WrapperHelperCompiler.java:743825,744104-744138,745472,745474,746947,747026,747070,755514,755806

Propchange: cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBWrapperHelperTest.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Mar 19 12:09:13 2009
@@ -1 +1 @@
-/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBWrapperHelperTest.java:743825,744104-744138,745472,745474,746947,747026,755514,755806
+/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBWrapperHelperTest.java:743825,744104-744138,745472,745474,746947,747026,747070,755514,755806

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java?rev=755959&r1=755958&r2=755959&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java
Thu Mar 19 12:09:13 2009
@@ -119,13 +119,6 @@
         createResourceInfo(cls, isRoot);
     }
     
-    public void setResourceClassFromBean(Object o) {
-        classResourceInfos.clear();
-        Class<?> realClass = ClassHelper.getRealClass(o);
-        boolean isRoot = AnnotationUtils.getClassAnnotation(realClass, Path.class) != null;
-        createResourceInfo(realClass, isRoot);
-    }
-    
     public void setResourceClasses(List<Class> classes) {
         for (Class resourceClass : classes) {
             createResourceInfo(resourceClass, true);

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java?rev=755959&r1=755958&r2=755959&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
Thu Mar 19 12:09:13 2009
@@ -45,6 +45,8 @@
 import javax.ws.rs.ext.MessageBodyWriter;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.common.util.ModCountCopyOnWriteArrayList;
 import org.apache.cxf.endpoint.ConduitSelector;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.helpers.IOUtils;
@@ -65,7 +67,8 @@
 public class AbstractClient implements Client {
 
     protected static final MediaType WILDCARD = MediaType.valueOf("*/*");
-        
+    protected List<Interceptor> inInterceptors = new ModCountCopyOnWriteArrayList<Interceptor>();
+    protected List<Interceptor> outInterceptors = new ModCountCopyOnWriteArrayList<Interceptor>();
     protected ConduitSelector conduitSelector;
     protected Bus bus;
     
@@ -200,58 +203,6 @@
         return this;
     }
     
-    public void setConduitSelector(ConduitSelector cs) {
-        this.conduitSelector = cs;
-    }
-    
-    public void setBus(Bus bus) {
-        this.bus = bus;
-    }
-    
-    protected void prepareConduitSelector(Message message) {
-        conduitSelector.prepare(message);
-        message.getExchange().put(ConduitSelector.class, conduitSelector);
-    }
-    
-    protected PhaseInterceptorChain setupInterceptorChain(Endpoint endpoint) { 
-        PhaseManager pm = bus.getExtension(PhaseManager.class);
-        List<Interceptor> i1 = bus.getOutInterceptors();
-        // TODO : make sure we don't forget the out interceptors of this client
-        List<Interceptor> i2 = endpoint.getOutInterceptors();
-        return new PhaseChainCache().get(pm.getOutPhases(), i1, i2);
-    }
-    
-    protected Message createMessage(String httpMethod, 
-                                    MultivaluedMap<String, String> headers,
-                                    String address,
-                                    MessageObserver observer) {
-        Message m = conduitSelector.getEndpoint().getBinding().createMessage();
-        m.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
-        m.put(Message.INBOUND_MESSAGE, Boolean.FALSE);
-        
-        m.put(Message.HTTP_REQUEST_METHOD, httpMethod);
-        m.put(Message.PROTOCOL_HEADERS, headers);
-        m.put(Message.ENDPOINT_ADDRESS, address);
-        m.put(Message.CONTENT_TYPE, headers.getFirst(HttpHeaders.CONTENT_TYPE));
-        
-        
-        Exchange exchange = new ExchangeImpl();
-        exchange.setSynchronous(true);
-        exchange.setOutMessage(m);
-        exchange.put(Bus.class, bus);
-        exchange.put(MessageObserver.class, observer);
-        exchange.setOneWay(false);
-        m.setExchange(exchange);
-        
-        PhaseInterceptorChain chain = setupInterceptorChain(conduitSelector.getEndpoint());
-        m.setInterceptorChain(chain);
-        
-        //setup conduit selector
-        prepareConduitSelector(m);
-        
-        return m;
-    }
-    
     protected List<MediaType> getAccept() {
         List<String> headers = requestHeaders.get(HttpHeaders.ACCEPT);
         if (headers == null || headers.size() == 0) {
@@ -403,5 +354,93 @@
             conn.setRequestProperty(entry.getKey(), b.toString());
         }
     }
+    
+    protected void setConduitSelector(ConduitSelector cs) {
+        this.conduitSelector = cs;
+    }
+    
+    protected void setBus(Bus bus) {
+        this.bus = bus;
+    }
+    
+    protected void prepareConduitSelector(Message message) {
+        conduitSelector.prepare(message);
+        message.getExchange().put(ConduitSelector.class, conduitSelector);
+    }
+    
+    protected PhaseInterceptorChain setupOutInterceptorChain(Endpoint endpoint) { 
+        PhaseManager pm = bus.getExtension(PhaseManager.class);
+        List<Interceptor> i1 = bus.getOutInterceptors();
+        List<Interceptor> i2 = outInterceptors;
+        List<Interceptor> i3 = endpoint.getOutInterceptors();
+        return new PhaseChainCache().get(pm.getOutPhases(), i1, i2, i3);
+    }
+    
+    protected PhaseInterceptorChain setupInInterceptorChain(Endpoint endpoint) { 
+        PhaseManager pm = bus.getExtension(PhaseManager.class);
+        List<Interceptor> i1 = bus.getInInterceptors();
+        List<Interceptor> i2 = inInterceptors;
+        List<Interceptor> i3 = endpoint.getInInterceptors();
+        return new PhaseChainCache().get(pm.getInPhases(), i1, i2, i3);
+    }
+    
+    protected Message createMessage(String httpMethod, 
+                                    MultivaluedMap<String, String> headers,
+                                    String address) {
+        Message m = conduitSelector.getEndpoint().getBinding().createMessage();
+        m.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
+        m.put(Message.INBOUND_MESSAGE, Boolean.FALSE);
+        
+        m.put(Message.HTTP_REQUEST_METHOD, httpMethod);
+        m.put(Message.PROTOCOL_HEADERS, headers);
+        m.put(Message.ENDPOINT_ADDRESS, address);
+        m.put(Message.CONTENT_TYPE, headers.getFirst(HttpHeaders.CONTENT_TYPE));
+        
+        
+        Exchange exchange = new ExchangeImpl();
+        exchange.setSynchronous(true);
+        exchange.setOutMessage(m);
+        exchange.put(Bus.class, bus);
+        exchange.put(MessageObserver.class, new ClientMessageObserver());
+        exchange.setOneWay(false);
+        m.setExchange(exchange);
+        
+        PhaseInterceptorChain chain = setupOutInterceptorChain(conduitSelector.getEndpoint());
+        m.setInterceptorChain(chain);
+        
+        //setup conduit selector
+        prepareConduitSelector(m);
+        
+        return m;
+    }
+
+    protected void setInInterceptors(List<Interceptor> interceptors) {
+        inInterceptors = interceptors;
+    }
+
+    protected void setOutInterceptors(List<Interceptor> interceptors) {
+        outInterceptors = interceptors;
+    }
+    
+    private class ClientMessageObserver implements MessageObserver {
 
+        public void onMessage(Message m) {
+            
+            Message message = conduitSelector.getEndpoint().getBinding().createMessage(m);
+            message.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
+            message.put(Message.INBOUND_MESSAGE, Boolean.TRUE);
+            PhaseInterceptorChain chain = setupInInterceptorChain(conduitSelector.getEndpoint());
+            message.setInterceptorChain(chain);
+            Bus origBus = BusFactory.getThreadDefaultBus(false);
+            BusFactory.setThreadDefaultBus(bus);
+
+            // execute chain
+            try {
+                chain.doIntercept(message);
+            } finally {
+                BusFactory.setThreadDefaultBus(origBus);
+            }
+        }
+        
+    }
 }

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java?rev=755959&r1=755958&r2=755959&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
Thu Mar 19 12:09:13 2009
@@ -54,10 +54,9 @@
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageContentsList;
 import org.apache.cxf.phase.Phase;
-import org.apache.cxf.transport.MessageObserver;
 import org.apache.cxf.transport.http.HTTPConduit;
 
-public class ClientProxyImpl extends AbstractClient implements InvocationHandler, MessageObserver
{
+public class ClientProxyImpl extends AbstractClient implements InvocationHandler {
 
     private ClassResourceInfo cri;
     private boolean inheritHeaders;
@@ -112,6 +111,8 @@
             ClientProxyImpl proxyImpl = new ClientProxyImpl(getBaseURI(), uri, subCri, inheritHeaders);
             proxyImpl.setBus(bus);
             proxyImpl.setConduitSelector(conduitSelector);
+            proxyImpl.setInInterceptors(inInterceptors);
+            proxyImpl.setOutInterceptors(outInterceptors);
             
             Object proxy = JAXRSClientFactory.create(m.getReturnType(), proxyImpl);
             if (inheritHeaders) {
@@ -361,7 +362,7 @@
     private Object doChainedInvocation(URI uri, MultivaluedMap<String, String> headers,

                           OperationResourceInfo ori, Object[] params, int bodyIndex, 
                           MultivaluedMap<ParameterType, Parameter> types) throws Throwable
{
-        Message m = createMessage(ori.getHttpMethod(), headers, uri.toString(), this);
+        Message m = createMessage(ori.getHttpMethod(), headers, uri.toString());
         
         if (bodyIndex != -1 || types.containsKey(ParameterType.FORM)) {
             m.setContent(OperationResourceInfo.class, ori);
@@ -429,10 +430,6 @@
         }
     }
 
-    public void onMessage(Message message) {
-        // just do nothing for now
-    }
-    
     // TODO : what we really need to do is to refactor JAXRSOutInterceptor so that
     // it can handle both client requests and server responses - it may need to be split
into
     // several interceptors - in fact we need to do the same for JAXRSInInterceptor so that
we can do

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactory.java?rev=755959&r1=755958&r2=755959&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactory.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactory.java
Thu Mar 19 12:09:13 2009
@@ -43,6 +43,14 @@
         return create(baseURI, cls, false);
     }
     
+    /**
+     * Creates a proxy
+     * @param baseURI baseURI
+     * @param cls proxy class, if not interface then a CGLIB proxy will be created
+     * @param inheritHeaders if true then subresource proxies will inherit the headers
+     *        set on parent proxies 
+     * @return typed proxy
+     */
     public static <T> T create(URI baseURI, Class<T> cls, boolean inheritHeaders)
{
         
         return create(baseURI, cls, inheritHeaders, false);
@@ -60,7 +68,7 @@
         if (!direct) {
             JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
             bean.setAddress(baseURI.toString());
-            bean.setResourceClass(cls);
+            bean.setServiceClass(cls);
             bean.setInheritHeaders(inheritHeaders);
             return bean.create(cls);
         } else {
@@ -88,6 +96,13 @@
         return proxy;
     }
     
+    /**
+     * Creates a proxy, baseURI will be set to Client currentURI
+     *   
+     * @param client Client instance
+     * @param cls proxy class, if not interface then a CGLIB proxy will be created
+     * @return typed proxy
+     */
     public static <T> T fromClient(Client client, Class<T> cls) {
         if (cls.isAssignableFrom(client.getClass())) {
             return cls.cast(client);
@@ -95,6 +110,14 @@
         return fromClient(client, cls, false);
     }
     
+    /**
+     * Creates a proxy, baseURI will be set to Client currentURI
+     * @param client Client instance
+     * @param cls proxy class, if not interface then a CGLIB proxy will be created
+     * @param inheritHeaders if true then existing Client headers will be inherited by new
proxy 
+     *        and subresource proxies if any 
+     * @return typed proxy
+     */
     public static <T> T fromClient(Client client, Class<T> cls, boolean inheritHeaders)
{
         return fromClient(client, cls, inheritHeaders, false);
     }
@@ -103,8 +126,9 @@
      * Creates a proxy, baseURI will be set to Client currentURI
      * @param client Client instance
      * @param cls proxy class, if not interface then a CGLIB proxy will be created
-     * @param inheritHeaders if existing Client headers can be inherited by new proxy 
+     * @param inheritHeaders if true then existing Client headers will be inherited by new
proxy 
      *        and subresource proxies if any 
+     * @param direct if true then no bus and chains will be created       
      * @return typed proxy
      */
     public static <T> T fromClient(Client client, Class<T> cls, boolean inheritHeaders,
boolean direct) {

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java?rev=755959&r1=755958&r2=755959&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java
Thu Mar 19 12:09:13 2009
@@ -52,11 +52,11 @@
     }
     
     public void setResourceClass(Class cls) {
-        serviceFactory.setResourceClass(cls);
+        setServiceClass(cls);
     }
     
-    public void setResourceBean(Object o) {
-        serviceFactory.setResourceClassFromBean(o);
+    public void setServiceClass(Class cls) {
+        serviceFactory.setResourceClass(cls);
     }
     
     public WebClient createWebClient() {
@@ -69,6 +69,8 @@
             WebClient client = new WebClient(getAddress());
             client.setConduitSelector(getConduitSelector(ep));
             client.setBus(getBus());
+            client.setOutInterceptors(getOutInterceptors());
+            client.setInInterceptors(getInInterceptors());
             
             return client;
         } catch (Exception ex) {
@@ -96,6 +98,8 @@
             ClientProxyImpl proxyImpl = new ClientProxyImpl(baseURI, baseURI, cri, inheritHeaders);
             proxyImpl.setConduitSelector(getConduitSelector(ep));
             proxyImpl.setBus(getBus());
+            proxyImpl.setOutInterceptors(getOutInterceptors());
+            proxyImpl.setInInterceptors(getInInterceptors());
             
             return (Client)ProxyHelper.getProxy(cri.getServiceClass().getClassLoader(),
                                         new Class[]{cri.getServiceClass(), Client.class},


Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java?rev=755959&r1=755958&r2=755959&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
Thu Mar 19 12:09:13 2009
@@ -46,12 +46,11 @@
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageContentsList;
 import org.apache.cxf.phase.Phase;
-import org.apache.cxf.transport.MessageObserver;
 import org.apache.cxf.transport.http.HTTPConduit;
 
 
 
-public class WebClient extends AbstractClient implements MessageObserver {
+public class WebClient extends AbstractClient {
     
     public WebClient(String baseAddress) {
         this(URI.create(baseAddress));
@@ -287,7 +286,7 @@
     protected Response doChainedInvocation(String httpMethod, 
         MultivaluedMap<String, String> headers, Object body, Class<?> responseClass)
{
 
-        Message m = createMessage(httpMethod, headers, getCurrentURI().toString(), this);
+        Message m = createMessage(httpMethod, headers, getCurrentURI().toString());
         
         if (body != null) {
             MessageContentsList contents = new MessageContentsList(body);
@@ -358,7 +357,5 @@
         
     }
 
-    public void onMessage(Message message) {
-        // do nothing for now
-    }
+    
 }

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/NamespaceHandler.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/NamespaceHandler.java?rev=755959&r1=755958&r2=755959&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/NamespaceHandler.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/NamespaceHandler.java
Thu Mar 19 12:09:13 2009
@@ -23,6 +23,7 @@
 
 public class NamespaceHandler extends NamespaceHandlerSupport {
     public void init() {
+        registerBeanDefinitionParser("client", new JAXRSClientFactoryBeanDefinitionParser());
         registerBeanDefinitionParser("server", new JAXRSServerFactoryBeanDefinitionParser());
       
         registerBeanDefinitionParser("schemaLocation", new StringBeanDefinitionParser());
   
     }

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/resources/schemas/jaxrs.xsd
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/resources/schemas/jaxrs.xsd?rev=755959&r1=755958&r2=755959&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/resources/schemas/jaxrs.xsd (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/resources/schemas/jaxrs.xsd Thu Mar
19 12:09:13 2009
@@ -65,6 +65,31 @@
     </xsd:complexType>
   </xsd:element>
   
+  <xsd:element name="client">
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:extension base="beans:identifiedType">
+          <xsd:all>
+            <xsd:element name="binding" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="executor" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="features" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="inInterceptors" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="inFaultInterceptors" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="invoker" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="outInterceptors" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="outFaultInterceptors" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="properties" type="beans:mapType" minOccurs="0"/>
+            <xsd:element name="providers" type="xsd:anyType" minOccurs="0"/>
+          </xsd:all>
+          <xsd:attributeGroup ref="cxf-beans:beanAttributes"/>
+          <xsd:attribute name="address" type="xsd:string" />
+          <xsd:attribute name="serviceClass" type="xsd:string"/>
+          <xsd:attribute name="bus" type="xsd:string" />
+        </xsd:extension>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+  
   <xsd:complexType name="schemasType">
     <xsd:sequence>
       <xsd:element name="schemaLocation" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>

Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSoapRestImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSoapRestImpl.java?rev=755959&r1=755958&r2=755959&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSoapRestImpl.java
(original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSoapRestImpl.java
Thu Mar 19 12:09:13 2009
@@ -22,6 +22,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 import javax.jws.WebMethod;
 import javax.servlet.http.HttpServletRequest;
@@ -29,6 +30,7 @@
 import javax.ws.rs.core.Response;
 import javax.xml.ws.WebServiceContext;
 
+import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.jaxrs.ext.MessageContext;
 
 public class BookStoreSoapRestImpl implements BookStoreJaxrsJaxws {
@@ -40,16 +42,35 @@
     @Resource
     private MessageContext jaxrsContext;
     
+    @Resource(name = "restClient")
+    private BookStoreJaxrsJaxws webClient;
+    private boolean invocationInProcess;
+    
     public BookStoreSoapRestImpl() {
         init();
     }
     
-    public Book getBook(Long id) {
+    @PostConstruct
+    public void verifyWebClient() {
+        if (webClient == null) {
+            throw new RuntimeException();
+        }
+        WebClient.client(webClient).accept("application/xml");
+    }
+    
+    public Book getBook(Long id) throws BookNotFoundFault {
         if (books.get(id) == null) {
             Response r = Response.status(404).header("BOOK-HEADER", 
                 "No Book with id " + id + " is available").build();
             throw new WebApplicationException(r);
         }
+        
+        if (!invocationInProcess) {
+            invocationInProcess = true;
+            return webClient.getBook(id);
+        }
+        invocationInProcess = false;
+        
         System.out.println(getContentType());
         return books.get(id);
     }

Modified: cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml?rev=755959&r1=755958&r2=755959&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml
(original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml
Thu Mar 19 12:09:13 2009
@@ -35,6 +35,12 @@
   <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
   <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
 
+  <jaxrs:client id="restClient"
+         address="http://localhost:9092/test/services/rest"
+         serviceClass="org.apache.cxf.systest.jaxrs.BookStoreJaxrsJaxws"/>
+         
+  <bean id="bookstore" class="org.apache.cxf.systest.jaxrs.BookStoreSoapRestImpl"/>
+
   <jaxws:endpoint xmlns:s="http://books.com"
       serviceName="s:BookService"
       endpointName="s:BookPort"
@@ -48,7 +54,6 @@
       <ref bean="bookstore"/>
     </jaxrs:serviceBeans>		   
   </jaxrs:server>
-  <bean id="bookstore" class="org.apache.cxf.systest.jaxrs.BookStoreSoapRestImpl"/>
 
   <jaxws:endpoint xmlns:s="http://books.com"
       serviceName="s:BookService"



Mime
View raw message