mcardle 2005/11/18 19:12:18 CET
Modified files:
src/org/jahia/esi GetThread.java
Log:
* replaces ESI tags with html markers
Revision Changes Path
1.8 +10 -7 esi_server/src/org/jahia/esi/GetThread.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/esi_server/src/org/jahia/esi/GetThread.java.diff?r1=1.7&r2=1.8&f=h
Index: GetThread.java
===================================================================
RCS file: /home/cvs/repository/esi_server/src/org/jahia/esi/GetThread.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- GetThread.java 18 Nov 2005 16:17:29 -0000 1.7
+++ GetThread.java 18 Nov 2005 18:12:17 -0000 1.8
@@ -327,9 +327,9 @@
log.debug(id + " replacing node : "+esiTag.toHtml()+" with
cached content of length ["+cachedByteContent.length+"]");
//TODO: should really implement a NodeList.replace method
- esiTag.setTagName ("WAS:ESIINCLUDECLASS");
- //esiTag.setEndTag(new EsiIncludeTag());
- removeAllAttributes(esiTag);
+ esiTag.setTagName ("WAS:ESIINCLUDE");
+ esiTag.getEndTag().setTagName("WAS:END_ESIINCLUDE");
+ removeAllAttributes(esiTag, "WAS:ESIINCLUDE");
TextNode fragContentTextNode = new TextNode (new
String(cachedByteContent));
NodeList children = new NodeList (fragContentTextNode);
esiTag.setChildren (children);
@@ -352,8 +352,8 @@
log.debug(id + "clearing esi:REMOVE node :
"+esiRemoveTag.toHtml()+" ");
- esiRemoveTag.setTagName ("WAS:ESIREMOVECLASS");
- //esiRemoveTag.setEndTag(new EsiRemoveTag());
+ esiRemoveTag.setTagName ("WAS:ESIREMOVE");
+ esiRemoveTag.getEndTag().setTagName("WAS:END_ESIREMOVE");
TextNode blankContentTextNode = new TextNode (new
String(""));
NodeList children = new NodeList (blankContentTextNode);
esiRemoveTag.setChildren (children);
@@ -551,13 +551,16 @@
return listEsi;
}
- private void removeAllAttributes(TagNode tag) {
+ private void removeAllAttributes(TagNode tag, String attribToLeave) {
Vector v = tag.getAttributesEx();
Enumeration enumAtt = v.elements();
while (enumAtt.hasMoreElements()) {
Attribute att = (Attribute) enumAtt.nextElement();
- tag.removeAttribute(att.getName());
+ //log.debug("name:"+att.getName()+" Value:"+att.getValue()+ "
-- " + att.toString());
+ if (att.getName()!=null &&
!attribToLeave.equalsIgnoreCase(att.getName())) {
+ tag.removeAttribute(att.getName());
+ }
}
}