Hello,
I have a pure RESTful server that's providing some API calls using GET, POST, PUT, and DELETE, in true REST fashion. Additionally, many of the calls set HTTP response codes to values that reflect the result of the request (using 2xx to indicate overall success, 4xx to indicate client-side error, 5xx to indicate server-side error)
I want to be able to use the RestDataSource from SmartGWT to do databinding to grids and forms. I was able to extend RestDataSource to allow me to use the GET, POST, PUT, DELETE methods. The question I have is regarding how SmartClient deals with the HTTP response codes.
For example, I have a client-side form that's databound to a REST data source. When the form is submitted (via POST) on the client-side, the server performs validation on the request, and if there's an error, returns a proper JSON response (that RestDataSource can understand), but ALSO sets the HTTP response code to a non-200 value. When this happens, no client-side error indication is given... it's like the response is dropped completely. If the HTTP response code is 200, then I do see a client-side WARNING icon being displayed, with the proper error message.
The question is: is it possible to instruct SmartClient to process the response even if the HTTP response code is not 200? If so, how?
Thank you,
Boris
I have a pure RESTful server that's providing some API calls using GET, POST, PUT, and DELETE, in true REST fashion. Additionally, many of the calls set HTTP response codes to values that reflect the result of the request (using 2xx to indicate overall success, 4xx to indicate client-side error, 5xx to indicate server-side error)
I want to be able to use the RestDataSource from SmartGWT to do databinding to grids and forms. I was able to extend RestDataSource to allow me to use the GET, POST, PUT, DELETE methods. The question I have is regarding how SmartClient deals with the HTTP response codes.
For example, I have a client-side form that's databound to a REST data source. When the form is submitted (via POST) on the client-side, the server performs validation on the request, and if there's an error, returns a proper JSON response (that RestDataSource can understand), but ALSO sets the HTTP response code to a non-200 value. When this happens, no client-side error indication is given... it's like the response is dropped completely. If the HTTP response code is 200, then I do see a client-side WARNING icon being displayed, with the proper error message.
The question is: is it possible to instruct SmartClient to process the response even if the HTTP response code is not 200? If so, how?
Thank you,
Boris
Comment