You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by at...@apache.org on 2012/08/07 16:38:35 UTC

svn commit: r1370282 - in /rave/sandbox/content-services: demo-portal/src/main/webapp/WEB-INF/jsp/hmvc/ rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/servlet/ rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/tags/

Author: ate
Date: Tue Aug  7 14:38:35 2012
New Revision: 1370282

URL: http://svn.apache.org/viewvc?rev=1370282&view=rev
Log:
RAVE-698: first minimal hmvc based rendering example working

Modified:
    rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/hmvc/mybody.jsp
    rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/hmvc/mypage.jsp
    rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/servlet/HmvcDispatcherServlet.java
    rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/tags/IncludeComponentTag.java

Modified: rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/hmvc/mybody.jsp
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/hmvc/mybody.jsp?rev=1370282&r1=1370281&r2=1370282&view=diff
==============================================================================
--- rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/hmvc/mybody.jsp (original)
+++ rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/hmvc/mybody.jsp Tue Aug  7 14:38:35 2012
@@ -5,4 +5,10 @@
 <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
 <%@ taglib uri="http://www.apache-rave.org/jsp/core" prefix="rave" %>
 
-<h2>mybody</h2>
\ No newline at end of file
+<h2>mybody</h2>
+<table border="1">
+<tr>
+  <td><rave:include ref="menu"/></td>
+  <td><rave:include ref="content"/></td>
+</tr>
+</table>

Modified: rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/hmvc/mypage.jsp
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/hmvc/mypage.jsp?rev=1370282&r1=1370281&r2=1370282&view=diff
==============================================================================
--- rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/hmvc/mypage.jsp (original)
+++ rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/hmvc/mypage.jsp Tue Aug  7 14:38:35 2012
@@ -4,5 +4,19 @@
 <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
 <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
 <%@ taglib uri="http://www.apache-rave.org/jsp/core" prefix="rave" %>
-
-<h1>mypage</h1>
\ No newline at end of file
+<html>
+<body>
+<h1>mypage</h1>
+<table border="1">
+<tr>
+  <td><rave:include ref="head"/></td>
+</tr>
+<tr>
+  <td><rave:include ref="body"/></td>
+</tr>
+<tr>
+  <td><rave:include ref="footer"/></td>
+</tr>
+</table>
+</body>
+</html>

Modified: rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/servlet/HmvcDispatcherServlet.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/servlet/HmvcDispatcherServlet.java?rev=1370282&r1=1370281&r2=1370282&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/servlet/HmvcDispatcherServlet.java (original)
+++ rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/servlet/HmvcDispatcherServlet.java Tue Aug  7 14:38:35 2012
@@ -26,6 +26,7 @@ import javax.servlet.http.HttpServletRes
 import org.apache.rave.portal.web.hmvc.HmvcHandlerMethod;
 import org.apache.rave.portal.web.hmvc.support.HmvcServletRequest;
 import org.apache.rave.portal.web.hmvc.support.HmvcServletResponse;
+import org.apache.rave.portal.web.hmvc.support.ResponseHolder;
 import org.springframework.web.servlet.DispatcherServlet;
 import org.springframework.web.servlet.ModelAndView;
 import org.springframework.web.servlet.View;
@@ -50,7 +51,7 @@ public class HmvcDispatcherServlet exten
         @SuppressWarnings("unchecked")
         Map<String, ModelAndView> ccmvMap = (Map<String, ModelAndView>) mv.getModelMap().get(HmvcHandlerMethod.MODEL_AND_VIEW);
         if (ccmvMap != null) {
-            Map<String, Object> ccvrMap = new LinkedHashMap<String, Object>();
+            Map<String, ResponseHolder> ccvrMap = new LinkedHashMap<String, ResponseHolder>();
             mv.getModelMap().addAttribute(HmvcHandlerMethod.VIEW_RESPONSE_STATE, ccvrMap);
             for (Map.Entry<String, ModelAndView> entry : ccmvMap.entrySet()) {
                 HmvcServletResponse childHmvcResponse = new HmvcServletResponse(hvmcResponse);

Modified: rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/tags/IncludeComponentTag.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/tags/IncludeComponentTag.java?rev=1370282&r1=1370281&r2=1370282&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/tags/IncludeComponentTag.java (original)
+++ rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/tags/IncludeComponentTag.java Tue Aug  7 14:38:35 2012
@@ -20,12 +20,15 @@
 package org.apache.rave.portal.web.hmvc.tags;
 
 import java.io.IOException;
+import java.util.Map;
 
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.JspWriter;
 import javax.servlet.jsp.tagext.TagSupport;
 
+import org.apache.rave.portal.web.hmvc.HmvcHandlerMethod;
 import org.apache.rave.portal.web.hmvc.support.HmvcServletResponse;
+import org.apache.rave.portal.web.hmvc.support.ResponseHolder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -50,25 +53,28 @@ public class IncludeComponentTag extends
     @Override
     public int doEndTag() throws JspException {
 
-
-        HmvcServletResponse response = (HmvcServletResponse) pageContext.getResponse();
-        if (response == null) {
-            if (log.isDebugEnabled()) {
-                log.error("Response was null");
+        @SuppressWarnings("unchecked")
+        Map<String, ResponseHolder> ccvrMap = (Map<String, ResponseHolder>) pageContext.getRequest().getAttribute(HmvcHandlerMethod.VIEW_RESPONSE_STATE);
+        if (ccvrMap != null && ccvrMap.containsKey(ref)) {
+
+            HmvcServletResponse response = (HmvcServletResponse) pageContext.getResponse();
+            if (response == null) {
+                if (log.isDebugEnabled()) {
+                    log.error("Response was null");
+                }
+                return EVAL_PAGE;
             }
-            return EVAL_PAGE;
-        }
 
-
-        try {
-            JspWriter writer = pageContext.getOut();
-            writer.flush();
-        } catch (IOException e) {
-            if (log.isDebugEnabled()) {
-                log.error("Error including component: " + ref, e);
+            try {
+                JspWriter writer = pageContext.getOut();
+                writer.flush();
+                ccvrMap.get(ref).flush();
+            } catch (IOException e) {
+                if (log.isDebugEnabled()) {
+                    log.error("Error including component: " + ref, e);
+                }
             }
         }
-
         ref = null;
         return EVAL_PAGE;
     }