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/09/28 08:48:48 UTC

svn commit: r1391329 - in /rave/sandbox/content-services: demo-portal/src/main/java/org/apache/rave/portal/web/mvc/controller/ demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userpage/ demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userprofile...

Author: ate
Date: Fri Sep 28 06:48:47 2012
New Revision: 1391329

URL: http://svn.apache.org/viewvc?rev=1391329&view=rev
Log:
RAVE-698: Spring HMVC processor
- start sibling handler methods support
- ensure HandlerContext also set and available properly during view rendering
- provide jsp path tag to generate and render handler paths
- rename tag library appropriately to rave-hmvc and update usages accordingly
note: work in progress, generated sibling handler paths are not yet processed (404)

Added:
    rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/tags/PathTag.java   (with props)
    rave/sandbox/content-services/rave-web-hmvc/src/main/resources/META-INF/rave-hmvc.tld
      - copied, changed from r1390464, rave/sandbox/content-services/rave-web-hmvc/src/main/resources/META-INF/rave-core.tld
Removed:
    rave/sandbox/content-services/rave-web-hmvc/src/main/resources/META-INF/rave-core.tld
Modified:
    rave/sandbox/content-services/demo-portal/src/main/java/org/apache/rave/portal/web/mvc/controller/UserProfileFormController.java
    rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userpage/page-body.jsp
    rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userpage/page-content-mobile.jsp
    rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userpage/page-content.jsp
    rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userpage/page.jsp
    rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userprofile/page-body.jsp
    rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userprofile/page-form.jsp
    rave/sandbox/content-services/rave-jcr-console/pom.xml
    rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/HandlerConfigMapping.java
    rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/HandlerContext.java
    rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/HandlerContextImpl.java
    rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/NestedHandlerContext.java
    rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/NestedHandlerContextImpl.java
    rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/NestedHandlerMethodHandlerAdapter.java
    rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/RoutedHandlerMethod.java
    rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/RoutedRequestMappingHandlerMapping.java
    rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/servlet/NestedDispatcherServlet.java

Modified: rave/sandbox/content-services/demo-portal/src/main/java/org/apache/rave/portal/web/mvc/controller/UserProfileFormController.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/demo-portal/src/main/java/org/apache/rave/portal/web/mvc/controller/UserProfileFormController.java?rev=1391329&r1=1391328&r2=1391329&view=diff
==============================================================================
--- rave/sandbox/content-services/demo-portal/src/main/java/org/apache/rave/portal/web/mvc/controller/UserProfileFormController.java (original)
+++ rave/sandbox/content-services/demo-portal/src/main/java/org/apache/rave/portal/web/mvc/controller/UserProfileFormController.java Fri Sep 28 06:48:47 2012
@@ -52,7 +52,8 @@ public class UserProfileFormController {
 
     @Named
     @RequestMapping
-    public String render(NestedHandlerContext hc) {
+    public String render(NestedHandlerContext hc, ModelMap model) {
+        model.addAttribute("context", hc);
         return hc.getConfig().getViewName();
     }
 
@@ -64,7 +65,7 @@ public class UserProfileFormController {
 	 * @param updatedUser				Updated user information
 	 * @return the view name of the user profile page
 	 */
-    @RequestMapping(method = RequestMethod.POST)
+    @RequestMapping(method = RequestMethod.POST, value="/update")
     public String updateProfile(ModelMap model,
                                 @RequestParam(required = false) Long referringPageId,
                                 @ModelAttribute("updatedUser") UserForm updatedUser) {

Modified: rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userpage/page-body.jsp
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userpage/page-body.jsp?rev=1391329&r1=1391328&r2=1391329&view=diff
==============================================================================
--- rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userpage/page-body.jsp (original)
+++ rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userpage/page-body.jsp Fri Sep 28 06:48:47 2012
@@ -18,6 +18,6 @@
   --%>
 <%@ page language="java" trimDirectiveWhitespaces="true" %>
 <%@ include file="/WEB-INF/jsp/includes/taglibs.jsp" %>
-<%@ taglib uri="http://www.apache-rave.org/jsp/hmvc" prefix="rave-hmvc" %>
-<rave-hmvc:include ref="tabs"/>
-<rave-hmvc:include ref="content"/>
\ No newline at end of file
+<%@ taglib uri="http://www.apache-rave.org/jsp/hmvc" prefix="hmvc" %>
+<hmvc:include ref="tabs"/>
+<hmvc:include ref="content"/>
\ No newline at end of file

Modified: rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userpage/page-content-mobile.jsp
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userpage/page-content-mobile.jsp?rev=1391329&r1=1391328&r2=1391329&view=diff
==============================================================================
--- rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userpage/page-content-mobile.jsp (original)
+++ rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userpage/page-content-mobile.jsp Fri Sep 28 06:48:47 2012
@@ -18,8 +18,8 @@
   --%>
 <%@ page language="java" trimDirectiveWhitespaces="true" %>
 <%@ include file="/WEB-INF/jsp/includes/taglibs.jsp" %>
-<%@ taglib uri="http://www.apache-rave.org/jsp/hmvc" prefix="rave-hmvc" %>
-<rave-hmvc:include ref="layout"/>
+<%@ taglib uri="http://www.apache-rave.org/jsp/hmvc" prefix="hmvc" %>
+<hmvc:include ref="layout"/>
 <portal:register-init-script location="${'AFTER_RAVE'}">
   <script>
     $(function() {

Modified: rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userpage/page-content.jsp
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userpage/page-content.jsp?rev=1391329&r1=1391328&r2=1391329&view=diff
==============================================================================
--- rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userpage/page-content.jsp (original)
+++ rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userpage/page-content.jsp Fri Sep 28 06:48:47 2012
@@ -18,7 +18,7 @@
   --%>
 <%@ page language="java" trimDirectiveWhitespaces="true" %>
 <%@ include file="/WEB-INF/jsp/includes/taglibs.jsp" %>
-<%@ taglib uri="http://www.apache-rave.org/jsp/hmvc" prefix="rave-hmvc" %>
+<%@ taglib uri="http://www.apache-rave.org/jsp/hmvc" prefix="hmvc" %>
 <fmt:setBundle basename="messages"/>
 <sec:authentication property="principal.username" var="principleUsername" scope="request"/>
 <div class="row-fluid">
@@ -40,7 +40,7 @@
     <c:when test="${pageUser.pageStatus != 'PENDING'}">
       <div class="regions">
           <%-- insert the region layout template --%>
-          <rave-hmvc:include ref="layout"/>
+          <hmvc:include ref="layout"/>
       </div>
       <div class="clear-float">&nbsp;</div>
     </c:when>

Modified: rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userpage/page.jsp
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userpage/page.jsp?rev=1391329&r1=1391328&r2=1391329&view=diff
==============================================================================
--- rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userpage/page.jsp (original)
+++ rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userpage/page.jsp Fri Sep 28 06:48:47 2012
@@ -18,7 +18,7 @@
   --%>
 <%@ page language="java" trimDirectiveWhitespaces="true" %>
 <%@ include file="/WEB-INF/jsp/includes/taglibs.jsp" %>
-<%@ taglib uri="http://www.apache-rave.org/jsp/hmvc" prefix="rave-hmvc" %>
+<%@ taglib uri="http://www.apache-rave.org/jsp/hmvc" prefix="hmvc" %>
 <!DOCTYPE html>
 <html class="no-js">
 <head>
@@ -31,11 +31,11 @@
 <body>
 <input id="currentPageId" type="hidden" value="${page.id}"/>
 <%-- Header Content --%>
-<rave-hmvc:include ref="header"/>
+<hmvc:include ref="header"/>
 <%-- Main Body Content --%>
-<rave-hmvc:include ref="body"/>
+<hmvc:include ref="body"/>
 <%-- Footer Content --%>
-<rave-hmvc:include ref="footer"/>
+<hmvc:include ref="footer"/>
 <%-- render any script that needs to execute pre-src includes --%>
 <portal:render-init-script location="${'BEFORE_RAVE'}"/>
 <%-- render the javascript src includes at the bottom of the page for performance --%>

Modified: rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userprofile/page-body.jsp
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userprofile/page-body.jsp?rev=1391329&r1=1391328&r2=1391329&view=diff
==============================================================================
--- rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userprofile/page-body.jsp (original)
+++ rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userprofile/page-body.jsp Fri Sep 28 06:48:47 2012
@@ -18,19 +18,19 @@
   --%>
 <%@ page language="java" trimDirectiveWhitespaces="true" %>
 <%@ include file="/WEB-INF/jsp/includes/taglibs.jsp" %>
-<%@ taglib uri="http://www.apache-rave.org/jsp/hmvc" prefix="rave-hmvc" %>
+<%@ taglib uri="http://www.apache-rave.org/jsp/hmvc" prefix="hmvc" %>
 <div id="pageContent" class="container-fluid navbar-spacer">
   <div class="row-fluid">
     <div class="span9">
-      <rave-hmvc:include ref="form"/>
+      <hmvc:include ref="form"/>
       <%--render the sub pages --%>
       <div>
         <%-- insert the region layout template --%>
-        <rave-hmvc:include ref="tabs"/>
+        <hmvc:include ref="tabs"/>
         <div class="clear-float">&nbsp;</div>
       </div>
     </div>
-    <rave-hmvc:include ref="content"/>
+    <hmvc:include ref="content"/>
     <div class="clear-float">&nbsp;</div>
   </div>
 </div>

Modified: rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userprofile/page-form.jsp
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userprofile/page-form.jsp?rev=1391329&r1=1391328&r2=1391329&view=diff
==============================================================================
--- rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userprofile/page-form.jsp (original)
+++ rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/pages/userprofile/page-form.jsp Fri Sep 28 06:48:47 2012
@@ -18,9 +18,11 @@
   --%>
 <%@ page language="java" trimDirectiveWhitespaces="true" %>
 <%@ include file="/WEB-INF/jsp/includes/taglibs.jsp" %>
-<%@ taglib uri="http://www.apache-rave.org/jsp/hmvc" prefix="rave-hmvc" %>
+<%@ taglib uri="http://www.apache-rave.org/jsp/hmvc" prefix="hmvc" %>
 <div id="personProfileContent">
-  <c:url var="profileUrl" value="/app/person">
+
+  <hmvc:path pathFor="handler" handler="updateProfile" var="profilePath"/>
+  <c:url var="profileUrl" value="${profilePath}">
     <c:param name="referringPageId" value="${referringPageId}" />
   </c:url>
   <form:form id="editAccountForm" commandName="userProfile" action="${profileUrl}" method="POST" class="form-horizontal">

Modified: rave/sandbox/content-services/rave-jcr-console/pom.xml
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-console/pom.xml?rev=1391329&r1=1391328&r2=1391329&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-jcr-console/pom.xml (original)
+++ rave/sandbox/content-services/rave-jcr-console/pom.xml Fri Sep 28 06:48:47 2012
@@ -70,11 +70,61 @@
       <type>war</type>
     </dependency>
 
-    <!-- re-override spring-aop version forced in parent -->
+    <!-- override spring dependencies to make them same version as used in Rave -->
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-core</artifactId>
+      <version>${org.springframework.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-beans</artifactId>
+      <version>${org.springframework.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context</artifactId>
+      <version>${org.springframework.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context-support</artifactId>
+      <version>${org.springframework.version}</version>
+    </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-aop</artifactId>
-      <version>${hippo-jcr-console.springframework.version}</version>
+      <version>${org.springframework.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-asm</artifactId>
+      <version>${org.springframework.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-web</artifactId>
+      <version>${org.springframework.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-webmvc</artifactId>
+      <version>${org.springframework.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-expression</artifactId>
+      <version>${org.springframework.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-tx</artifactId>
+      <version>${org.springframework.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.security</groupId>
+      <artifactId>spring-security-core</artifactId>
+      <version>${org.springframework.version}</version>
     </dependency>
 
     <!-- adding slf4j and log4j dependencies to be bundled (not provided) -->

Modified: rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/HandlerConfigMapping.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/HandlerConfigMapping.java?rev=1391329&r1=1391328&r2=1391329&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/HandlerConfigMapping.java (original)
+++ rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/HandlerConfigMapping.java Fri Sep 28 06:48:47 2012
@@ -84,6 +84,23 @@ public class HandlerConfigMapping {
         return null;
     }
 
+    public HandlerConfig getSiblingHandlerConfig(HandlerConfig config, String handlerName) {
+        String componentTypeName = config.getComponentType().getName();
+        if (config instanceof NestedHandlerConfig) {
+            componentTypeName = "/" + componentTypeName;
+        }
+        Map<String, Map<String, HandlerConfig>> handlerRouteMap = handlerConfigMap.get(componentTypeName);
+        if (handlerRouteMap != null) {
+            Map<String, HandlerConfig> routeMap = handlerRouteMap.get(handlerName);
+            if (routeMap != null) {
+                String routeReferenceId = null;
+                // TODO: support multiple route with specific config.getRoute().getReferenceId()
+                return routeMap.get(routeReferenceId == null ? "" : routeReferenceId);
+            }
+        }
+        return null;
+    }
+
     public void clear() {
         componentTypeMap.clear();
         handlerConfigMap.clear();

Modified: rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/HandlerContext.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/HandlerContext.java?rev=1391329&r1=1391328&r2=1391329&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/HandlerContext.java (original)
+++ rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/HandlerContext.java Fri Sep 28 06:48:47 2012
@@ -24,6 +24,8 @@ public interface HandlerContext {
     String getComponentPath();
     String getPath();
 
+    HandlerContext getSiblingContext(String handlerName);
+
     HandlerContext getContext(Class componentType); // matching handler named "default"
     HandlerContext getContext(Class componentType, String handlerName);
     HandlerContext getContextByRoute(Class componentType, String handlerName, String routeReferenceId);

Modified: rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/HandlerContextImpl.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/HandlerContextImpl.java?rev=1391329&r1=1391328&r2=1391329&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/HandlerContextImpl.java (original)
+++ rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/HandlerContextImpl.java Fri Sep 28 06:48:47 2012
@@ -90,6 +90,14 @@ public class HandlerContextImpl implemen
         }
     }
 
+    public HandlerContext getSiblingContext(String handlerName) {
+        HandlerConfig hc = configMapping.getSiblingHandlerConfig(getConfig(), handlerName);
+        if (hc != null) {
+            return new HandlerContextImpl(this, hc);
+        }
+        return null;
+    }
+
     @Override
     public HandlerContext getContext(Class componentType) {
         return getContextByRoute(componentType, "default", null);

Modified: rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/NestedHandlerContext.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/NestedHandlerContext.java?rev=1391329&r1=1391328&r2=1391329&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/NestedHandlerContext.java (original)
+++ rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/NestedHandlerContext.java Fri Sep 28 06:48:47 2012
@@ -21,4 +21,6 @@ import org.springframework.web.util.UriC
 public interface NestedHandlerContext extends HandlerContext {
     @Override
     NestedHandlerConfig getConfig();
+
+    NestedHandlerContext getSiblingContext(String handlerName);
 }

Modified: rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/NestedHandlerContextImpl.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/NestedHandlerContextImpl.java?rev=1391329&r1=1391328&r2=1391329&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/NestedHandlerContextImpl.java (original)
+++ rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/NestedHandlerContextImpl.java Fri Sep 28 06:48:47 2012
@@ -46,6 +46,14 @@ public class NestedHandlerContextImpl ex
         }
     }
 
+    public NestedHandlerContext getSiblingContext(String handlerName) {
+        NestedHandlerConfig hc = (NestedHandlerConfig)configMapping.getSiblingHandlerConfig(getConfig(), handlerName);
+        if (hc != null) {
+            return new NestedHandlerContextImpl(this, hc);
+        }
+        return null;
+    }
+
     @Override
     public NestedHandlerConfig getConfig() {
         return (NestedHandlerConfig)super.getConfig();

Modified: rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/NestedHandlerMethodHandlerAdapter.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/NestedHandlerMethodHandlerAdapter.java?rev=1391329&r1=1391328&r2=1391329&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/NestedHandlerMethodHandlerAdapter.java (original)
+++ rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/NestedHandlerMethodHandlerAdapter.java Fri Sep 28 06:48:47 2012
@@ -60,7 +60,7 @@ public class NestedHandlerMethodHandlerA
         }
         NestedHandlerMethod hm = (handlerMethod instanceof NestedHandlerMethod) ? (NestedHandlerMethod)handlerMethod : null;
         if (hm != null) {
-            NestedHandlerContextImpl hc = (NestedHandlerContextImpl)request.getAttribute(NestedHandlerMethod.HANDLER_CONTEXT);
+            NestedHandlerContextImpl hc = (NestedHandlerContextImpl)request.getAttribute(RoutedHandlerMethod.HANDLER_CONTEXT);
             hc.setConfig(hm.getConfiguration());
         }
         ModelAndView mv = handleInternal(request, response, handlerMethod);
@@ -81,7 +81,8 @@ public class NestedHandlerMethodHandlerA
                 mv = new ModelAndView();
             }
 
-            mv.getModelMap().addAttribute(NestedHandlerMethod.MODEL_AND_VIEW, cmvMap);
+            mv.getModelMap().addAttribute(RoutedHandlerMethod.MODEL_AND_VIEW, cmvMap);
+            mv.getModelMap().addAttribute(RoutedHandlerMethod.HANDLER_METHOD, hm);
         }
 
         return mv;

Modified: rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/RoutedHandlerMethod.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/RoutedHandlerMethod.java?rev=1391329&r1=1391328&r2=1391329&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/RoutedHandlerMethod.java (original)
+++ rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/RoutedHandlerMethod.java Fri Sep 28 06:48:47 2012
@@ -26,6 +26,7 @@ public class RoutedHandlerMethod extends
     public static final String REQUEST_MAPPING_INFO = RoutedHandlerMethod.class.getName() + ".RequestMappingInfo";
     public static final String VIEW_RESPONSE_STATE = RoutedHandlerMethod.class.getName() + ".ViewResponseState";
     public static final String MODEL_AND_VIEW = RoutedHandlerMethod.class.getName() + ".ModelAndView";
+    public static final String HANDLER_METHOD = RoutedHandlerMethod.class.getName() + ".HandlerMethod";
     public static final String HANDLER_CONTEXT = RoutedHandlerMethod.class.getName() + ".HandlerContext";
     public static final String TARGET_ACTION_PATH_MAP = RoutedHandlerMethod.class.getName() + ".TargetActionPathMap";
     public static final String PREHANDLE_INTERCEPTOR_MODEL = RoutedHandlerMethod.class.getName() + ".PreHandleModel";

Modified: rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/RoutedRequestMappingHandlerMapping.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/RoutedRequestMappingHandlerMapping.java?rev=1391329&r1=1391328&r2=1391329&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/RoutedRequestMappingHandlerMapping.java (original)
+++ rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/RoutedRequestMappingHandlerMapping.java Fri Sep 28 06:48:47 2012
@@ -213,9 +213,6 @@ public class RoutedRequestMappingHandler
                             amiDefault = ami;
                         }
                     }
-                    else {
-                        continue;
-                    }
                 }
                 ami = map.put(ami.name, ami);
                 if (ami != null) {

Modified: rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/servlet/NestedDispatcherServlet.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/servlet/NestedDispatcherServlet.java?rev=1391329&r1=1391328&r2=1391329&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/servlet/NestedDispatcherServlet.java (original)
+++ rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/servlet/NestedDispatcherServlet.java Fri Sep 28 06:48:47 2012
@@ -23,7 +23,9 @@ import java.util.Map;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.rave.portal.web.mvc.NestedHandlerContextImpl;
 import org.apache.rave.portal.web.mvc.NestedHandlerMethod;
+import org.apache.rave.portal.web.mvc.RoutedHandlerMethod;
 import org.apache.rave.portal.web.mvc.support.NestedServletRequest;
 import org.apache.rave.portal.web.mvc.support.NestedServletResponse;
 import org.apache.rave.portal.web.mvc.support.ResponseHolder;
@@ -48,6 +50,11 @@ public class NestedDispatcherServlet ext
             NestedServletResponse nestedResponse = new NestedServletResponse(response);
 
             renderChildren(mv, nestedRequest, nestedResponse);
+
+            NestedHandlerMethod hm = (NestedHandlerMethod)mv.getModelMap().get(RoutedHandlerMethod.HANDLER_METHOD);
+            NestedHandlerContextImpl hc = (NestedHandlerContextImpl)request.getAttribute(RoutedHandlerMethod.HANDLER_CONTEXT);
+            hc.setConfig(hm.getConfiguration());
+
             render(mv, nestedRequest, nestedResponse);
             ResponseHolder responseHolder = nestedResponse.getResponseHolder();
             responseHolder.flush();

Added: rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/tags/PathTag.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/tags/PathTag.java?rev=1391329&view=auto
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/tags/PathTag.java (added)
+++ rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/tags/PathTag.java Fri Sep 28 06:48:47 2012
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.rave.portal.web.mvc.tags;
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.tagext.TagSupport;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.rave.portal.web.mvc.HandlerContext;
+import org.apache.rave.portal.web.mvc.RoutedHandlerMethod;
+import org.springframework.web.servlet.HandlerMapping;
+
+public class PathTag extends TagSupport {
+
+    private static final long serialVersionUID = 1L;
+
+    public static final String defaultUrlFor = "handler";
+
+    /** Captures URI template variable names.
+        Copied from org.springframework.web.util.UriComponents
+    */
+    private static final Pattern NAMES_PATTERN = Pattern.compile("\\{([^/]+?)\\}");
+
+    private String pathFor = null;
+    private String handler = null;
+
+
+    private String var;
+    private int scope = PageContext.PAGE_SCOPE;
+    private boolean expandPathVariables = true;
+
+
+    @Override
+    public int doStartTag() throws JspException {
+        return EVAL_BODY_INCLUDE;
+    }
+
+    @Override
+    public int doEndTag() throws JspException {
+
+        HandlerContext context = (HandlerContext)pageContext.getRequest().getAttribute(RoutedHandlerMethod.HANDLER_CONTEXT);
+        if (context != null) {
+
+            if (!StringUtils.isEmpty(handler)) {
+                context = context.getSiblingContext(handler);
+            }
+            if (context != null) {
+                if (StringUtils.isEmpty(pathFor) || defaultUrlFor.equalsIgnoreCase(pathFor)) {
+
+                    String path = context.getPath();
+                    if (expandPathVariables) {
+                        path = expandPath(path);
+                    }
+                    if (!StringUtils.isEmpty(var)) {
+                        pageContext.setAttribute(var, path, scope);
+                    }
+                    else {
+                        writeOutput(path);
+                    }
+                }
+            }
+        }
+        pathFor = null;
+        handler = null;
+        var = null;
+        return EVAL_PAGE;
+    }
+
+    /*
+     * Copied and adapted from org.springframework.web.util.UriComponents#expandUriComponent
+     */
+    private String expandPath(String path) {
+        if (path.indexOf('{') == -1) {
+            return path;
+        }
+        Map<String, String> variables =
+                (Map<String, String>) pageContext.getRequest().getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
+
+        if (variables == null || variables.isEmpty()) {
+            return path;
+        }
+
+        Matcher matcher = NAMES_PATTERN.matcher(path);
+        StringBuffer sb = new StringBuffer();
+        while (matcher.find()) {
+            String match = matcher.group(1);
+            String variableName = (match.indexOf(':') == -1) ? match : match.substring(0, match.indexOf(':'));
+            if (variables.containsKey(variableName)) {
+                String variableValue = variables.get(variableName);
+                if (variableValue == null) {
+                    variableValue = "";
+                }
+                String replacement = Matcher.quoteReplacement(variableValue);
+                matcher.appendReplacement(sb, replacement);
+            }
+            else {
+                matcher.appendReplacement(sb, matcher.group());
+            }
+        }
+        matcher.appendTail(sb);
+        return sb.toString();
+    }
+
+    private void writeOutput(String str) throws JspException {
+        try {
+            pageContext.getOut().print(str);
+        } catch (IOException e) {
+            throw new JspException("Failed to render", e);
+        }
+    }
+
+    public String getPathFor() {
+        return pathFor;
+    }
+
+    public void setPathFor(String pathFor) {
+        this.pathFor = pathFor;
+    }
+
+    public String getHandler() {
+        return handler;
+    }
+
+    public void setHandler(final String handler) {
+        this.handler = handler;
+    }
+
+    public String getVar() {
+        return var;
+    }
+
+    public void setVar(String var) {
+        this.var = var;
+    }
+}

Propchange: rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/tags/PathTag.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/tags/PathTag.java
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: rave/sandbox/content-services/rave-web-hmvc/src/main/resources/META-INF/rave-hmvc.tld (from r1390464, rave/sandbox/content-services/rave-web-hmvc/src/main/resources/META-INF/rave-core.tld)
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/resources/META-INF/rave-hmvc.tld?p2=rave/sandbox/content-services/rave-web-hmvc/src/main/resources/META-INF/rave-hmvc.tld&p1=rave/sandbox/content-services/rave-web-hmvc/src/main/resources/META-INF/rave-core.tld&r1=1390464&r2=1391329&rev=1391329&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/main/resources/META-INF/rave-core.tld (original)
+++ rave/sandbox/content-services/rave-web-hmvc/src/main/resources/META-INF/rave-hmvc.tld Fri Sep 28 06:48:47 2012
@@ -40,7 +40,39 @@
     </attribute>
     <example>
       <![CDATA[
-          <rave:include ref="footer" />
+          <hmvc:include ref="footer" />
+      ]]>
+    </example>
+  </tag>
+  <tag>
+    <description>Output a HandlerContext path (pattern)</description>
+    <name>path</name>
+    <tag-class>org.apache.rave.portal.web.mvc.tags.PathTag</tag-class>
+    <body-content>empty</body-content>
+    <attribute>
+      <description>The 'scope' for which the path should be output: 'handler' (default), 'component', 'route' or 'mount'</description>
+      <name>pathFor</name>
+      <required>false</required>
+      <rtexprvalue>true</rtexprvalue>
+      <type>java.lang.String</type>
+    </attribute>
+    <attribute>
+      <description>sibling or other HandlerContext handler name</description>
+      <name>handler</name>
+      <required>false</required>
+      <rtexprvalue>true</rtexprvalue>
+      <type>java.lang.String</type>
+    </attribute>
+    <attribute>
+      <description>The name of the page scope variable to export the path value to</description>
+      <name>var</name>
+      <required>false</required>
+      <rtexprvalue>true</rtexprvalue>
+      <type>java.lang.String</type>
+    </attribute>
+    <example>
+      <![CDATA[
+          <hmvc:path pathFor="handler" handler="updateProfile"/>
       ]]>
     </example>
   </tag>