cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1455107 - in /cxf/trunk: parent/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/form/ rt/rs/client/src/main...
Date Mon, 11 Mar 2013 12:10:52 GMT
Author: sergeyb
Date: Mon Mar 11 12:10:52 2013
New Revision: 1455107

URL: http://svn.apache.org/r1455107
Log:
[CXF-4889] Upgrade to JAX-RS 2.0 API rc2

Modified:
    cxf/trunk/parent/pom.xml
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/AbstractResponseContextImpl.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/LinkBuilderImpl.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ServerProviderFactory.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/form/FormTest.java
    cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientRequestContextImpl.java

Modified: cxf/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/parent/pom.xml?rev=1455107&r1=1455106&r2=1455107&view=diff
==============================================================================
--- cxf/trunk/parent/pom.xml (original)
+++ cxf/trunk/parent/pom.xml Mon Mar 11 12:10:52 2013
@@ -110,7 +110,7 @@
         <cxf.geronimo.servlet.version>1.0</cxf.geronimo.servlet.version>
         <cxf.geronimo.servlet25.version>1.1.2</cxf.geronimo.servlet25.version>
         <cxf.geronimo.transaction.version>1.1.1</cxf.geronimo.transaction.version>
-        <cxf.javax.ws.rs.version>2.0-rc1</cxf.javax.ws.rs.version>
+        <cxf.javax.ws.rs.version>2.0-rc2</cxf.javax.ws.rs.version>
         <cxf.jaxb21.version>2.1</cxf.jaxb21.version>
         <cxf.jaxb21.impl.version>2.1.13</cxf.jaxb21.impl.version>
         <cxf.jaxb21.xjc.version>2.1.13</cxf.jaxb21.xjc.version>

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/AbstractResponseContextImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/AbstractResponseContextImpl.java?rev=1455107&r1=1455106&r2=1455107&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/AbstractResponseContextImpl.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/AbstractResponseContextImpl.java
Mon Mar 11 12:10:52 2013
@@ -133,6 +133,11 @@ public abstract class AbstractResponseCo
         updateMessageResponse();
     }
     
+    public void setEntity(Object entity) {
+        ((ResponseImpl)r).setEntity(entity, null);
+        updateMessageResponse();
+    }
+    
     protected Annotation[] getResponseEntityAnnotations() {
         return ((ResponseImpl)r).getEntityAnnotations();
     }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/LinkBuilderImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/LinkBuilderImpl.java?rev=1455107&r1=1455106&r2=1455107&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/LinkBuilderImpl.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/LinkBuilderImpl.java
Mon Mar 11 12:10:52 2013
@@ -38,6 +38,7 @@ import org.apache.cxf.jaxrs.utils.HttpUt
 public class LinkBuilderImpl implements Builder {
     private static final String DOUBLE_QUOTE = "\"";
     private UriBuilder ub;
+    private URI baseUri;
     private Map<String, String> params = new HashMap<String, String>(6);
     
     @Override
@@ -49,18 +50,14 @@ public class LinkBuilderImpl implements 
     @Override
     public Link buildRelativized(URI requestUri, Object... values) {
         URI uri = ub.build(values);
-        URI relativized = HttpUtils.relativize(requestUri, uri);
+        
+        URI resolvedLinkUri = baseUri != null 
+            ? HttpUtils.resolve(UriBuilder.fromUri(baseUri), uri) : uri;
+        URI relativized = HttpUtils.relativize(requestUri, resolvedLinkUri);
         return new LinkImpl(relativized, params);
     }
 
     @Override
-    public Link buildResolved(URI baseUri, Object... values) {
-        URI uri = ub.build(values);
-        URI resolved = HttpUtils.resolve(UriBuilder.fromUri(baseUri), uri);
-        return new LinkImpl(resolved, params);
-    }
-
-    @Override
     public Builder link(Link link) {
         ub = UriBuilder.fromLink(link);
         params.putAll(link.getParams());
@@ -234,4 +231,16 @@ public class LinkBuilderImpl implements 
             }
         }
     }
+
+    @Override
+    public Builder baseUri(URI uri) {
+        this.baseUri = uri;
+        return this;
+    }
+
+    @Override
+    public Builder baseUri(String uri) {
+        baseUri = URI.create(uri);
+        return this;   
+    }
 }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ServerProviderFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ServerProviderFactory.java?rev=1455107&r1=1455106&r2=1455107&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ServerProviderFactory.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ServerProviderFactory.java
Mon Mar 11 12:10:52 2013
@@ -430,13 +430,9 @@ public final class ServerProviderFactory
         
         @Override
         public FeatureContext register(Object provider, Class<?>... contracts) {
-            return register(provider, Priorities.USER, contracts);
+            return doRegister(provider, Priorities.USER, contracts);
         }
         
-        //@Override
-        public FeatureContext register(Object provider, int priority, Class<?>... contracts)
{
-            return register(provider, priority, contracts);
-        }
         
         @Override
         public FeatureContext register(Object provider, Map<Class<?>, Integer>
contracts) {
@@ -459,7 +455,7 @@ public final class ServerProviderFactory
 
         @Override
         public FeatureContext register(Class<?> providerClass, Class<?>... contracts)
{
-            return register(providerClass, Priorities.USER, contracts);
+            return doRegister(providerClass, Priorities.USER, contracts);
         }
 
         @Override
@@ -471,17 +467,6 @@ public final class ServerProviderFactory
             return this;
         }
         
-        public FeatureContext replaceWith(Configuration config) {
-            // nothing to do in this case
-            return this;
-        }
-        
-        //@Override
-        public FeatureContext register(Class<?> providerClass, int bindingPriority,
-                                         Class<?>... contracts) {
-            return doRegister(createProvider(providerClass), bindingPriority, contracts);
-        }
-        
         private FeatureContext doRegister(Object provider, int bindingPriority, Class<?>...
contracts) {
         
             if (provider instanceof Feature) {

Modified: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/form/FormTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/form/FormTest.java?rev=1455107&r1=1455106&r2=1455107&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/form/FormTest.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/form/FormTest.java
Mon Mar 11 12:10:52 2013
@@ -20,7 +20,6 @@ package org.apache.cxf.jaxrs.ext.form;
 
 import javax.ws.rs.core.Form;
 
-import org.apache.cxf.jaxrs.impl.MetadataMap;
 import org.apache.cxf.jaxrs.utils.FormUtils;
 
 import org.junit.Assert;
@@ -30,7 +29,7 @@ public class FormTest extends Assert {
 
     @Test
     public void testToString() {
-        Form form = new Form(new MetadataMap<String, String>()).param("a", "b").param("c",
"d");
+        Form form = new Form().param("a", "b").param("c", "d");
         assertEquals("a=b&c=d", FormUtils.formToString(form));
     }
 

Modified: cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientRequestContextImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientRequestContextImpl.java?rev=1455107&r1=1455106&r2=1455107&view=diff
==============================================================================
--- cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientRequestContextImpl.java
(original)
+++ cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientRequestContextImpl.java
Mon Mar 11 12:10:52 2013
@@ -103,9 +103,17 @@ public class ClientRequestContextImpl ex
             headers.putSingle(HttpHeaders.CONTENT_TYPE, mt);
             m.put(Message.CONTENT_TYPE, mt.toString());
         }
-        m.put(List.class, entity == null ? new MessageContentsList() : new MessageContentsList(entity));
+        doSetEntity(entity);
+    }
+    
+    @Override
+    public void setEntity(Object entity) {
+        doSetEntity(entity);
     }
 
+    private void doSetEntity(Object entity) {
+        m.put(List.class, entity == null ? new MessageContentsList() : new MessageContentsList(entity));
+    }
     
     @Override
     public URI getUri() {



Mime
View raw message