Package org.rstudio.core.client.jsonrpc

Examples of org.rstudio.core.client.jsonrpc.RpcResponse


   }

   @Override
   protected PendingFileUpload parseResults(String results) throws Exception
   {
      RpcResponse response = RpcResponse.parse(results);
      if (response == null)
         throw new Exception("Unexpected response from server");
     
      // check for errors
      RpcError error = response.getError();
      if (error != null)
      {
         // special error message if we know the user failed to
         // select a directory
         if (error.getCode() == RpcError.PARAM_INVALID &&
             fileUpload_.getFilename().length() == 0)
         {
            throw new Exception("You must specify a file to upload.");
         }
         else
         {
            throw new Exception(error.getEndUserMessage())
         }
      }
     
      // return PendingFileUpload
      PendingFileUpload pendingFileUpload = response.getResult();
      return pendingFileUpload; 
   }
View Full Code Here


               performCallback(responseCallback, response);
         }
        
         public void onError(RpcError error)
         {
            RpcResponse errorResponse = RpcResponse.create(error);
            if (!srcWnd.isClosed())
               performCallback(responseCallback, errorResponse);
         }
View Full Code Here

               performCallback(responseCallback, response);
         }
        
         public void onError(RpcError error)
         {
            RpcResponse errorResponse = RpcResponse.create(error);
            if (!srcWnd.isClosed())
               performCallback(responseCallback, errorResponse);
         }
        
         private native void performCallback(JavaScriptObject responseCallback,
View Full Code Here

         public void onSubmitComplete(SubmitCompleteEvent event)
         {
            // parse the results
            String results = event.getResults();             
            RpcResponse response = RpcResponse.parse(event.getResults());
            if (response != null)
            {
               logEntry.logResponse(ResponseType.Normal, results);
               
               // check for error
               RpcError rpcError = response.getError();
               if (rpcError != null)
               {
                  if (rpcError.getCode() == RpcError.METHOD_NOT_FOUND)
                  {
                     requestCallback.onResponseReceived(
                                 new Integer(CREDENTIALS_UPDATE_UNSUPPORTED));
                  }
                  else
                  {
                     requestCallback.onError(new RemoteServerError(rpcError));
                  }
               }
               else // must be a valid response
               {
                  Bool authenticated = response.getResult();
                  if (authenticated.getValue())
                  {
                     requestCallback.onResponseReceived(
                                 new Integer(CREDENTIALS_UPDATE_SUCCESS));
                  }
View Full Code Here

   public void registerAsyncHandle(String asyncHandle,
                                   RpcRequest request,
                                   RpcRequestCallback callback)
   {
      RpcResponse response = asyncResponses_.remove(asyncHandle);
      if (response == null)
      {
         // We don't have the response for this request--this is
         // the normal case.
         asyncRequests_.put(asyncHandle,
View Full Code Here

TOP

Related Classes of org.rstudio.core.client.jsonrpc.RpcResponse

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.