Skip to content

Commit

Permalink
Tweaks to #998
Browse files Browse the repository at this point in the history
  • Loading branch information
perwendel committed Jun 11, 2018
1 parent b33e5dd commit 3a9dfc6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/spark/Spark.java
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ public static void ipAddress(String ipAddress) {
*
* @param transformer
*/
public static void setDefaultResponseTransformer(ResponseTransformer transformer) {
public static void defaultResponseTransformer(ResponseTransformer transformer) {
getInstance().defaultResponseTransformer(transformer);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package spark.examples.transformer;

import spark.ResponseTransformer;

import static spark.Spark.get;
import static spark.Spark.setDefaultResponseTransformer;
import static spark.Spark.defaultResponseTransformer;

public class DefaultTransformerExample {

public static void main(String args[]) {

setDefaultResponseTransformer(new JsonTransformer());
defaultResponseTransformer(json);

get("/hello", "application/json", (request, response) -> {
return new MyMessage("Hello World");
Expand All @@ -18,4 +20,6 @@ public static void main(String args[]) {
}, model -> "custom transformer");
}

private static final ResponseTransformer json = new JsonTransformer();

}

0 comments on commit 3a9dfc6

Please sign in to comment.