Author: chris.laprun(a)jboss.com
Date: 2009-04-01 06:43:58 -0400 (Wed, 01 Apr 2009)
New Revision: 13105
Modified:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/URLTools.java
Log:
- Added safeEncodeForHTMLId and safeDecodeForHTMLId methods used to ensure that a
PortalObjectPath can be properly used as an HTML/javascript id.
Modified:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/URLTools.java
===================================================================
---
modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/URLTools.java 2009-03-31
16:44:15 UTC (rev 13104)
+++
modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/URLTools.java 2009-04-01
10:43:58 UTC (rev 13105)
@@ -122,7 +122,8 @@
if (System.getProperty("http.proxyUser") != null)
{
- Authenticator.setDefault(new Authenticator(){
+ Authenticator.setDefault(new Authenticator()
+ {
protected PasswordAuthentication getPasswordAuthentication()
{
@@ -130,7 +131,7 @@
}
});
}
-
+
//
URLConnection conn;
try
@@ -466,4 +467,25 @@
return buf.toString();
}
+ public static String safeEncodeForHTMLId(String value)
+ {
+ value = value.replace("=", EQUALS);
+ value = value.replace("/", SLASH);
+ value = value.replace(".", DOT);
+ return value.replace("+", PLUS);
+ }
+
+ public static String safeDecodeForHTMLId(String value)
+ {
+ value = value.replace(EQUALS, "=");
+ value = value.replace(SLASH, "/");
+ value = value.replace(DOT, ".");
+ return value.replace(PLUS, "+");
+ }
+
+ private static final String EQUALS = "_e";
+ private static final String SLASH = "_s";
+ private static final String DOT = "_d";
+ private static final String PLUS = "_p";
+
}
Show replies by date