| 25 | import spark.Route; |
| 26 | |
| 27 | public abstract class JsRoute extends Route { |
| 28 | |
| 29 | protected JsRoute(String path) { |
| 30 | super(path); |
| 31 | } |
| 32 | |
| 33 | public JsRoute(String path, String acceptType) { |
| 34 | super(path, acceptType); |
| 35 | } |
| 36 | |
| 37 | @Override |
| 38 | public final Object handle(Request req, Response resp) { |
| 39 | StringBuilder sb = new StringBuilder(); |
| 40 | String cb = req.queryParams("cb"); |
| 41 | if (cb != null) { |
| 42 | sb.append(cb + "("); |
| 43 | } |
| 44 | sb.append(_handle(req, resp)); |
| 45 | if (cb != null) { |
| 46 | sb.append(")"); |
| 47 | } |
| 48 | resp.type("text/javascript"); |
| 49 | return sb.toString(); |
| 50 | } |
| 51 | |
| 52 | protected abstract Object _handle(Request req, Response resp); |
| 53 | |
| 54 | } |
nothing calls this directly
no outgoing calls
no test coverage detected