Author: chris.laprun(a)jboss.com
Date: 2009-02-04 18:33:04 -0500 (Wed, 04 Feb 2009)
New Revision: 12775
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java
Log:
- JBPORTAL-2304: Shortened namespace. It should be enough to only use the last part of the
path (as the window name should be unique within the page context). Depending on window
name format, it could be possible to optimize the code further (in terms of speed).
- Needs to be properly tested!
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java 2009-02-04
23:12:55 UTC (rev 12774)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java 2009-02-04
23:33:04 UTC (rev 12775)
@@ -37,6 +37,7 @@
{
public static final String PREFIX = "jbpns";
public static final String SUFFIX = "snpbj";
+ private static final String SLASH = "/";
/**
* Creates a <code>WindowState</code> object based on the specified name.
@@ -108,9 +109,10 @@
}
else
{
- StringBuffer tmp = new StringBuffer(PREFIX.length() + windowId.length() * 2);
+ int length = windowId.length();
+ StringBuffer tmp = new StringBuffer(PREFIX.length() + SUFFIX.length() + length +
5);
tmp.append(PREFIX);
- for (int i = 0; i < windowId.length(); i++)
+ for (int i = windowId.lastIndexOf(SLASH) + 1; i < length; i++)
{
char c = windowId.charAt(i);
if (((int)c >= 65 && (int)c <= 90) || ((int)c >= 97
&& (int)c <= 122) || ((int)c >= 48 && (int)c <= 57) || ((int)c ==
95) || (int)c == 36)
Show replies by date