I have seen that wiquery for instance takes another approach in for instance
their AutoCompleteBehavior.

In that class they override respond() and get the response from the
requestcycle and start writing to it, like this:

@Override
    protected void respond(AjaxRequestTarget target) {
        // response: outputing the list of results as a js map
        List<AutocompleteValue<T, E>> results = autocomplete();
        Response response =
this.getComponent().getRequestCycle().getResponse();
        response.write("{");
        for (AutocompleteValue<T, E> autocompleteValue : results) {
            autocompleteValue.write(response);
        }
        response.write("}");
    }

If this is the correct approach it would be nice because it would allow me
to have complete control over generating the response. But, is this a valid
approach? Will it not interfere with the default response? Or is everything
ok as along as no components are added to the request target?

Can anyone comment on the validity of this approach? If this is not a
recommended approach then what is the correct approach to take for getting
complete control over the response content from an ajax behavior?

Cheers
  Erik

Reply via email to