Author: henning
Date: Thu Jun 17 23:13:07 2010
New Revision: 955780

URL: http://svn.apache.org/viewvc?rev=955780&view=rev
Log:
SHINDIG-1371: HandlerExecutionListener.executed is never called for REST 
requests.

Align code path for RestInvocationHandler analog to RpcInvocationHandler



Modified:
    
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/DefaultHandlerRegistry.java

Modified: 
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/DefaultHandlerRegistry.java
URL: 
http://svn.apache.org/viewvc/shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/DefaultHandlerRegistry.java?rev=955780&r1=955779&r2=955780&view=diff
==============================================================================
--- 
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/DefaultHandlerRegistry.java
 (original)
+++ 
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/DefaultHandlerRegistry.java
 Thu Jun 17 23:13:07 2010
@@ -350,18 +350,26 @@ public class DefaultHandlerRegistry impl
 
     public Future<?> execute(Map<String, String[]> parameters, Reader body,
                              SecurityToken token, BeanConverter converter) {
+
+      RequestItem item;
       try {
         // bind the body contents if available
         if (body != null) {
           parameters.put(operation.bodyParam(), new 
String[]{IOUtils.toString(body)});
         }
-        RequestItem item = methodCaller.getRestRequestItem(parameters, token, 
converter,
+        item = methodCaller.getRestRequestItem(parameters, token, converter,
             beanJsonConverter);
-        listener.executing(item);
+        } catch (Exception e) {
+          return ImmediateFuture.errorInstance(e);
+        }
 
+      try {
+        listener.executing(item);
         return methodCaller.call(handlerProvider.get(), item);
       } catch (Exception e) {
         return ImmediateFuture.errorInstance(e);
+      } finally {
+          listener.executed(item);
       }
     }
   }


Reply via email to