Hello,
I was looking to some code and googling around but cannot find a
suitable solution for my problem.
I have an AbstractDefaultAjaxBehavior that I'm implemented the function
respond(AjaxRequestTarget target) like this
---
@Override
protected void respond(AjaxRequestTarget target) {
JsonChoiceRenderer<T> jsonRenderer = new
JsonChoiceRenderer<T>(getChoices());
target.appendJavaScript(jsonRenderer.renderJsonArray(getComponent(),
getRenderer()));
}
---
But this is not a JSON response when it is called from javascript. I
want to respond with an application/json response.
I saw something like:
RequestCycle requestCycle = RequestCycle.get();
requestCycle.getResponse().setCharacterEncoding("UTF-8");
requestCycle.getResponse().setContentType("application/json;");
But it means that I have to override the final void onRequest() of the
AbstractAjaxBehavior class, but this is final so I cannot.
What's the best way to do it with newer versions of wicket?
Thank you a lot in advance.