struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mr...@apache.org
Subject svn commit: r589083 - in /struts/sandbox/trunk/struts2-rest-plugin/src: main/java/org/apache/struts2/rest/ContentTypeHandlerManager.java main/resources/struts-plugin.xml test/java/org/apache/struts2/rest/ContentTypeHandlerManagerTest.java
Date Sat, 27 Oct 2007 12:05:20 GMT
Author: mrdon
Date: Sat Oct 27 05:05:20 2007
New Revision: 589083

URL: http://svn.apache.org/viewvc?rev=589083&view=rev
Log:
Renamed default extension variable to be more clear

Modified:
    struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/ContentTypeHandlerManager.java
    struts/sandbox/trunk/struts2-rest-plugin/src/main/resources/struts-plugin.xml
    struts/sandbox/trunk/struts2-rest-plugin/src/test/java/org/apache/struts2/rest/ContentTypeHandlerManagerTest.java

Modified: struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/ContentTypeHandlerManager.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/ContentTypeHandlerManager.java?rev=589083&r1=589082&r2=589083&view=diff
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/ContentTypeHandlerManager.java
(original)
+++ struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/ContentTypeHandlerManager.java
Sat Oct 27 05:05:20 2007
@@ -44,12 +44,12 @@
 public class ContentTypeHandlerManager {
 
     Map<String,ContentTypeHandler> handlers = new HashMap<String,ContentTypeHandler>();
-    String defaultHandlerName;
+    String defaultExtension;
     public static final String STRUTS_REST_HANDLER_OVERRIDE_PREFIX = "struts.rest.handlerOverride.";
 
-    @Inject("struts.rest.defaultHandlerName")
-    public void setDefaultHandlerName(String name) {
-        this.defaultHandlerName = name;
+    @Inject("struts.rest.defaultExtension")
+    public void setDefaultExtension(String name) {
+        this.defaultExtension = name;
     }
 
     @Inject
@@ -80,7 +80,7 @@
     public ContentTypeHandler getHandlerForRequest(HttpServletRequest req) {
         String extension = findExtension(req.getRequestURI());
         if (extension == null) {
-            extension = defaultHandlerName;
+            extension = defaultExtension;
         }
         return handlers.get(extension);
     }

Modified: struts/sandbox/trunk/struts2-rest-plugin/src/main/resources/struts-plugin.xml
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/src/main/resources/struts-plugin.xml?rev=589083&r1=589082&r2=589083&view=diff
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/src/main/resources/struts-plugin.xml (original)
+++ struts/sandbox/trunk/struts2-rest-plugin/src/main/resources/struts-plugin.xml Sat Oct
27 05:05:20 2007
@@ -18,7 +18,7 @@
     <bean type="org.apache.struts2.rest.handler.ContentTypeHandler" name="html" class="org.apache.struts2.rest.handler.HtmlHandler"
/>
 
     <constant name="struts.actionProxyFactory" value="rest" />
-    <constant name="struts.rest.defaultHandlerName" value="xml" />
+    <constant name="struts.rest.defaultExtension" value="xml" />
     <constant name="struts.mapper.class" value="rest" />
     <constant name="struts.mapper.idParameterName" value="id" />
     <constant name="struts.action.extension" value="xhtml,,xml,json" />

Modified: struts/sandbox/trunk/struts2-rest-plugin/src/test/java/org/apache/struts2/rest/ContentTypeHandlerManagerTest.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/src/test/java/org/apache/struts2/rest/ContentTypeHandlerManagerTest.java?rev=589083&r1=589082&r2=589083&view=diff
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/src/test/java/org/apache/struts2/rest/ContentTypeHandlerManagerTest.java
(original)
+++ struts/sandbox/trunk/struts2-rest-plugin/src/test/java/org/apache/struts2/rest/ContentTypeHandlerManagerTest.java
Sat Oct 27 05:05:20 2007
@@ -78,7 +78,7 @@
             public String getExtension() { return "foo"; }
         };
         mgr.handlers.put("xml", handler);
-        mgr.defaultHandlerName = "xml";
+        mgr.defaultExtension = "xml";
         mgr.handleResult(new ActionConfig(), new DefaultHttpHeaders().withStatus(SC_OK),
obj);
 
         assertEquals(obj.getBytes().length, mockResponse.getContentLength());



Mime
View raw message