Author: scottbw
Date: Wed Mar 28 12:28:28 2012
New Revision: 1306288

URL: http://svn.apache.org/viewvc?rev=1306288&view=rev
Log:
Allow a "?format=" parameter to override the Accepts header, rather than be 
used only as a fallback when the header is missing. This makes interactive 
testing of APIs easier.

Modified:
    incubator/wookie/trunk/src/org/apache/wookie/controller/Controller.java

Modified: 
incubator/wookie/trunk/src/org/apache/wookie/controller/Controller.java
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/controller/Controller.java?rev=1306288&r1=1306287&r2=1306288&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/controller/Controller.java 
(original)
+++ incubator/wookie/trunk/src/org/apache/wookie/controller/Controller.java Wed 
Mar 28 12:28:28 2012
@@ -340,14 +340,16 @@ public abstract class Controller extends
    */
   protected int format(HttpServletRequest request) {
     String type = request.getHeader("Accept");
-    if (type == null) {
-      // check for format parameters in the request
-      if (request.getParameter("format") != null) {
+
+    // check for format parameters in the request
+    if (request.getParameter("format") != null) {
         type = request.getParameter("format");
-      } else {
+    } 
+    
+    if (type == null){
         return HTML;
-      }
     }
+    
     if (type.contains("xml"))
       return XML;
     if (type.contains("json"))


Reply via email to