Hi,

I needed to implement a dynamic JSON API for programmatic consumption
by another application. I ended up implementing AbstractResource to
accomplish this task (using Wicket 6.2.0.).

First question, does this violate the intent of resources? If so, is
there a good way to do this within Wicket? Or, would you strongly
suggest I use a more traditional API framework (e.g., Jersey)?

If resources should be able to perform this task, I ran into some
weird behavior. When I explicitly setStatusCode on ResourceResponse to
200, the HTTP body of the response came back empty. I'm pretty sure
this is due to the following check in AbstractResource#respond:

if (!data.dataNeedsToBeWritten(attributes) || data.getErrorCode() !=
null || data.getStatusCode() != null) { return; }

My use case is trivial (200 on success, 500 on error). So, it was easy
enough to remove the explicit declaration of a 200 and let it default
to OK. However there are many other status codes that are not errors
that might warrant a HTTP body. This seems like a bug to me. Is this
by design?

Thanks in advance!
Ben

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to