You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2011/08/09 03:06:21 UTC
svn commit: r1155180 -
/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AjaxPartialResponseRendererImpl.java
Author: hlship
Date: Tue Aug 9 01:06:20 2011
New Revision: 1155180
URL: http://svn.apache.org/viewvc?rev=1155180&view=rev
Log:
TAP5-1598: CLoak/decloak the Environment using a try…finally block when partial page rendering
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AjaxPartialResponseRendererImpl.java
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AjaxPartialResponseRendererImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AjaxPartialResponseRendererImpl.java?rev=1155180&r1=1155179&r2=1155180&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AjaxPartialResponseRendererImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AjaxPartialResponseRendererImpl.java Tue Aug 9 01:06:20 2011
@@ -70,28 +70,32 @@ public class AjaxPartialResponseRenderer
{
environment.cloak();
- // This is a complex area as we are trying to keep public and private services properly
- // separated, and trying to keep stateless and stateful (i.e., perthread scope) services
- // separated. So we inform the stateful queue service what it needs to do here ...
+ try
+ {
+ // This is a complex area as we are trying to keep public and private services properly
+ // separated, and trying to keep stateless and stateful (i.e., perthread scope) services
+ // separated. So we inform the stateful queue service what it needs to do here ...
- ContentType pageContentType = (ContentType) request.getAttribute(InternalConstants.CONTENT_TYPE_ATTRIBUTE_NAME);
+ ContentType pageContentType = (ContentType) request.getAttribute(InternalConstants.CONTENT_TYPE_ATTRIBUTE_NAME);
- ContentType contentType = new ContentType(InternalConstants.JSON_MIME_TYPE, outputEncoding);
+ ContentType contentType = new ContentType(InternalConstants.JSON_MIME_TYPE, outputEncoding);
- MarkupWriter writer = factory.newPartialMarkupWriter(pageContentType);
+ MarkupWriter writer = factory.newPartialMarkupWriter(pageContentType);
- JSONObject reply = new JSONObject();
+ JSONObject reply = new JSONObject();
- // ... and here, the pipeline eventually reaches the PRQ to let it render the root render command.
+ // ... and here, the pipeline eventually reaches the PRQ to let it render the root render command.
- partialMarkupRenderer.renderMarkup(writer, reply);
+ partialMarkupRenderer.renderMarkup(writer, reply);
- PrintWriter pw = response.getPrintWriter(contentType.toString());
+ PrintWriter pw = response.getPrintWriter(contentType.toString());
- reply.print(pw, compactJSON);
+ reply.print(pw, compactJSON);
- pw.close();
-
- environment.decloak();
+ pw.close();
+ } finally
+ {
+ environment.decloak();
+ }
}
}