You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wookie.apache.org by sc...@apache.org on 2012/03/28 14:28:28 UTC

svn commit: r1306288 - /incubator/wookie/trunk/src/org/apache/wookie/controller/Controller.java

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"))