[jboss-svn-commits] JBoss Portal SVN: r5647 - branches/JBoss_Portal_Branch_2_4/core/src/main/org/jboss/portal/core/portlet/cms
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Nov 14 10:04:44 EST 2006
Author: sohil.shah at jboss.com
Date: 2006-11-14 10:04:43 -0500 (Tue, 14 Nov 2006)
New Revision: 5647
Modified:
branches/JBoss_Portal_Branch_2_4/core/src/main/org/jboss/portal/core/portlet/cms/CMSPortlet.java
Log:
backporting cms portlet performance enhancement from trunk
Modified: branches/JBoss_Portal_Branch_2_4/core/src/main/org/jboss/portal/core/portlet/cms/CMSPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/core/src/main/org/jboss/portal/core/portlet/cms/CMSPortlet.java 2006-11-14 14:01:14 UTC (rev 5646)
+++ branches/JBoss_Portal_Branch_2_4/core/src/main/org/jboss/portal/core/portlet/cms/CMSPortlet.java 2006-11-14 15:04:43 UTC (rev 5647)
@@ -204,13 +204,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);
- }
+ sHTML = this.cleanupContent(sHTML);
+
// begin modifying links
StringBuffer buffer = new StringBuffer();
Matcher m = RELATIVE_URI_PATTERN.matcher(sHTML);
@@ -277,4 +274,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