cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1221210 - in /cxf/branches/2.4.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/ systests/jaxrs/src/test/resources/jaxrs/WEB-INF/
Date Tue, 20 Dec 2011 11:50:50 GMT
Author: sergeyb
Date: Tue Dec 20 11:50:49 2011
New Revision: 1221210

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

........
  r1221208 | sergeyb | 2011-12-20 11:47:32 +0000 (Tue, 20 Dec 2011) | 1 line
  
  [CXF-3986] JAX-RS MessageContext should check Exchange for Class properties
........

Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/MessageContextImpl.java
    cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookExceptionMapper.java
    cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
    cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSpring.java
    cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
    cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
    cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Dec 20 11:50:49 2011
@@ -1 +1 @@
-/cxf/trunk:1221204
+/cxf/trunk:1221204,1221208

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

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/MessageContextImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/MessageContextImpl.java?rev=1221210&r1=1221209&r2=1221210&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/MessageContextImpl.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/MessageContextImpl.java
Tue Dec 20 11:50:49 2011
@@ -100,7 +100,12 @@ public class MessageContextImpl implemen
     }
     
     public Object getContextualProperty(Object key) {
-        return m.getContextualProperty(key.toString());
+        Object value = m.getContextualProperty(key.toString());
+        if (value == null && key.getClass() == Class.class) {
+            return m.getExchange().get((Class<?>)key);
+        } else {
+            return value;
+        }
     }
 
     public <T> T getContext(Class<T> contextClass) {

Modified: cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookExceptionMapper.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookExceptionMapper.java?rev=1221210&r1=1221209&r2=1221210&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookExceptionMapper.java
(original)
+++ cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookExceptionMapper.java
Tue Dec 20 11:50:49 2011
@@ -18,19 +18,30 @@
  */
 package org.apache.cxf.systest.jaxrs;
 
+import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.ext.ExceptionMapper;
 import javax.ws.rs.ext.Provider;
 
+import org.apache.cxf.jaxrs.ext.MessageContext;
+import org.apache.cxf.jaxrs.model.OperationResourceInfo;
+
 @Provider
 public class BookExceptionMapper implements ExceptionMapper<BookNotFoundFault> {
 
+    @Context
+    private MessageContext mc;
     private boolean toHandle;
     
     public Response toResponse(BookNotFoundFault ex) {
         // status is 200 just to simplify the test client code
         if (toHandle) {
+            OperationResourceInfo ori = 
+                (OperationResourceInfo)mc.getContextualProperty(OperationResourceInfo.class);
+            if (ori == null) {
+                throw new RuntimeException();
+            }
             return Response.status(500).type(MediaType.TEXT_PLAIN_TYPE)     
                       .entity("No book found at all : " + ex.getFaultInfo().getId()).build();
         }

Modified: cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java?rev=1221210&r1=1221209&r2=1221210&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
(original)
+++ cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
Tue Dec 20 11:50:49 2011
@@ -377,6 +377,14 @@ public class BookStore {
     }
     
     @GET
+    @Path("/segment/matrix-middle")
+    public Book getBookByMatrixParamsMiddle(@MatrixParam("first") String s1,
+                                      @MatrixParam("second") String s2) throws Exception
{
+        
+        return doGetBook(s1 + s2);
+    }
+    
+    @GET
     @Path("/segment/matrix-list")
     public Book getBookByMatrixListParams(@MatrixParam("first") List<String> list)
throws Exception {
         if (list.size() != 2) {

Modified: cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSpring.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSpring.java?rev=1221210&r1=1221209&r2=1221210&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSpring.java
(original)
+++ cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSpring.java
Tue Dec 20 11:50:49 2011
@@ -75,7 +75,7 @@ public class BookStoreSpring {
     
     @GET
     @Path("/books/{id}")
-    @Produces({"application/jettison", "application/json" })
+    @Produces({"application/json", "application/vnd.example-com.foo+json" })
     public Book getBookById(@PathParam("id") Long id) {
         return books.get(id);
     }
@@ -139,8 +139,8 @@ public class BookStoreSpring {
 
     @POST
     @Path("books/convert")
-    @Consumes({"application/xml", "application/json", "application/jettison" })
-    @Produces("application/xml")
+    @Consumes({"application/jettison" })
+    @Produces("application/vnd.example-com.foo+json")
     public Book convertBook(Book2 book) {
         // how to have Book2 populated ?
         Book b = new Book();

Modified: cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=1221210&r1=1221209&r2=1221210&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
(original)
+++ cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
Tue Dec 20 11:50:49 2011
@@ -1059,6 +1059,14 @@ public class JAXRSClientServerBookTest e
     }
     
     @Test
+    public void testGetBookByMatrixParametersInTheMiddle() throws Exception {
+        getAndCompareAsStrings(
+            "http://localhost:" + PORT + "/bookstore/segment;first=12;second=3/matrix-middle",
+            "resources/expected_get_book123.txt",
+            "application/xml", 200);
+    }
+    
+    @Test
     public void testGetBookByHeader() throws Exception {
         getAndCompareAsStrings("http://localhost:" + PORT + "/bookstore/bookheaders",
                                "resources/expected_get_book123.txt",

Modified: cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java?rev=1221210&r1=1221209&r2=1221210&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
(original)
+++ cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
Tue Dec 20 11:50:49 2011
@@ -64,7 +64,7 @@ public class JAXRSClientServerSpringBook
     @BeforeClass
     public static void startServers() throws Exception {
         assertTrue("server did not launch correctly", 
-                   launchServer(BookServerSpring.class));
+                   launchServer(BookServerSpring.class, true));
     }
     
     @Test
@@ -218,7 +218,7 @@ public class JAXRSClientServerSpringBook
             "http://localhost:" + PORT + "/the/bookstore/books/123"; 
         getBook(endpointAddress, "resources/expected_get_book123json.txt");
         getBook(endpointAddress, "resources/expected_get_book123json.txt",
-                "application/jettison");
+                "application/vnd.example-com.foo+json");
     }
     
     

Modified: cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml?rev=1221210&r1=1221209&r2=1221210&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml (original)
+++ cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml Tue
Dec 20 11:50:49 2011
@@ -223,7 +223,7 @@ http://cxf.apache.org/schemas/core.xsd">
   
   <util:list id="jsonTypes">
     <value>application/json</value>
-    <value>application/jettison</value>
+    <value>application/vnd.example-com.foo+json</value>
   </util:list>
   
   <util:map id="jsonNamespaceMap" map-class="java.util.Hashtable">



Mime
View raw message