[jboss-svn-commits] JBoss Portal SVN: r5639 - trunk/core/src/main/org/jboss/portal/core/portlet/cms
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Nov 13 20:46:22 EST 2006
Author: sohil.shah at jboss.com
Date: 2006-11-13 20:46:22 -0500 (Mon, 13 Nov 2006)
New Revision: 5639
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/cms/CMSPortlet.java
Log:
cms portlet performance enhancement
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/cms/CMSPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/cms/CMSPortlet.java 2006-11-14 01:14:12 UTC (rev 5638)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/cms/CMSPortlet.java 2006-11-14 01:46:22 UTC (rev 5639)
@@ -208,13 +208,10 @@
if (file != null)
{
sHTML = file.getContent().getContentAsString();
- // clean html and body tags
- Matcher h = STRIP_TAGS_PATTERN.matcher(sHTML);
- while (h.find())
- {
- //System.out.println(h.group(1) + " " + h.group(2));
- sHTML = h.group(2);
- }
+
+ // clean html and body tags
+ sHTML = this.cleanupContent(sHTML);
+
// begin modifying links
StringBuffer buffer = new StringBuffer();
Matcher m = RELATIVE_URI_PATTERN.matcher(sHTML);
@@ -223,11 +220,11 @@
String relURI = m.group(3) != null ? m.group(3) : m.group(4);
String absoluteURI = this.buildURL((JBossRenderRequest)req, "/" + relURI);
m.appendReplacement(buffer, "$1$2" + FileUtil.cleanDoubleSlashes(absoluteURI) + "$2");
-/* if(!relURI.startsWith("mailto") && !relURI.startsWith("http"))
- {
- String absoluteURI = this.buildURL(resp, "/" + relURI);
- m.appendReplacement(buffer, "$1\"" + FileUtil.cleanDoubleSlashes(absoluteURI) + "\"");
- }*/
+// if(!relURI.startsWith("mailto") && !relURI.startsWith("http"))
+// {
+// String absoluteURI = this.buildURL(resp, "/" + relURI);
+// m.appendReplacement(buffer, "$1\"" + FileUtil.cleanDoubleSlashes(absoluteURI) + "\"");
+// }
}
m.appendTail(buffer);
sHTML = buffer.toString();
@@ -280,4 +277,25 @@
PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher(CMS_JSP_PATH + "/edit.jsp");
prd.include(req, resp);
}
+
+ /**
+ *
+ * @param originalContent
+ * @return
+ */
+ private String cleanupContent(String content)
+ {
+ //including content only between the <body> and </body>
+ if(content.toLowerCase().indexOf("<body")!=-1)
+ {
+ Matcher h = STRIP_TAGS_PATTERN.matcher(content);
+ while (h.find())
+ {
+ content = h.group(2);
+ }
+ }
+
+
+ return content;
+ }
}
More information about the jboss-svn-commits
mailing list