Author: simoneg
Date: Wed Nov 18 16:36:27 2009
New Revision: 881830

URL: http://svn.apache.org/viewvc?rev=881830&view=rev
Log:
Wrapping DIV around .ajax call

Modified:
    
labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/Dispatch.java

Modified: 
labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/Dispatch.java
URL: 
http://svn.apache.org/viewvc/labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/Dispatch.java?rev=881830&r1=881829&r2=881830&view=diff
==============================================================================
--- 
labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/Dispatch.java
 (original)
+++ 
labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/Dispatch.java
 Wed Nov 18 16:36:27 2009
@@ -25,6 +25,7 @@
 import org.apache.magma.basics.startup.Startup;
 
 import java.io.IOException;
+import java.io.OutputStream;
 import java.io.PrintStream;
 import java.lang.reflect.Method;
 import java.util.HashMap;
@@ -177,7 +178,24 @@
                        contentType += "; charset=utf-8";
                }
                resp.setContentType(contentType);
-               producer.produce(Cycle.get().getRewriting());
+               OutputStream str = Cycle.get().getRewriting();
+               if (producer instanceof HtmlProducer) {
+                       try {
+                               str.write("<div class=\"AjaxWrapper 
".getBytes("UTF-8"));
+                               
str.write(Template.computeCompleteProducerClasses((HtmlProducer) 
producer).getBytes("UTF-8"));
+                               str.write("\">".getBytes("UTF-8"));
+                       } catch (Exception e) {
+                               // It could be either an unmanageable 
IOException or an impossible Unsupported encoding exception
+                       }
+               }
+               producer.produce(str);
+               if (producer instanceof HtmlProducer) {
+                       try {
+                               str.write("</div>".getBytes("UTF-8"));
+                       } catch (Exception e) {
+                               // It could be either an unmanageable 
IOException or an impossible Unsupported encoding exception
+                       }
+               }               
        }
 
        public void handleHTML(HtmlProducer producer, HttpServletRequest req, 
HttpServletResponse resp) {



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to