Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top