cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r755619 - 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/client/ rt/frontend/jaxrs/src/main...
Date Wed, 18 Mar 2009 15:41:16 GMT
Author: sergeyb
Date: Wed Mar 18 15:41:14 2009
New Revision: 755619

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

........
  r743825 | sergeyb | 2009-02-12 18:26:07 +0000 (Thu, 12 Feb 2009) | 1 line
  
  JAXRS : prototyping client api - many more things to come
........

Added:
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/
      - copied from r743825, cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
      - copied, changed from r743825, cxf/trunk/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/Client.java
      - copied unchanged from r743825, cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/Client.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
      - copied, changed from r743825, cxf/trunk/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
      - copied unchanged from r743825, cxf/trunk/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/ResponseExceptionMapper.java
      - copied unchanged from r743825, cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ResponseExceptionMapper.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
      - copied, changed from r743825, cxf/trunk/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/ext/form/
      - copied from r743825, cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/form/
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/form/Form.java
      - copied unchanged from r743825, cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/form/Form.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java
      - copied, changed from r743825, cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/client/
      - copied from r743825, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/client/
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/client/WebClientTest.java
      - copied unchanged from r743825, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/client/WebClientTest.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/FormEncodingProviderTest.java
      - copied, changed from r743825, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/FormEncodingProviderTest.java
Removed:
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingReaderProvider.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/StringProvider.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/FormEncodingReaderProviderTest.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/impl/MetadataMap.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestImpl.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseBuilderImpl.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProvider.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ParameterType.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/RequestImplTest.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookNotFoundFault.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreJaxrsJaxws.java
    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/java/org/apache/cxf/systest/jaxrs/BookSubresource.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresourceImpl.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.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 Wed Mar 18 15:41:14 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,743965,743967,744175,744195,744237,744756,745214,745243,745560,745578,745586,745592,745638,745950,746012,746019-746020,746256,746266,746306,746357,746373-746374,747217,747386,747406,747454,747649,747766,747986,748159,748192,74
 8223,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
+/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,744175,744195,744237,744756,745214,745243,745560,745578,745586,745592,745638,745950,746012,746019-746020,746256,746266,746306,746357,746373-746374,747217,747386,747406,747454,747649,747766,747986,748159,74
 8192,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

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 Wed Mar 18 15:41:14 2009
@@ -1 +1 @@
-/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/WrapperHelperCompiler.java:755514
+/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/WrapperHelperCompiler.java:743825,755514

Propchange: cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBWrapperHelperTest.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Mar 18 15:41:14 2009
@@ -1 +1 @@
-/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBWrapperHelperTest.java:755514
+/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBWrapperHelperTest.java:743825,755514

Copied: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java (from r743825, cxf/trunk/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?p2=cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java&p1=cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java&r1=743825&r2=755619&rev=755619&view=diff
==============================================================================
--- cxf/trunk/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 Wed Mar 18 15:41:14 2009
@@ -53,6 +53,8 @@
 
 public class AbstractClient implements Client {
     
+    protected static final MediaType WILDCARD = MediaType.valueOf("*/*");
+    
     private MultivaluedMap<String, String> requestHeaders = new MetadataMap<String, String>();
     private ResponseBuilder responseBuilder;
     
@@ -296,7 +298,7 @@
         if (map.containsKey(HttpHeaders.CONTENT_TYPE)) {
             return MediaType.valueOf(map.getFirst(HttpHeaders.CONTENT_TYPE).toString());
         }
-        return MediaType.WILDCARD_TYPE;
+        return WILDCARD;
     }
     
     protected static HttpURLConnection createHttpConnection(URI uri, String methodName) {

Copied: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java (from r743825, cxf/trunk/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?p2=cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java&p1=cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java&r1=743825&r2=755619&rev=755619&view=diff
==============================================================================
--- cxf/trunk/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 Wed Mar 18 15:41:14 2009
@@ -28,7 +28,6 @@
 import java.util.List;
 
 import javax.ws.rs.CookieParam;
-import javax.ws.rs.FormParam;
 import javax.ws.rs.HeaderParam;
 import javax.ws.rs.MatrixParam;
 import javax.ws.rs.PathParam;
@@ -202,7 +201,7 @@
                     String cType = 
                         bodyClass != null && InjectionUtils.isPrimitive(bodyClass) 
                             ? MediaType.TEXT_PLAIN : ori.getConsumeTypes().isEmpty() 
-                        || ori.getConsumeTypes().get(0).equals(MediaType.WILDCARD) 
+                        || ori.getConsumeTypes().get(0).equals(WILDCARD) 
                         ? MediaType.APPLICATION_XML : ori.getConsumeTypes().get(0).toString();   
                     headers.putSingle(HttpHeaders.CONTENT_TYPE, cType);
                 }
@@ -213,7 +212,7 @@
                 accepts = InjectionUtils.isPrimitive(responseClass) 
                     ? Collections.singletonList(MediaType.TEXT_PLAIN_TYPE)
                     : ori.getProduceTypes().size() == 0 
-                    || ori.getConsumeTypes().get(0).equals(MediaType.WILDCARD_TYPE) 
+                    || ori.getConsumeTypes().get(0).equals(WILDCARD) 
                     ? Collections.singletonList(MediaType.APPLICATION_XML_TYPE) : ori.getProduceTypes();
                 for (MediaType mt : accepts) {
                     headers.add(HttpHeaders.ACCEPT, mt.toString());
@@ -324,11 +323,6 @@
             return new Parameter(ParameterType.MATRIX, index, m.value(), isEncoded);
         }  
     
-        FormParam f = AnnotationUtils.getAnnotation(anns, FormParam.class);
-        if (f != null) {
-            return new Parameter(ParameterType.FORM, index, f.value(), isEncoded);
-        }  
-        
         HeaderParam h = AnnotationUtils.getAnnotation(anns, HeaderParam.class);
         if (h != null) {
             return new Parameter(ParameterType.HEADER, index, h.value(), isEncoded);

Copied: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java (from r743825, cxf/trunk/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?p2=cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java&p1=cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java&r1=743825&r2=755619&rev=755619&view=diff
==============================================================================
--- cxf/trunk/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 Wed Mar 18 15:41:14 2009
@@ -69,8 +69,12 @@
         HttpURLConnection conn = getConnection(httpMethod);
         
         MultivaluedMap<String, String> headers = getHeaders();
-        if (body != null && headers.getFirst(HttpHeaders.CONTENT_TYPE) == null) {
-            headers.putSingle(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_XML_TYPE.toString());
+        if (body != null) {
+            if (headers.getFirst(HttpHeaders.CONTENT_TYPE) == null) {
+                headers.putSingle(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_XML_TYPE.toString());
+            }
+        } else {
+            headers.putSingle(HttpHeaders.CONTENT_TYPE, MediaType.MEDIA_TYPE_WILDCARD);
         }
         if (responseClass != null && headers.getFirst(HttpHeaders.ACCEPT) == null) {
             headers.putSingle(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML_TYPE.toString());
@@ -155,12 +159,16 @@
     }
     
     public WebClient query(String name, Object ...values) {
-        getCurrentBuilder().queryParam(name, values);
+        for (Object o : values) {
+            getCurrentBuilder().queryParam(name, o.toString());
+        }
         return this;
     }
     
     public WebClient matrix(String name, Object ...values) {
-        getCurrentBuilder().matrixParam(name, values);
+        for (Object o : values) {
+            getCurrentBuilder().matrixParam(name, o.toString());
+        }
         return this;
     }
     
@@ -178,7 +186,7 @@
                 return this;
             }
             List<PathSegment> segments = JAXRSUtils.getPathSegments(uri.getPath(), false);
-            getCurrentBuilder().replacePath(null);
+            getCurrentBuilder().replacePath(getBaseURI().getPath());
             for (int i = 0; i < segments.size() - 1; i++) {
                 getCurrentBuilder().path(HttpUtils.fromPathSegment(segments.get(i)));
             }

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MetadataMap.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MetadataMap.java?rev=755619&r1=755618&r2=755619&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MetadataMap.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MetadataMap.java Wed Mar 18 15:41:14 2009
@@ -121,4 +121,6 @@
     public String toString() {
         return m.toString();
     }
+    
+     
 }

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestImpl.java?rev=755619&r1=755618&r2=755619&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestImpl.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestImpl.java Wed Mar 18 15:41:14 2009
@@ -19,16 +19,20 @@
 
 package org.apache.cxf.jaxrs.impl;
 
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
 import javax.ws.rs.core.EntityTag;
+import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.Request;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.ResponseBuilder;
 import javax.ws.rs.core.Variant;
 
+import org.apache.cxf.jaxrs.utils.HttpUtils;
 import org.apache.cxf.message.Message;
 
 /**
@@ -75,8 +79,29 @@
 
 
     public ResponseBuilder evaluatePreconditions(Date lastModified) {
-        // TODO : these dates wreck my head
-        return null;
+        String ifModifiedSince = getHeaderValue(HttpHeaders.IF_MODIFIED_SINCE);
+        
+        if (ifModifiedSince == null) {
+            return null;
+        }
+        
+        SimpleDateFormat dateFormat = HttpUtils.getHttpDateFormat();
+
+        dateFormat.setLenient(false);
+        Date dateSince = null;
+        try {
+            dateSince = dateFormat.parse(ifModifiedSince);
+        } catch (ParseException ex) {
+            // invalid header value, request should continue
+            return null;
+        }
+        
+        if (dateSince.before(lastModified)) {
+            // request should continue
+            return null;
+        }
+        
+        return Response.status(Response.Status.NOT_MODIFIED);
     }
 
 

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseBuilderImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseBuilderImpl.java?rev=755619&r1=755618&r2=755619&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseBuilderImpl.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseBuilderImpl.java Wed Mar 18 15:41:14 2009
@@ -43,10 +43,8 @@
 
     private ResponseBuilderImpl(ResponseBuilderImpl copy) {
         status = copy.status;
-        if (entity != null) {
-            entity = copy.entity;
-            metadata.putAll(copy.metadata);
-        }
+        metadata.putAll(copy.metadata);
+        entity = copy.entity;
     }
        
     public Response build() {

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java?rev=755619&r1=755618&r2=755619&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java Wed Mar 18 15:41:14 2009
@@ -335,6 +335,11 @@
         for (String p : path) {
             paths = JAXRSUtils.getPathSegments(p, false);
         }
+        if (!paths.isEmpty()) {
+            matrix = paths.get(paths.size() - 1).getMatrixParameters();
+        } else {
+            matrix.clear();
+        }
         return this;
     }
 
@@ -345,15 +350,21 @@
         scheme = uri.getScheme();
         port = uri.getPort();
         host = uri.getHost();
-        paths = JAXRSUtils.getPathSegments(uri.getPath(), false);
-        if (!paths.isEmpty()) {
-            matrix = paths.get(paths.size() - 1).getMatrixParameters();
-        }
+        setPathAndMatrix(uri.getPath());
         fragment = uri.getFragment();
         query = JAXRSUtils.getStructuredParams(uri.getQuery(), "&", true);
         userInfo = uri.getUserInfo();
     }
 
+    private void setPathAndMatrix(String path) {
+        paths = JAXRSUtils.getPathSegments(path, false);
+        if (!paths.isEmpty()) {
+            matrix = paths.get(paths.size() - 1).getMatrixParameters();
+        } else {
+            matrix.clear();
+        }
+    }
+    
     private String buildPath() {
         StringBuilder sb = new StringBuilder();
         Iterator<PathSegment> iter = paths.iterator();
@@ -377,7 +388,6 @@
         return buildParams(query, '&');
     }
 
-    
     /**
      * Builds param string for query part or matrix part of URI.
      * 

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java?rev=755619&r1=755618&r2=755619&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java Wed Mar 18 15:41:14 2009
@@ -91,8 +91,6 @@
             rp.preprocess(message, new UriInfoImpl(message, null));
         }
         
-
-        String httpMethod = (String)message.get(Message.HTTP_REQUEST_METHOD);
         String requestContentType = (String)message.get(Message.CONTENT_TYPE);
         if (requestContentType == null) {
             requestContentType = "*/*";
@@ -128,6 +126,7 @@
 
         message.getExchange().put(ROOT_RESOURCE_CLASS, resource);
 
+        String httpMethod = (String)message.get(Message.HTTP_REQUEST_METHOD);
         OperationResourceInfo ori = null;     
         
         List<ProviderInfo<RequestHandler>> shs = 

Copied: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java (from r743825, cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java)
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java?p2=cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java&p1=cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java&r1=743825&r2=755619&rev=755619&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java Wed Mar 18 15:41:14 2009
@@ -28,9 +28,9 @@
 import java.util.List;
 import java.util.Map;
 
-import javax.ws.rs.Consumes;
+import javax.ws.rs.ConsumeMime;
 import javax.ws.rs.Encoded;
-import javax.ws.rs.Produces;
+import javax.ws.rs.ProduceMime;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
@@ -47,12 +47,14 @@
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.jaxrs.utils.multipart.AttachmentUtils;
 
-@Produces("application/x-www-form-urlencoded")
-@Consumes({"application/x-www-form-urlencoded", "multipart/form-data" })
+@ProduceMime("application/x-www-form-urlencoded")
+@ConsumeMime({"application/x-www-form-urlencoded", "multipart/form-data" })
 @Provider
 public class FormEncodingProvider implements 
     MessageBodyReader<Object>, MessageBodyWriter<MultivaluedMap<String, String>> {
-        
+    
+    private static final MediaType MULTIPART_FORM_DATA_TYPE = MediaType.valueOf("multipart/form-data");
+    
     private FormValidator validator;
     @Context private MessageContext mc;
     private String attachmentDir;
@@ -71,10 +73,9 @@
     }
     
     public boolean isReadable(Class<?> type, Type genericType, 
-                              Annotation[] annotations, MediaType mt) {
+                              Annotation[] annotations) {
         return MultivaluedMap.class.isAssignableFrom(type)
-               || mt.isCompatible(MediaType.MULTIPART_FORM_DATA_TYPE)
-                  && MultipartBody.class.isAssignableFrom(type);
+               || multipartSupported() && MultipartBody.class.isAssignableFrom(type);
     }
 
     public Object readFrom(
@@ -115,7 +116,7 @@
      */
     protected void populateMap(MultivaluedMap<String, String> params, 
                                InputStream is, MediaType mt, boolean decode) {
-        if (mt.isCompatible(MediaType.MULTIPART_FORM_DATA_TYPE)) {
+        if (mt.isCompatible(MULTIPART_FORM_DATA_TYPE)) {
             MultipartBody body = 
                 AttachmentUtils.getMultipartBody(mc, attachmentDir, attachmentThreshold);
             FormUtils.populateMapFromMultipart(params, body, decode);
@@ -130,13 +131,11 @@
         }
     }
 
-    public long getSize(MultivaluedMap t, Class<?> type, Type genericType, Annotation[] annotations, 
-                        MediaType mediaType) {
+    public long getSize(MultivaluedMap<String, String> t) {
         return -1;
     }
 
-    public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, 
-                               MediaType mediaType) {
+    public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations) {
         return MultivaluedMap.class.isAssignableFrom(type);
     }
 
@@ -156,4 +155,14 @@
             }
         }
     }
+    
+    private boolean multipartSupported() {
+
+        if (mc == null) {
+            return false;
+        }
+        MediaType mt = mc.getHttpHeaders().getMediaType();        
+
+        return mt.isCompatible(MULTIPART_FORM_DATA_TYPE);
+    }
 }

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProvider.java?rev=755619&r1=755618&r2=755619&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProvider.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProvider.java Wed Mar 18 15:41:14 2009
@@ -24,8 +24,6 @@
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
 
-import javax.ws.rs.ConsumeMime;
-import javax.ws.rs.ProduceMime;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyReader;
@@ -35,15 +33,11 @@
 import org.apache.cxf.jaxrs.utils.InjectionUtils;
 import org.apache.cxf.jaxrs.utils.ParameterType;
 
-@ProduceMime("text/plain")
-@ConsumeMime("text/plain")
 public class PrimitiveTextProvider 
     implements MessageBodyReader<Object>, MessageBodyWriter<Object> {
 
     private static boolean isSupported(Class<?> type) { 
-        return type.isPrimitive() 
-            || Number.class.isAssignableFrom(type)
-            || Boolean.class.isAssignableFrom(type);
+        return InjectionUtils.isPrimitive(type);
     }
     
     public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations) {

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java?rev=755619&r1=755618&r2=755619&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java Wed Mar 18 15:41:14 2009
@@ -37,6 +37,7 @@
 import javax.ws.rs.ext.MessageBodyReader;
 import javax.ws.rs.ext.MessageBodyWriter;
 
+import org.apache.cxf.jaxrs.client.ResponseExceptionMapper;
 import org.apache.cxf.jaxrs.ext.MappingsHandler;
 import org.apache.cxf.jaxrs.ext.ParameterHandler;
 import org.apache.cxf.jaxrs.ext.RequestHandler;
@@ -75,6 +76,8 @@
         new ArrayList<ProviderInfo<ResponseHandler>>(1);
     private List<ProviderInfo<ParameterHandler>> jaxrsParamHandlers = 
         new ArrayList<ProviderInfo<ParameterHandler>>(1);
+    private List<ProviderInfo<ResponseExceptionMapper>> userResponseExceptionMappers = 
+        new ArrayList<ProviderInfo<ResponseExceptionMapper>>(1);
     private RequestPreprocessor requestPreprocessor;
     
     private ProviderFactory() {
@@ -91,12 +94,12 @@
                      responseHandlers,
                      defaultExceptionMappers,
                      jaxrsParamHandlers,
+                     userResponseExceptionMappers,
                      new JAXBElementProvider(),
                      new JSONProvider(),
                      new BinaryDataProvider(),
-                     new StringProvider(),
                      new SourceProvider(),
-                     new FormEncodingReaderProvider(),
+                     new FormEncodingProvider(),
                      new PrimitiveTextProvider(),
                      new ActivationProvider(),
                      new WebApplicationExceptionMapper(),
@@ -166,20 +169,7 @@
         List<ExceptionMapper<T>> candidates = new LinkedList<ExceptionMapper<T>>();
         
         for (ProviderInfo<ExceptionMapper> em : mappers) {
-            Type[] types = em.getProvider().getClass().getGenericInterfaces();
-            for (Type t : types) {
-                if (t instanceof ParameterizedType) {
-                    ParameterizedType pt = (ParameterizedType)t;
-                    Type[] args = pt.getActualTypeArguments();
-                    for (int i = 0; i < args.length; i++) {
-                        if (((Class<?>)args[i]).isAssignableFrom(exceptionType)) {
-                            InjectionUtils.injectContextFields(em.getProvider(), em, m);
-                            InjectionUtils.injectContextMethods(em.getProvider(), em, m);
-                            candidates.add(em.getProvider());
-                        }
-                    }
-                }
-            }
+            handleMapper((List)candidates, em, exceptionType, m);
         }
         if (candidates.size() == 0) {
             return null;
@@ -194,18 +184,7 @@
         List<ParameterHandler<T>> candidates = new LinkedList<ParameterHandler<T>>();
         
         for (ProviderInfo<ParameterHandler> em : jaxrsParamHandlers) {
-            Type[] types = em.getProvider().getClass().getGenericInterfaces();
-            for (Type t : types) {
-                if (t instanceof ParameterizedType) {
-                    ParameterizedType pt = (ParameterizedType)t;
-                    Type[] args = pt.getActualTypeArguments();
-                    for (int i = 0; i < args.length; i++) {
-                        if (((Class<?>)args[i]).isAssignableFrom(paramType)) {
-                            candidates.add(em.getProvider());
-                        }
-                    }
-                }
-            }
+            handleMapper((List)candidates, em, paramType, null);
         }
         if (candidates.size() == 0) {
             return null;
@@ -214,6 +193,44 @@
         return candidates.get(0);
     }
     
+    @SuppressWarnings("unchecked")
+    public <T extends Throwable> ResponseExceptionMapper<T> createResponseExceptionMapper(
+                                 Class<?> paramType) {
+        
+        List<ResponseExceptionMapper<T>> candidates = new LinkedList<ResponseExceptionMapper<T>>();
+        
+        for (ProviderInfo<ResponseExceptionMapper> em : userResponseExceptionMappers) {
+            handleMapper((List)candidates, em, paramType, null);
+        }
+        if (candidates.size() == 0) {
+            return null;
+        }
+        Collections.sort(candidates, new ResponseExceptionMapperComparator());
+        return candidates.get(0);
+    }
+    
+    private static void handleMapper(List<Object> candidates, ProviderInfo em, 
+                                     Class<?> expectedType, Message m) {
+        Type[] types = em.getProvider().getClass().getGenericInterfaces();
+        for (Type t : types) {
+            if (t instanceof ParameterizedType) {
+                ParameterizedType pt = (ParameterizedType)t;
+                Type[] args = pt.getActualTypeArguments();
+                for (int i = 0; i < args.length; i++) {
+                    if (((Class<?>)args[i]).isAssignableFrom(expectedType)) {
+                        if (m != null) {
+                            InjectionUtils.injectContextFields(em.getProvider(), em, m);
+                            InjectionUtils.injectContextMethods(em.getProvider(), em, m);
+                        }
+                        candidates.add(em.getProvider());
+                    }
+                }
+            }
+        }
+    }
+    
+    
+    
     public <T> MessageBodyReader<T> createMessageBodyReader(Class<T> bodyType,
                                                             Type parameterType,
                                                             Annotation[] parameterAnnotations,
@@ -286,6 +303,7 @@
                               List<ProviderInfo<ResponseHandler>> responseFilters,
                               List<ProviderInfo<ExceptionMapper>> excMappers,
                               List<ProviderInfo<ParameterHandler>> paramHandlers,
+                              List<ProviderInfo<ResponseExceptionMapper>> responseExcMappers,
                               Object... providers) {
         
         for (Object o : providers) {
@@ -313,6 +331,10 @@
                 excMappers.add(new ProviderInfo<ExceptionMapper>((ExceptionMapper)o)); 
             }
             
+            if (ResponseExceptionMapper.class.isAssignableFrom(o.getClass())) {
+                responseExcMappers.add(new ProviderInfo<ResponseExceptionMapper>((ResponseExceptionMapper)o)); 
+            }
+            
             if (ParameterHandler.class.isAssignableFrom(o.getClass())) {
                 paramHandlers.add(new ProviderInfo<ParameterHandler>((ParameterHandler)o)); 
             }
@@ -484,6 +506,7 @@
                      responseHandlers,
                      userExceptionMappers,
                      jaxrsParamHandlers,
+                     userResponseExceptionMappers,
                      userProviders.toArray());
     }
 
@@ -588,6 +611,16 @@
         
     }
     
+    private static class ResponseExceptionMapperComparator implements 
+        Comparator<ResponseExceptionMapper<? extends Throwable>> {
+    
+        public int compare(ResponseExceptionMapper<? extends Throwable> em1, 
+                           ResponseExceptionMapper<? extends Throwable> em2) {
+            return compareClasses(em1.getClass(), em2.getClass());
+        }
+        
+    }
+    
     private static class ParameterHandlerComparator implements 
         Comparator<ParameterHandler<? extends Object>> {
 

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java?rev=755619&r1=755618&r2=755619&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java Wed Mar 18 15:41:14 2009
@@ -22,8 +22,11 @@
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URL;
+import java.text.SimpleDateFormat;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
+import java.util.TimeZone;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.core.PathSegment;
@@ -43,6 +46,14 @@
     private HttpUtils() {
     }
     
+    public static SimpleDateFormat getHttpDateFormat() {
+        SimpleDateFormat dateFormat = 
+            new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
+        TimeZone tZone = TimeZone.getTimeZone("GMT");
+        dateFormat.setTimeZone(tZone);
+        return dateFormat;
+    }
+    
     public static URI toAbsoluteUri(URI u, Message message) { 
         if (!u.isAbsolute()) {
             HttpServletRequest httpRequest = 

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java?rev=755619&r1=755618&r2=755619&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java Wed Mar 18 15:41:14 2009
@@ -132,18 +132,6 @@
         return (Class<?>)paramType.getActualTypeArguments()[0];
     }
     
-    public static Class<?> getActualType(Type genericType, int i) {
-        if (genericType == null 
-            || !ParameterizedType.class.isAssignableFrom(genericType.getClass())) {
-            return null;
-        }
-        ParameterizedType paramType = (ParameterizedType)genericType;
-        if (i < paramType.getActualTypeArguments().length) {
-            return (Class<?>)paramType.getActualTypeArguments()[i];
-        }
-        return null;
-    }
-    
     public static void injectThroughMethod(Object requestObject,
                                            Method method,
                                            Object parameterValue) {
@@ -514,4 +502,11 @@
             InjectionUtils.injectContextField(cri, f, o, value, true);
         }
     }
+    
+    public static boolean isPrimitive(Class<?> type) {
+        return type.isPrimitive() 
+            || Number.class.isAssignableFrom(type)
+            || Boolean.class.isAssignableFrom(type)
+            || String.class == type;
+    }
 }

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java?rev=755619&r1=755618&r2=755619&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java Wed Mar 18 15:41:14 2009
@@ -28,6 +28,7 @@
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.net.URLDecoder;
+import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -236,7 +237,7 @@
         SortedMap<OperationResourceInfo, MultivaluedMap<String, String>> candidateList = 
             new TreeMap<OperationResourceInfo, MultivaluedMap<String, String>>(
                 new OperationResourceInfoComparator());
-        MediaType requestType = requestContentType == null 
+        MediaType requestType = requestContentType == null
                                 ? ALL_TYPES : MediaType.valueOf(requestContentType);
         
         int pathMatched = 0;
@@ -547,24 +548,21 @@
     @SuppressWarnings("unchecked")
     private static Object processCookieParam(Message m, String cookieName, 
                               Class<?> pClass, Type genericType, String defaultValue) {
-        Map<String, List<String>> headers = 
-            (Map<String, List<String>>)m.get(Message.PROTOCOL_HEADERS);
-        // get the cookie with this name...
-        List<String> values = headers.get("Cookie");
-        String value = "";
-        if (values != null && values.get(0).contains(cookieName + '=')) {
-            value = values.get(0);
+        List<String> values = new HttpHeadersImpl(m).getRequestHeader(HttpHeaders.COOKIE);
+        String value = values != null && values.get(0).contains(cookieName + '=') ? values.get(0) 
+                       : defaultValue != null ? cookieName + '=' + defaultValue : null;
+        
+        if (value == null) {
+            return null;
         }
+        
+        Cookie c = Cookie.valueOf(value);
         if (pClass.isAssignableFrom(Cookie.class)) {
-            return Cookie.valueOf(value.length() == 0 ? defaultValue : value);
+            return c;
         }
         
         String basePath = HttpUtils.getOriginalAddress(m);
-        return value.length() > 0 ? InjectionUtils.handleParameter(value, 
-                                                                   pClass, 
-                                                                   ParameterType.COOKIE,
-                                                                   basePath) 
-                                  : defaultValue;
+        return InjectionUtils.handleParameter(c.getValue(), pClass, ParameterType.COOKIE, basePath);
     }
     
     public static <T> T createContextValue(Message m, Type genericType, Class<T> clazz) {
@@ -908,5 +906,16 @@
         return null;
         
     }
+    
+    public static String encode(boolean encoded, String value) {
+        if (!encoded) {
+            try {
+                value = URLEncoder.encode(value, "UTF-8");
+            } catch (UnsupportedEncodingException ex) {
+                // unlikely to happen
+            }
+        }
+        return value;
+    }
         
 }

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ParameterType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ParameterType.java?rev=755619&r1=755618&r2=755619&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ParameterType.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ParameterType.java Wed Mar 18 15:41:14 2009
@@ -28,5 +28,6 @@
     FORM,
     
     REQUEST_BODY,
+    CONTEXT,
     UNKNOWN
 }

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/RequestImplTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/RequestImplTest.java?rev=755619&r1=755618&r2=755619&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/RequestImplTest.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/RequestImplTest.java Wed Mar 18 15:41:14 2009
@@ -30,10 +30,10 @@
 
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
+
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class RequestImplTest extends Assert {
@@ -87,9 +87,9 @@
     
     @Test
     public void testBeforeDate() throws Exception {
-        metadata.putSingle("If-Modified-Since", "Sat, 29 Oct 1994 19:43:31 GMT");
+        metadata.putSingle("If-Modified-Since", "Tue, 21 Oct 2008 14:00:00 GMT");
         Date serverDate = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH)
-            .parse("Sun, 29 Oct 1994 19:43:31 GMT");
+            .parse("Tue, 21 Oct 2008 17:00:00 GMT");
         
         ResponseBuilder rb = 
             new RequestImpl(m).evaluatePreconditions(serverDate);
@@ -97,11 +97,10 @@
     }
     
     @Test
-    @Ignore
     public void testAfterDate() throws Exception {
-        metadata.putSingle("If-Modified-Since", "Sat, 29 Oct 1994 19:43:31 GMT");
+        metadata.putSingle("If-Modified-Since", "Tue, 21 Oct 2008 14:00:00 GMT");
         Date serverDate = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH)
-            .parse("Fri, 28 Oct 1994 19:43:31 GMT");
+            .parse("Mon, 20 Oct 2008 14:00:00 GMT");
         
         
         ResponseBuilder rb = 

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java?rev=755619&r1=755618&r2=755619&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java Wed Mar 18 15:41:14 2009
@@ -46,6 +46,13 @@
         assertEquals("URI is not built correctly", uri, newUri);
     }
 
+    @Test
+    public void testReplacePath() throws Exception {
+        URI uri = new URI("http://foo/bar/baz;m1=m1value");
+        URI newUri = new UriBuilderImpl(uri).replacePath("/newpath").build();
+        assertEquals("URI is not built correctly", "http://foo/newpath", newUri.toString());
+    }
+    
     @Test(expected = IllegalArgumentException.class)
     public void testUriNull() throws Exception {
         new UriBuilderImpl().uri(null);

Copied: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/FormEncodingProviderTest.java (from r743825, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/FormEncodingProviderTest.java)
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/FormEncodingProviderTest.java?p2=cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/FormEncodingProviderTest.java&p1=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/FormEncodingProviderTest.java&r1=743825&r2=755619&rev=755619&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/FormEncodingProviderTest.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/FormEncodingProviderTest.java Wed Mar 18 15:41:14 2009
@@ -24,7 +24,7 @@
 import java.lang.annotation.Annotation;
 import java.util.List;
 
-import javax.ws.rs.Consumes;
+import javax.ws.rs.ConsumeMime;
 import javax.ws.rs.Encoded;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MediaType;
@@ -164,12 +164,12 @@
 
     @Test
     public void testReadable() {
-        assertTrue(ferp.isReadable(MultivaluedMap.class, null, null, null));
+        assertTrue(ferp.isReadable(MultivaluedMap.class, null, null));
     }
 
     @Test
     public void testAnnotations() {
-        assertEquals("application/x-www-form-urlencoded", ferp.getClass().getAnnotation(Consumes.class)
+        assertEquals("application/x-www-form-urlencoded", ferp.getClass().getAnnotation(ConsumeMime.class)
                      .value()[0]);
     }
 

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java?rev=755619&r1=755618&r2=755619&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java Wed Mar 18 15:41:14 2009
@@ -121,17 +121,17 @@
     public void testSortEntityProviders() throws Exception {
         ProviderFactory pf = ProviderFactory.getInstance();
         pf.registerUserProvider(new TestStringProvider());
-        pf.registerUserProvider(new StringProvider());
+        pf.registerUserProvider(new PrimitiveTextProvider());
         
         List<ProviderInfo<MessageBodyReader>> readers = pf.getUserMessageReaders();
 
         assertTrue(indexOf(readers, TestStringProvider.class) 
-                   < indexOf(readers, StringProvider.class));
+                   < indexOf(readers, PrimitiveTextProvider.class));
         
         List<ProviderInfo<MessageBodyWriter>> writers = pf.getUserMessageWriters();
 
         assertTrue(indexOf(writers, TestStringProvider.class) 
-                   < indexOf(writers, StringProvider.class));
+                   < indexOf(writers, PrimitiveTextProvider.class));
         
         //REVISIT the compare algorithm
         //assertTrue(indexOf(providers, JSONProvider.class) < indexOf(providers, TestStringProvider.class));
@@ -170,7 +170,7 @@
     
     @Test
     public void testGetStringProvider() throws Exception {
-        verifyProvider(String.class, StringProvider.class, "text/html");
+        verifyProvider(String.class, PrimitiveTextProvider.class, "text/plain");
     }
     
     @Test
@@ -206,7 +206,7 @@
        
     @Test
     public void testGetStringProviderWildCard() throws Exception {
-        verifyProvider(String.class, StringProvider.class, "text/*");
+        verifyProvider(String.class, PrimitiveTextProvider.class, "text/*");
     }
     
     @Test

Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookNotFoundFault.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookNotFoundFault.java?rev=755619&r1=755618&r2=755619&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookNotFoundFault.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookNotFoundFault.java Wed Mar 18 15:41:14 2009
@@ -25,6 +25,10 @@
 public class BookNotFoundFault extends Exception {
     private BookNotFoundDetails details;
 
+    public BookNotFoundFault(String errorMessage) {
+        super(errorMessage);
+    }
+    
     public BookNotFoundFault(BookNotFoundDetails details) {
         super();
         this.details = details;

Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreJaxrsJaxws.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreJaxrsJaxws.java?rev=755619&r1=755618&r2=755619&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreJaxrsJaxws.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreJaxrsJaxws.java Wed Mar 18 15:41:14 2009
@@ -22,6 +22,7 @@
 import javax.jws.WebMethod;
 import javax.jws.WebParam;
 import javax.jws.WebService;
+import javax.ws.rs.ConsumeMime;
 import javax.ws.rs.GET;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
@@ -30,16 +31,21 @@
 
 @WebService
 @Path("/bookstore")
+@ConsumeMime("application/xml")
+@ProduceMime("application/xml")
 public interface BookStoreJaxrsJaxws {
     
     @WebMethod
     @GET
     @Path("/{id}")
-    Book getBook(@PathParam("id") @WebParam(name = "id") Long id);
+    Book getBook(@PathParam("id") @WebParam(name = "id") Long id) throws BookNotFoundFault;
 
     @WebMethod
     @POST
     @Path("/books")
-    @ProduceMime("application/xml")
     Book addBook(@WebParam(name = "book") Book book);
+    
+    @Path("/books/{id}")
+    @WebMethod(exclude = true)
+    BookSubresource getBookSubresource(@PathParam("id") String id);
 }

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=755619&r1=755618&r2=755619&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 Wed Mar 18 15:41:14 2009
@@ -23,7 +23,10 @@
 import java.util.Map;
 
 import javax.annotation.Resource;
+import javax.jws.WebMethod;
 import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
 import javax.xml.ws.WebServiceContext;
 
 import org.apache.cxf.jaxrs.ext.MessageContext;
@@ -42,6 +45,11 @@
     }
     
     public Book getBook(Long id) {
+        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);
+        }
         System.out.println(getContentType());
         return books.get(id);
     }
@@ -70,5 +78,10 @@
         }
         return request.getContentType();
     }
+
+    @WebMethod(exclude = true)
+    public BookSubresource getBookSubresource(String id) {
+        return new BookSubresourceImpl(Long.valueOf(id));
+    }
     
 }

Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresource.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresource.java?rev=755619&r1=755618&r2=755619&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresource.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresource.java Wed Mar 18 15:41:14 2009
@@ -19,9 +19,16 @@
 
 package org.apache.cxf.systest.jaxrs;
 
+import javax.ws.rs.ConsumeMime;
+import javax.ws.rs.CookieParam;
 import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
 import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
 import javax.ws.rs.ProduceMime;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MultivaluedMap;
 
 import org.apache.cxf.customer.book.BookNotFoundFault;
 
@@ -31,4 +38,21 @@
     @Path("/subresource")
     @ProduceMime("application/xml")
     Book getTheBook() throws BookNotFoundFault;
+    
+    @POST
+    @Path("/subresource2/{n1}")
+    @ConsumeMime("text/plain")
+    @ProduceMime("application/xml")
+    Book getTheBook2(@PathParam("n1") String name1,
+                     @QueryParam("n2") String name2,
+                     @QueryParam("n3") String name3,
+                     @HeaderParam("N4") String name4,
+                     @CookieParam("n5") String name5,
+                     String name6) throws BookNotFoundFault;
+    
+    @POST
+    @Path("/subresource3")
+    Book getTheBook3(MultivaluedMap<String, String> form) throws BookNotFoundFault;
+    
 }
+

Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresourceImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresourceImpl.java?rev=755619&r1=755618&r2=755619&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresourceImpl.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresourceImpl.java Wed Mar 18 15:41:14 2009
@@ -19,15 +19,49 @@
 
 package org.apache.cxf.systest.jaxrs;
 
+import javax.ws.rs.core.MultivaluedMap;
+
 import org.apache.cxf.customer.book.BookNotFoundFault;
 
 public class BookSubresourceImpl implements BookSubresource {
 
+    private Long id;
+    
+    public BookSubresourceImpl() {
+        id = 123L;
+    }
+    
+    public BookSubresourceImpl(Long id) {
+        this.id = id;
+    }
+    
     public Book getTheBook() throws BookNotFoundFault {
+        
+        if (id == 0) {
+            return null;
+        }
+        
         Book b = new Book();
-        b.setId(123);
+        b.setId(id);
         b.setName("CXF in Action");
         return b;
     }
 
+    public Book getTheBook2(String n1, String n2, String n3, String n4, String n5, String n6) 
+        throws BookNotFoundFault {
+        
+        Book b = new Book();
+        b.setId(id); 
+        b.setName(n1 + n2 + n3 + n4 + n5 + n6);
+        return b;
+    }
+    
+    public Book getTheBook3(MultivaluedMap<String, String> form) throws BookNotFoundFault {
+        Book b = new Book();
+        
+        b.setId(Long.valueOf(form.getFirst("id"))); 
+        b.setName(form.getFirst("name"));
+        return b;
+    }
+
 }

Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java?rev=755619&r1=755618&r2=755619&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java Wed Mar 18 15:41:14 2009
@@ -23,7 +23,15 @@
 import java.io.InputStream;
 import java.net.URL;
 import java.net.URLConnection;
+import java.util.List;
+import java.util.Map;
 
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
 import javax.xml.namespace.QName;
 
 import org.apache.commons.httpclient.HttpClient;
@@ -32,8 +40,16 @@
 import org.apache.commons.httpclient.methods.RequestEntity;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.io.CachedOutputStream;
+import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
+import org.apache.cxf.jaxrs.client.ResponseExceptionMapper;
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.cxf.jaxrs.ext.form.Form;
+import org.apache.cxf.jaxrs.impl.MetadataMap;
+import org.apache.cxf.jaxrs.provider.ProviderFactory;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+
 import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class JAXRSSoapBookTest extends AbstractBusClientServerTestBase {
@@ -63,6 +79,199 @@
     }
     
     @Test
+    public void testGetBook123Client() throws Exception {
+        
+        String baseAddress = "http://localhost:9092/test/services/rest";
+        BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
+                                                                  BookStoreJaxrsJaxws.class);
+        Book b = proxy.getBook(new Long("123"));
+        assertEquals(123L, b.getId());
+        assertEquals("CXF in Action", b.getName());
+    }
+    
+    @Test
+    public void testGetBook123WebClient() throws Exception {
+        String baseAddress = "http://localhost:9092/test/services/rest";
+        WebClient client = new WebClient(baseAddress);
+        client.path("/bookstore/123").accept(MediaType.APPLICATION_XML_TYPE);
+        Book b = client.get(Book.class);
+        assertEquals(123L, b.getId());
+        assertEquals("CXF in Action", b.getName());
+    }
+    
+    @Test
+    public void testNoBookWebClient() throws Exception {
+        String baseAddress = "http://localhost:9092/test/services/rest";
+        WebClient client = new WebClient(baseAddress);
+        client.path("/bookstore/books/0/subresource").accept(MediaType.APPLICATION_XML_TYPE);
+        Book b = client.get(Book.class);
+        assertNull(b);
+        assertEquals(204, client.getResponse().getStatus());
+    }
+    
+    @Test
+    public void testGetBook123WebClientResponse() throws Exception {
+        String baseAddress = "http://localhost:9092/test/services/rest";
+        WebClient client = new WebClient(baseAddress);
+        client.path("/bookstore/123").accept(MediaType.APPLICATION_XML_TYPE);
+        Book b = readBook((InputStream)client.get().getEntity());
+        assertEquals(123L, b.getId());
+        assertEquals("CXF in Action", b.getName());
+    }
+    
+    @Test
+    public void testGetBook356ClientException() throws Exception {
+        
+        String baseAddress = "http://localhost:9092/test/services/rest";
+        BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
+                                                              BookStoreJaxrsJaxws.class);
+        
+        ProviderFactory.getInstance().registerUserProvider(new TestResponseExceptionMapper());
+        try {
+            proxy.getBook(356L);
+            fail();
+        } catch (BookNotFoundFault ex) {
+            assertEquals("No Book with id 356 is available", ex.getMessage());
+        }
+    }
+    
+    
+    @Test
+    public void testGetBookSubresourceClient() throws Exception {
+        
+        String baseAddress = "http://localhost:9092/test/services/rest";
+        BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
+                                                                  BookStoreJaxrsJaxws.class);
+        BookSubresource bs = proxy.getBookSubresource("125");
+        Book b = bs.getTheBook();
+        assertEquals(125L, b.getId());
+        assertEquals("CXF in Action", b.getName());
+    }
+    
+    @Test
+    public void testGetBookSubresourceClient2() throws Exception {
+        
+        String baseAddress = "http://localhost:9092/test/services/rest";
+        BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
+                                                                  BookStoreJaxrsJaxws.class);
+        doTestSubresource(proxy);
+    }
+    
+    @Test
+    public void testGetBookSubresourceWebClientProxy() throws Exception {
+        
+        WebClient client = new WebClient("http://localhost:9092/test/services/rest");
+        client.type(MediaType.TEXT_PLAIN_TYPE).accept(MediaType.APPLICATION_XML_TYPE);
+        BookStoreJaxrsJaxws proxy = JAXRSClientFactory.fromClient(client, BookStoreJaxrsJaxws.class, true);
+        
+        doTestSubresource(proxy);
+        
+        BookStoreJaxrsJaxws proxy2 = JAXRSClientFactory.fromClient(
+            WebClient.client(proxy), BookStoreJaxrsJaxws.class);
+        doTestSubresource(proxy2);
+        
+    }
+    
+    
+    @Test
+    public void testGetBookSubresourceWebClientProxy2() throws Exception {
+        
+        WebClient client = new WebClient("http://localhost:9092/test/services/rest/bookstore")
+            .path("/books/378");
+        client.type(MediaType.TEXT_PLAIN_TYPE).accept(MediaType.APPLICATION_XML_TYPE);
+        BookSubresource proxy = JAXRSClientFactory.fromClient(client, BookSubresource.class);
+        
+        Book b = proxy.getTheBook2("CXF ", "in ", "Action ", "- 3", "7", "8");
+        assertEquals(378L, b.getId());
+        assertEquals("CXF in Action - 378", b.getName());
+        
+    }
+    
+    private void doTestSubresource(BookStoreJaxrsJaxws proxy) throws Exception {
+        BookSubresource bs = proxy.getBookSubresource("378");
+        
+        Book b = bs.getTheBook2("CXF ", "in ", "Action ", "- 3", "7", "8");
+        assertEquals(378L, b.getId());
+        assertEquals("CXF in Action - 378", b.getName());
+        
+        WebClient.client(bs).reset().header("N4", "- 4");
+        b = bs.getTheBook2("CXF ", "in ", "Action ", null, "7", "8");
+        assertEquals(378L, b.getId());
+        assertEquals("CXF in Action - 478", b.getName());
+    }
+    
+    @Test
+    public void testGetBookWebClientForm() throws Exception {
+        
+        String baseAddress = "http://localhost:9092/test/services/rest/bookstore/books/679/subresource3";
+        WebClient wc = new WebClient(baseAddress);
+        MultivaluedMap<String, Object> map = new MetadataMap<String, Object>();
+        map.putSingle("id", "679");
+        map.putSingle("name", "CXF in Action - 679");
+        Book b = readBook((InputStream)wc.accept("application/xml")
+                          .form((Map<String, List<Object>>)map).getEntity());
+        assertEquals(679L, b.getId());
+        assertEquals("CXF in Action - 679", b.getName());
+    }
+    
+    @Test
+    public void testGetBookWebClientForm2() throws Exception {
+        
+        String baseAddress = "http://localhost:9092/test/services/rest/bookstore/books/679/subresource3";
+        WebClient wc = new WebClient(baseAddress);
+        Form f = new Form();
+        f.set("id", "679").set("name", "CXF in Action - 679");
+        Book b = readBook((InputStream)wc.accept("application/xml")
+                          .form(f).getEntity());
+        assertEquals(679L, b.getId());
+        assertEquals("CXF in Action - 679", b.getName());
+    }
+    
+    @Test
+    public void testGetBookSubresourceClientFormParam() throws Exception {
+        
+        String baseAddress = "http://localhost:9092/test/services/rest";
+        BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
+                                                                  BookStoreJaxrsJaxws.class);
+        BookSubresource bs = proxy.getBookSubresource("679");
+        MultivaluedMap<String, String> map = new MetadataMap<String, String>();
+        map.putSingle("id", "679");
+        map.putSingle("name", "CXF in Action - 679");
+        Book b = bs.getTheBook3(map);
+        assertEquals(679L, b.getId());
+        assertEquals("CXF in Action - 679", b.getName());
+    }
+    
+    @Test
+    public void testAddGetBook123WebClient() throws Exception {
+        String baseAddress = "http://localhost:9092/test/services/rest";
+        WebClient client = new WebClient(baseAddress);
+        client.path("/bookstore/books").accept(MediaType.APPLICATION_XML_TYPE)
+            .type(MediaType.APPLICATION_XML_TYPE);
+        Book b = new Book();
+        b.setId(124);
+        b.setName("CXF in Action - 2");
+        Book b2 = client.post(b, Book.class);
+        assertNotSame(b, b2);
+        assertEquals(124L, b2.getId());
+        assertEquals("CXF in Action - 2", b2.getName());
+    }
+    
+    @Test
+    public void testAddGetBook123Client() throws Exception {
+        String baseAddress = "http://localhost:9092/test/services/rest";
+        BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
+                                                                  BookStoreJaxrsJaxws.class);
+        Book b = new Book();
+        b.setId(124);
+        b.setName("CXF in Action - 2");
+        Book b2 = proxy.addBook(b);
+        assertNotSame(b, b2);
+        assertEquals(124L, b2.getId());
+        assertEquals("CXF in Action - 2", b2.getName());
+    }
+    
+    @Test
     public void testAddGetBookRest() throws Exception {
         
         String endpointAddress =
@@ -98,8 +307,8 @@
             new BookSoapService(wsdlUrl,
                                 new QName("http://books.com", "BookService"));
         BookStoreJaxrsJaxws store = service.getBookPort();
-        Book book = store.getBook(new Long(123));
-        assertEquals("id is wrong", book.getId(), 123);
+        Book book = store.getBook(new Long(123L));
+        assertEquals("id is wrong", book.getId(), 123L);
     }
 
     private String getStringFromInputStream(InputStream in) throws Exception {        
@@ -115,6 +324,29 @@
         
         URLConnection connect = url.openConnection();
         connect.addRequestProperty("Accept", "application/xml,text/plain");
+        connect.addRequestProperty("Content-Type", "*/*");
         return connect.getInputStream();
     }
+    
+    private Book readBook(InputStream is) throws Exception {
+        JAXBContext c = JAXBContext.newInstance(new Class[]{Book.class});
+        Unmarshaller u = c.createUnmarshaller();
+        return (Book)u.unmarshal(is);
+    }
+    
+    @Ignore
+    public static class TestResponseExceptionMapper implements ResponseExceptionMapper<BookNotFoundFault> {
+        
+        public TestResponseExceptionMapper() {
+        }
+        
+        public BookNotFoundFault fromResponse(Response r) {
+            Object value = r.getMetadata().getFirst("BOOK-HEADER");
+            if (value != null) {
+                return new BookNotFoundFault(value.toString());
+            }
+            throw new WebApplicationException();
+        }
+        
+    }
 }

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=755619&r1=755618&r2=755619&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 Wed Mar 18 15:41:14 2009
@@ -35,7 +35,6 @@
   <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
   <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
 
-
   <jaxws:endpoint xmlns:s="http://books.com"
       serviceName="s:BookService"
       endpointName="s:BookPort"
@@ -49,9 +48,8 @@
       <ref bean="bookstore"/>
     </jaxrs:serviceBeans>		   
   </jaxrs:server>
-  <bean id="bookstore" class="org.apache.cxf.systest.jaxrs.BookStoreSoapRestImpl">
-  </bean>
-  
+  <bean id="bookstore" class="org.apache.cxf.systest.jaxrs.BookStoreSoapRestImpl"/>
+
   <jaxws:endpoint xmlns:s="http://books.com"
       serviceName="s:BookService"
       endpointName="s:BookPort"
@@ -65,8 +63,7 @@
       <ref bean="bookstore2"/>
     </jaxrs:serviceBeans>		   
   </jaxrs:server>
-  <bean id="bookstore2" class="org.apache.cxf.systest.jaxrs.BookStoreSoapRestImpl2">
-  </bean>
+  <bean id="bookstore2" class="org.apache.cxf.systest.jaxrs.BookStoreSoapRestImpl2"/>
 
 </beans>
 <!-- END SNIPPET: beans -->



Mime
View raw message