A TemplateViewRoute is built up by a path (for url-matching) and the implementation of the 'render' method. TemplateViewRoute 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 c
| 25 | * @author alex |
| 26 | */ |
| 27 | public abstract class TemplateViewRouteImpl extends RouteImpl { |
| 28 | |
| 29 | /** |
| 30 | * factory method |
| 31 | * |
| 32 | * @param path the path |
| 33 | * @param route the route |
| 34 | * @param engine the engine |
| 35 | * @return the wrapper template view route |
| 36 | */ |
| 37 | public static TemplateViewRouteImpl create(String path, |
| 38 | TemplateViewRoute route, |
| 39 | TemplateEngine engine) { |
| 40 | |
| 41 | return create(path, Service.DEFAULT_ACCEPT_TYPE, route, engine); |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * factory method |
| 46 | * |
| 47 | * @param path the path |
| 48 | * @param acceptType the accept type |
| 49 | * @param route the route |
| 50 | * @param engine the engine |
| 51 | * @return the wrapper template view route |
| 52 | */ |
| 53 | public static TemplateViewRouteImpl create(String path, |
| 54 | String acceptType, |
| 55 | TemplateViewRoute route, |
| 56 | TemplateEngine engine) { |
| 57 | |
| 58 | return new TemplateViewRouteImpl(path, acceptType, route) { |
| 59 | @Override |
| 60 | public String render(ModelAndView modelAndView) { |
| 61 | return engine.render(modelAndView); |
| 62 | } |
| 63 | |
| 64 | @Override |
| 65 | public Object handle(Request request, Response response) throws Exception { |
| 66 | return route.handle(request, response); |
| 67 | } |
| 68 | }; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * Constructor |
| 73 | * |
| 74 | * @param path the path |
| 75 | * @param acceptType the accept type |
| 76 | * @param route |
| 77 | */ |
| 78 | protected TemplateViewRouteImpl(String path, String acceptType, TemplateViewRoute route) { |
| 79 | super(path, acceptType, route); |
| 80 | } |
| 81 | |
| 82 | |
| 83 | @Override |
| 84 | public Object render(Object object) { |
nothing calls this directly
no outgoing calls
no test coverage detected