문제

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.

도움이 되었습니까?

해결책

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

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top