Hi, I'd definitely recommend using IResource for something like this.
Also check https://github.com/bitstorm/Wicket-rest-annotations. It will be merged to WicketStuff soon. On Thu, Aug 15, 2013 at 1:03 AM, Bas Gooren <b...@iswd.nl> wrote: > Hi, > > Yes, what you are doing is a perfectly ok way to handle this. > Optionally you could use a shared resource for this, but I say that's just > a matter of preference. > > We use something inspired by > https://code.google.com/p/**wicket-rest/<https://code.google.com/p/wicket-rest/> > This gives you some abstraction over the json (or xml/...) handling. > Furthermore you can override sensible methods like "doGet" or "doPost" > which clearly communicate intent. > > Met vriendelijke groet, > Kind regards, > > Bas Gooren > > Op 14-8-2013 20:32, schreef robianmcd: > > I found that this works but I'm not sure if there is a better way of doing >> this: >> >> @MountPath(value = "/api/my/rest/url") >> public class MyPostHandler extends SecureWebPage { >> >> public MyPostHandler () { >> final WebRequest webRequest = (WebRequest) getRequest(); >> final HttpServletRequest rawRequest = (HttpServletRequest) >> webRequest.**getContainerRequest(); >> >> if (rawRequest.getMethod().**equalsIgnoreCase("POST")) { >> >> BufferedReader br; >> try { >> br = rawRequest.getReader(); >> String jsonString = br.readLine(); >> //Do something with the JSON here >> } >> catch (IOException e) { >> >> } >> >> } >> } >> } >> >> >> >> -- >> View this message in context: http://apache-wicket.1842946.** >> n4.nabble.com/Use-Wicket-as-a-**REST-API-tp4660894p4660898.**html<http://apache-wicket.1842946.n4.nabble.com/Use-Wicket-as-a-REST-API-tp4660894p4660898.html> >> Sent from the Users forum mailing list archive at Nabble.com. >> >> ------------------------------**------------------------------**--------- >> To unsubscribe, e-mail: >> users-unsubscribe@wicket.**apache.org<users-unsubscr...@wicket.apache.org> >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> >