cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r941650 - in /cxf/branches/2.2.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/client/WebClientTest.java
Date Thu, 06 May 2010 10:43:53 GMT
Author: sergeyb
Date: Thu May  6 10:43:52 2010
New Revision: 941650

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

........
  r941648 | sergeyb | 2010-05-06 11:38:10 +0100 (Thu, 06 May 2010) | 1 line
  
  CXF-2801: adding WebClient resetQuery and fragment methods
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/client/WebClientTest.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
    svn:mergeinfo = /cxf/trunk:941648

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

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java?rev=941650&r1=941649&r2=941650&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
Thu May  6 10:43:52 2010
@@ -447,6 +447,16 @@ public class WebClient extends AbstractC
     }
     
     /**
+     * Updates the current URI fragment
+     * @param name fragment name
+     * @return updated WebClient
+     */
+    public WebClient fragment(String name) {
+        getCurrentBuilder().fragment(name);
+        return this;
+    }
+    
+    /**
      * Moves WebClient to a new baseURI or forwards to new currentURI  
      * @param newAddress new URI
      * @param forward if true then currentURI will be based on baseURI  
@@ -489,6 +499,15 @@ public class WebClient extends AbstractC
         return this;
     }
     
+    /**
+     * Resets the current query
+     * @return updated WebClient
+     */
+    public WebClient resetQuery() {
+        getCurrentBuilder().replaceQuery(null);
+        return this;
+    }
+    
     @Override
     public WebClient type(MediaType ct) {
         return (WebClient)super.type(ct);

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/client/WebClientTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/client/WebClientTest.java?rev=941650&r1=941649&r2=941650&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/client/WebClientTest.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/client/WebClientTest.java
Thu May  6 10:43:52 2010
@@ -154,6 +154,25 @@ public class WebClientTest extends Asser
     }
     
     @Test
+    public void testResetQueryAndBack() {
+        WebClient wc = WebClient.create(URI.create("http://foo"));
+        wc.path("bar").path("baz").query("foo", "bar");
+        assertEquals(URI.create("http://foo"), wc.getBaseURI());
+        assertEquals(URI.create("http://foo/bar/baz?foo=bar"), wc.getCurrentURI());
+        wc.resetQuery().back(false);
+        assertEquals(URI.create("http://foo/bar"), wc.getCurrentURI());
+    }
+    
+    @Test
+    public void testFragment() {
+        WebClient wc = WebClient.create(URI.create("http://foo"));
+        wc.path("bar").path("baz").query("foo", "bar").fragment("1");
+        assertEquals(URI.create("http://foo"), wc.getBaseURI());
+        assertEquals(URI.create("http://foo/bar/baz?foo=bar#1"), wc.getCurrentURI());
+    }
+    
+    
+    @Test
     public void testPathWithTemplates() {
         WebClient wc = WebClient.create(URI.create("http://foo"));
         assertEquals(URI.create("http://foo"), wc.getBaseURI());



Mime
View raw message