Package org.jboss.errai.bus.client.api

Examples of org.jboss.errai.bus.client.api.RemoteCallback


  @SuppressWarnings({ "rawtypes", "unchecked" })
  protected void sendRequest(final RequestBuilder requestBuilder, final String body,
      final ResponseDemarshallingCallback demarshallingCallback) {

    final RemoteCallback remoteCallback = getRemoteCallback();
    try {
      requestBuilder.sendRequest(body, new RequestCallback() {
        @Override
        public void onError(Request request, Throwable throwable) {
          handleError(throwable, null);
        }

        @Override
        public void onResponseReceived(Request request, Response response) {
          int statusCode = response.getStatusCode();
          if ((successCodes == null || successCodes.contains(statusCode)) && (statusCode >= 200 && statusCode < 300)) {
           
            if (remoteCallback instanceof ResponseCallback) {
              ((ResponseCallback) getRemoteCallback()).callback(response);
            }
            else if (response.getStatusCode() == 204) {
              remoteCallback.callback(null);
            }
            else {
              remoteCallback.callback(demarshallingCallback.demarshallResponse(response.getText()));
            }
          }
          else {
            ResponseException throwable = new ResponseException(response.getStatusText(), response);
            handleError(throwable, response);
View Full Code Here

TOP

Related Classes of org.jboss.errai.bus.client.api.RemoteCallback

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.