You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2014/10/23 23:48:38 UTC

[2/7] git commit: Fix JSP processing in the two-dot-o branch (USERGRID-209)

Fix JSP processing in the two-dot-o branch (USERGRID-209)


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/6e280520
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/6e280520
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/6e280520

Branch: refs/heads/two-dot-o-events
Commit: 6e2805207c3c8c50b119d8260f92cddce34c86ca
Parents: 3170b6a
Author: Dave Johnson <dm...@apigee.com>
Authored: Thu Oct 23 07:30:45 2014 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Thu Oct 23 07:30:45 2014 -0400

----------------------------------------------------------------------
 .../java/org/apache/usergrid/rest/TextToJsonSwapWriter.java  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/6e280520/stack/rest/src/main/java/org/apache/usergrid/rest/TextToJsonSwapWriter.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/TextToJsonSwapWriter.java b/stack/rest/src/main/java/org/apache/usergrid/rest/TextToJsonSwapWriter.java
index e877963..546a9f3 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/TextToJsonSwapWriter.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/TextToJsonSwapWriter.java
@@ -33,6 +33,7 @@ import javax.ws.rs.ext.MessageBodyWriter;
 import javax.ws.rs.ext.Provider;
 
 import com.sun.jersey.api.json.JSONWithPadding;
+import com.sun.jersey.api.view.Viewable;
 import com.sun.jersey.spi.MessageBodyWorkers;
 
 
@@ -58,8 +59,13 @@ public class TextToJsonSwapWriter implements MessageBodyWriter<JSONWithPadding>
     public boolean isWriteable( final Class<?> type, final Type genericType, final Annotation[] annotations,
                                 final MediaType mediaType ) {
 
-        //this should only map no media type, or text/html requests with json responses
 
+        // if type is Viewable them we want to return HTML, so no swap needed
+        if ( type.isAssignableFrom(Viewable.class) ) {
+            return false;
+        }
+
+        // this should only map no media type, or text/html requests with json responses
         final boolean mediaTypeCorrect = mediaType == null || MediaType.TEXT_HTML_TYPE.equals( mediaType );
 
         if(!mediaTypeCorrect){