cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1036840 - in /cxf/trunk: rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/AbstractResourceInfo.java systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsImpl.java
Date Fri, 19 Nov 2010 13:58:18 GMT
Author: sergeyb
Date: Fri Nov 19 13:58:18 2010
New Revision: 1036840

URL: http://svn.apache.org/viewvc?rev=1036840&view=rev
Log:
[JAX-RS] Minor fix for field-based injection of Contexts to work in cases when service classes
are interfaces

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/AbstractResourceInfo.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsImpl.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/AbstractResourceInfo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/AbstractResourceInfo.java?rev=1036840&r1=1036839&r2=1036840&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/AbstractResourceInfo.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/AbstractResourceInfo.java
Fri Nov 19 13:58:18 2010
@@ -64,6 +64,9 @@ public abstract class AbstractResourceIn
     
     public void setResourceClass(Class<?> rClass) {
         resourceClass = rClass;
+        if (serviceClass.isInterface() && resourceClass != null && !resourceClass.isInterface())
{
+            findContextFields(resourceClass);
+        }
     }
     
     public Class<?> getServiceClass() {

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsImpl.java?rev=1036840&r1=1036839&r2=1036840&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsImpl.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsImpl.java
Fri Nov 19 13:58:18 2010
@@ -22,9 +22,16 @@ package org.apache.cxf.systest.jaxrs;
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
 public class BookStoreNoAnnotationsImpl implements BookStoreNoAnnotationsInterface {
 
     private Map<Long, Book> books = new HashMap<Long, Book>();
+    @Context 
+    private UriInfo ui;
     
     public BookStoreNoAnnotationsImpl() {
         Book b = new Book();
@@ -34,6 +41,9 @@ public class BookStoreNoAnnotationsImpl 
     }
     
     public Book getBook(Long id) throws BookNotFoundFault {
+        if (ui == null) {
+            throw new WebApplicationException(Response.serverError().build());
+        }
         return books.get(id);
     }
     



Mime
View raw message