Package spark
Class ResponseTransformerRouteImpl
java.lang.Object
spark.RouteImpl
spark.ResponseTransformerRouteImpl
A ResponseTransformerRouteImpl is built up by a path (for url-matching) and the
implementation of the 'render' method. ResponseTransformerRoute instead of
returning the result of calling toString() as body, it returns the result of
calling render method.
The primary purpose of this kind of Route is provide a way to create generic
and reusable transformers. For example to convert an Object to JSON format.
-
Field Summary
Fields inherited from class spark.RouteImpl
DEFAULT_ACCEPT_TYPE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ResponseTransformerRouteImpl
(String path, String acceptType, Route route) -
Method Summary
Modifier and TypeMethodDescriptionstatic ResponseTransformerRouteImpl
create
(String path, String acceptType, Route route, ResponseTransformer transformer) static ResponseTransformerRouteImpl
create
(String path, Route route, ResponseTransformer transformer) abstract Object
Method called for rendering the output.Methods inherited from class spark.RouteImpl
create, create, delegate, getAcceptType, getPath, handle, withPrefix
-
Constructor Details
-
ResponseTransformerRouteImpl
-
-
Method Details
-
create
public static ResponseTransformerRouteImpl create(String path, Route route, ResponseTransformer transformer) -
create
public static ResponseTransformerRouteImpl create(String path, String acceptType, Route route, ResponseTransformer transformer) -
render
Method called for rendering the output.
-