Hoist FormatType switching into BaseServlet We want to support rendering to different formats (particularly JSON) for all views, not just the host index view. At the moment we are still maintaining a 1:1 mapping between view types and servlets, so supporting JSON output for a particular already-existing view means putting JSON code and HTML code in the same servlet class. Return 400s for unsupported values for ?format= by default. Change-Id: I5e97b6ba72e310bc66cbfb4a540d94759cbd4273
diff --git a/gitiles-servlet/src/main/java/com/google/gitiles/RevisionServlet.java b/gitiles-servlet/src/main/java/com/google/gitiles/RevisionServlet.java index c2eacdf..e4258c0 100644 --- a/gitiles-servlet/src/main/java/com/google/gitiles/RevisionServlet.java +++ b/gitiles-servlet/src/main/java/com/google/gitiles/RevisionServlet.java
@@ -110,7 +110,7 @@ } } - render(req, res, "gitiles.revisionDetail", ImmutableMap.of( + renderHtml(req, res, "gitiles.revisionDetail", ImmutableMap.of( "title", view.getRevision().getName(), "objects", soyObjects, "hasBlob", hasBlob));