cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1438094 - in /cxf/branches/2.7.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/
Date Thu, 24 Jan 2013 17:30:31 GMT
Author: sergeyb
Date: Thu Jan 24 17:30:30 2013
New Revision: 1438094

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

........
  r1438077 | sergeyb | 2013-01-24 17:17:06 +0000 (Thu, 24 Jan 2013) | 1 line
  
  Getting post-match ClientRequestFilters running before ReaderInterceptors
........
  r1438082 | sergeyb | 2013-01-24 17:19:46 +0000 (Thu, 24 Jan 2013) | 1 line
  
  Also updating the test
........

Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
    cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer20.java

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1438077,1438082

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

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java?rev=1438094&r1=1438093&r2=1438094&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java
Thu Jan 24 17:30:30 2013
@@ -144,14 +144,6 @@ public class JAXRSInvoker extends Abstra
         
         if (!wasSuspended) {
             
-            // Global and name-bound request filters
-            if (!ori.isSubResourceLocator() && JAXRSUtils.runContainerRequestFilters(
-                                                  providerFactory,
-                                                  exchange.getInMessage(),
-                                                  false, ori.getNameBindings())) {
-                return new MessageContentsList(exchange.get(Response.class));
-            }
-            
             pushOntoStack(ori, ClassHelper.getRealClass(resourceObject), inMessage);
             
             final boolean contextsAvailable = cri.contextsAvailable();
@@ -217,16 +209,15 @@ public class JAXRSInvoker extends Abstra
         ClassResourceInfo subCri = null;
         if (ori.isSubResourceLocator()) {
             try {
-                Message msg = exchange.getInMessage();
-                MultivaluedMap<String, String> values = getTemplateValues(msg);
+                MultivaluedMap<String, String> values = getTemplateValues(inMessage);
                 String subResourcePath = values.getFirst(URITemplate.FINAL_MATCH_GROUP);
-                String httpMethod = (String)msg.get(Message.HTTP_REQUEST_METHOD);
-                String contentType = (String)msg.get(Message.CONTENT_TYPE);
+                String httpMethod = (String)inMessage.get(Message.HTTP_REQUEST_METHOD);
+                String contentType = (String)inMessage.get(Message.CONTENT_TYPE);
                 if (contentType == null) {
                     contentType = "*/*";
                 }
                 List<MediaType> acceptContentType =
-                    (List<MediaType>)msg.getExchange().get(Message.ACCEPT_CONTENT_TYPE);
+                    (List<MediaType>)exchange.get(Message.ACCEPT_CONTENT_TYPE);
 
                 result = checkResultObject(result, subResourcePath);
 
@@ -242,18 +233,25 @@ public class JAXRSInvoker extends Abstra
                 }
 
                 OperationResourceInfo subOri = JAXRSUtils.findTargetMethod(subCri,
-                                                         exchange.getInMessage(),
+                                                         inMessage,
                                                          httpMethod,
                                                          values,
                                                          contentType,
                                                          acceptContentType,
                                                          true);
                 exchange.put(OperationResourceInfo.class, subOri);
-                msg.put(URITemplate.TEMPLATE_PARAMETERS, values);
+                inMessage.put(URITemplate.TEMPLATE_PARAMETERS, values);
+            
+                if (JAXRSUtils.runContainerRequestFilters(providerFactory,
+                                                      inMessage,
+                                                      false, subOri.getNameBindings())) {
+                    return new MessageContentsList(exchange.get(Response.class));
+                }
+                
                 // work out request parameters for the sub-resource class. Here we
                 // presume InputStream has not been consumed yet by the root resource class.
-                List<Object> newParams = JAXRSUtils.processParameters(subOri, values,
msg);
-                msg.setContent(List.class, newParams);
+                List<Object> newParams = JAXRSUtils.processParameters(subOri, values,
inMessage);
+                inMessage.setContent(List.class, newParams);
 
                 return this.invoke(exchange, newParams, result);
             } catch (IOException ex) {

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java?rev=1438094&r1=1438093&r2=1438094&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
Thu Jan 24 17:30:30 2013
@@ -222,6 +222,15 @@ public class JAXRSInInterceptor extends 
         
         setExchangeProperties(message, ori, values, resources.size());
         
+        // Global and name-bound post-match request filters
+        if (JAXRSUtils.runContainerRequestFilters(providerFactory,
+                                                  message,
+                                                  false, 
+                                                  ori.getNameBindings())) {
+            return;
+        }
+        
+        
         //Process parameters
         try {
             List<Object> params = JAXRSUtils.processParameters(ori, values, message);

Modified: cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer20.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer20.java?rev=1438094&r1=1438093&r2=1438094&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer20.java
(original)
+++ cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer20.java
Thu Jan 24 17:30:30 2013
@@ -74,6 +74,7 @@ public class BookServer20 extends Abstra
         providers.add(new CustomReaderInterceptor());
         providers.add(new CustomWriterInterceptor());
         providers.add(new CustomDynamicFeature());
+        providers.add(new PostMatchContainerRequestFilter());
         sf.setProviders(providers);
         sf.setResourceProvider(BookStore.class,
                                new SingletonResourceProvider(new BookStore(), true));
@@ -128,11 +129,12 @@ public class BookServer20 extends Abstra
                 || !"true".equals(context.getProperty("DynamicPrematchingFilter"))) {
                 throw new RuntimeException();
             }
-            context.getHeaders().add("BOOK", "123");
+            context.getHeaders().add("BOOK", "12");
         }
         
     }
     
+        
     @PreMatching
     @BindingPriority(2)
     private static class PreMatchDynamicContainerRequestFilter implements ContainerRequestFilter
{
@@ -147,6 +149,19 @@ public class BookServer20 extends Abstra
         
     }
     
+    @CustomHeaderAdded
+    private static class PostMatchContainerRequestFilter implements ContainerRequestFilter
{
+
+        @Override
+        public void filter(ContainerRequestContext context) throws IOException {
+            String value = context.getHeaders().getFirst("Book");
+            if (value != null) {
+                context.getHeaders().addFirst("Book", value + "3");
+            }
+        }
+        
+    }
+    
     @BindingPriority(3)
     public static class PostMatchContainerResponseFilter implements ContainerResponseFilter
{
 



Mime
View raw message