You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by mc...@apache.org on 2011/04/28 17:15:49 UTC

svn commit: r1097499 - in /struts/struts2/trunk/plugins/rest/src/main/java/org/apache/struts2/rest: RestActionMapper.java RestActionProxyFactory.java

Author: mcucchiara
Date: Thu Apr 28 15:15:49 2011
New Revision: 1097499

URL: http://svn.apache.org/viewvc?rev=1097499&view=rev
Log:
WW-3616 - Error in the detail view of the REST Showcase

Modified:
    struts/struts2/trunk/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionMapper.java
    struts/struts2/trunk/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionProxyFactory.java

Modified: struts/struts2/trunk/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionMapper.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionMapper.java?rev=1097499&r1=1097498&r2=1097499&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionMapper.java (original)
+++ struts/struts2/trunk/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionMapper.java Thu Apr 28 15:15:49 2011
@@ -33,7 +33,6 @@ import org.apache.struts2.dispatcher.map
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.HashMap;
-import java.util.Iterator;
 
 /**
  * <!-- START SNIPPET: description -->
@@ -335,9 +334,8 @@ public class RestActionMapper extends De
             String prefix = uri.substring(0, lastSlash);
             namespace = "";
             // Find the longest matching namespace, defaulting to the default
-            for (Iterator i = config.getPackageConfigs().values().iterator(); i
-                    .hasNext();) {
-                String ns = ((PackageConfig) i.next()).getNamespace();
+            for (Object o : config.getPackageConfigs().values()) {
+                String ns = ((PackageConfig) o).getNamespace();
                 if (ns != null && prefix.startsWith(ns) && (prefix.length() == ns.length() || prefix.charAt(ns.length()) == '/')) {
                     if (ns.length() > namespace.length()) {
                         namespace = ns;

Modified: struts/struts2/trunk/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionProxyFactory.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionProxyFactory.java?rev=1097499&r1=1097498&r2=1097499&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionProxyFactory.java (original)
+++ struts/struts2/trunk/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionProxyFactory.java Thu Apr 28 15:15:49 2011
@@ -36,7 +36,7 @@ public class RestActionProxyFactory exte
 
     public static final String STRUTS_REST_NAMESPACE = "struts.rest.namespace";
 
-    protected String namespace = "/";
+    protected String namespace;
 
     @Inject(value = STRUTS_REST_NAMESPACE, required = false)
     public void setNamespace(String namespace) {
@@ -45,7 +45,7 @@ public class RestActionProxyFactory exte
 
     @Override
     public ActionProxy createActionProxy(String namespace, String actionName, String methodName, Map extraContext, boolean executeResult, boolean cleanupContext) {
-        if (namespace.startsWith(this.namespace)) {
+        if (this.namespace == null || namespace.startsWith(this.namespace)) {
             ActionInvocation inv = new RestActionInvocation(extraContext, true);
             container.inject(inv);
             return createActionProxy(inv, namespace, actionName, methodName, executeResult, cleanupContext);