You cannot have both response body and error.
If you realize that an error should be returned then do:
requestCycle.scheduleRequestHandlerAfterCurrent(new
org.apache.wicket.request.http.handler.ErrorCodeRequestHandler.ErrorCodeRequestHandler(int,
String))

On Tue, Dec 13, 2011 at 12:03 PM, Serban Balamaci
<[email protected]> wrote:
> Hello,
> I'm using an AbstractResource to return JSON entities.
>
> Problem is that it seems you cannot also return an error code and also the
> JSON string with detailed message in case of error.
>        response.setWriteCallback(new WriteCallback()
>        {
>            @Override
>            public void writeData(final Attributes attributes) {
>
> ((WebResponse)attributes.getResponse()).write(errorResponse);
>                    ((WebResponse)attributes.getResponse()).sendError(503,
> "Logical Error");
> }
> }
>
> Because sendError begins with a checkHeader() method that throws a Header
> was already written to response! error
>
> Any ideas how I can get this working?
> Thanks.
>
> -----
> http://balamaci.wordpress.com
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/ResourceResponse-to-return-error-status-code-but-also-JSON-error-message-tp4189792p4189792.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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

Reply via email to