wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r1030520 - /incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/handlers/HeadMethodHandler.java
Date Wed, 03 Nov 2010 16:33:27 GMT
Author: bluk
Date: Wed Nov  3 16:33:26 2010
New Revision: 1030520

URL: http://svn.apache.org/viewvc?rev=1030520&view=rev
Log:
Update HeadMethodHandler for ServletWrapper code

In case someone changes the HttpServletResponse
before/after HeadMethodHandler, allow the handler
to proceed.

Modified:
    incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/handlers/HeadMethodHandler.java

Modified: incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/handlers/HeadMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/handlers/HeadMethodHandler.java?rev=1030520&r1=1030519&r2=1030520&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/handlers/HeadMethodHandler.java
(original)
+++ incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/handlers/HeadMethodHandler.java
Wed Nov  3 16:33:26 2010
@@ -66,6 +66,8 @@ public class HeadMethodHandler implement
             HttpServletResponse originalResponse = context.getAttribute(HttpServletResponse.class);
             NoBodyResponse noBodyResponse = new NoBodyResponse(originalResponse);
             context.setAttribute(HttpServletResponse.class, noBodyResponse);
+            context.setAttribute(HttpServletResponseWrapper.class, noBodyResponse);
+            context.setAttribute(NoBodyResponse.class, noBodyResponse);
             context.getAttributes().put(ORIGINAL_RESPONSE_ATT_NAME, originalResponse);
             chain.doChain(context);
         }
@@ -77,7 +79,8 @@ public class HeadMethodHandler implement
         if (originalResponse != null) {
             HttpServletResponse response = context.getAttribute(HttpServletResponse.class);
             response.flushBuffer();
-            response.setContentLength(((NoBodyResponse)response).getContentLengthValue());
+            NoBodyResponse noBodyResponse = context.getAttribute(NoBodyResponse.class);
+            response.setContentLength(noBodyResponse.getContentLengthValue());
             // set the original response on the context
             context.setAttribute(HttpServletResponse.class, originalResponse);
         }



Mime
View raw message