Submitted by martin jinoch on
In case you've missed Christian's latest release of SmartNSF, here is the link . Important addition is the Custom strategy, that allows you to define your own class to process the requests coming via route defined in SmartNSF, such as
router.GET("info") { strategy(CUSTOM) { javaClass "org.openntf.rest.MyCustomStrategy" } }
and your class needs to implement CustomRestHandler
interface
package org.openntf.rest; class MyCustomStrategy implements CustomRestHandler { public void processCall(Context context, String path) { JsonJavaObject result = new JsonJavaObject; result.put("test", "hello there!"); JsonWriter jsw = new JsonWriter(context.getResponse().getWriter(), true); jsw.outObject(result); jsw.close(); } }
Happy RESTing|
Recent comments