[jboss-svn-commits] JBoss Portal SVN: r5117 - branches/JBoss_Portal_Branch_2_4/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:39:58 EDT 2006
Author: julien at jboss.com
Date: 2006-08-30 04:39:57 -0400 (Wed, 30 Aug 2006)
New Revision: 5117
Modified:
branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java
Log:
JBPORTAL-1005 : WSRP URL rewriter usage not thread safe
Modified: branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java 2006-08-30 08:25:49 UTC (rev 5116)
+++ branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java 2006-08-30 08:39:57 UTC (rev 5117)
@@ -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.getContext());
- WSRP_URL_REWRITER.setSecure(invocation.getSecurityContext().isSecure());
+ WSRPURLRewriter rewriter = (WSRPURLRewriter)wsrpURLRewriterLocal.get();
+ rewriter.setContext(invocation.getContext());
+ 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