RooWebJson and KendoUI Grid

198 views Asked by At

I made KENDOUI GRID work for READ with Spring ROO json as the backend.

However, for CREATE the generated response is HTTPSTATUS.CREATED.

KENDOUI GRID is expecting a HTTPSTATUS.OK with response body of "null".

I verified this by pushing-in the roo generated code and made the changes below. It worked.

JSON.aj Code

    HttpHeaders headers = new HttpHeaders();
    headers.add("Content-Type", "application/json");
    return new ResponseEntity<String>(headers, HttpStatus.CREATED);

PUSHED-IN Code

    HttpHeaders headers = new HttpHeaders();
    headers.add("Content-Type", "application/json");
    return new ResponseEntity<String>("null", headers, HttpStatus.OK);

Questions :

Is there a way to change the default response of roo's json aj files?

Or

Is there a way to handle other HTTPSTATUS in KENDOUI so a response of HttpStatus.CREATED would be treated as a success.

Lastly, KENODUI GRID seems not to be able to detect when the server encountered errors, since even Error 500 is not caught.

2

There are 2 answers

0
eruiz On BEST ANSWER

About Roo question the answer is no, you must push-in and customize as needed.

Please, open an improvement issue at https://jira.springsource.org/browse/ROO

0
Petur Subev On

The create response should contain that created record with its ID updated - if you do not return it then the Grid will continue to send the record to the server for creation.

Regarding the error 500 code - the error event of the dataSource should be triggered and it should contain the response itself so you can notify the user what did go wrong.