[jboss-svn-commits] JBoss Portal SVN: r5116 - trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Aug 30 04:25:50 EDT 2006
Author: julien at jboss.com
Date: 2006-08-30 04:25:49 -0400 (Wed, 30 Aug 2006)
New Revision: 5116
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java
Log:
JBPORTAL-1005 : WSRP URL rewriter usage not thread safe
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java 2006-08-29 23:17:57 UTC (rev 5115)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java 2006-08-30 08:25:49 UTC (rev 5116)
@@ -47,10 +47,28 @@
*/
public class RenderHandler extends InvocationHandler
{
+
+ /** The separator constant. */
private static final String SEPARATOR = "_";
- private static final WSRPURLRewriter WSRP_URL_REWRITER = new WSRPURLRewriter();
- private static final ResourceURLRewriter RESOURCE_URL_REWRITER = new ResourceURLRewriter();
+ /** . */
+ private final ThreadLocal wsrpURLRewriterLocal = new ThreadLocal()
+ {
+ protected Object initialValue()
+ {
+ return new WSRPURLRewriter();
+ }
+ };
+
+ /** . */
+ private final ThreadLocal resourceURLRewriterLocal = new ThreadLocal()
+ {
+ protected Object initialValue()
+ {
+ return new ResourceURLRewriter();
+ }
+ };
+
public RenderHandler(WSRPConsumerImpl consumer)
{
super(consumer);
@@ -141,17 +159,18 @@
if (rewriteURLs)
{
- WSRP_URL_REWRITER.setContext(invocation.getPortletContext());
- WSRP_URL_REWRITER.setSecure(invocation.getSecurityContext().isSecure());
+ WSRPURLRewriter rewriter = (WSRPURLRewriter)wsrpURLRewriterLocal.get();
+ rewriter.setContext(invocation.getPortletContext());
+ rewriter.setSecure(invocation.getSecurityContext().isSecure());
String userId = invocation.getUserContext().getId();
- WSRP_URL_REWRITER.setAuthenticated(userId != null); // is this correct?
-
- return URLTools.replaceURLsBy(markup, WSRP_URL_REWRITER);
+ rewriter.setAuthenticated(userId != null); // is this correct?
+ return URLTools.replaceURLsBy(markup, rewriter);
}
else
{
// means that the producer generated the URLs, so handle resources...
- return URLTools.replaceURLsBy(markup, RESOURCE_URL_REWRITER);
+ ResourceURLRewriter rewriter = (ResourceURLRewriter)resourceURLRewriterLocal.get();
+ return URLTools.replaceURLsBy(markup, rewriter);
}
}
More information about the jboss-svn-commits
mailing list