javagwtfile-uploadmoxiemanager

Moxie gwt uploader custom server response


I'm using Moxie GWT Uploader, in my app and its working good.

Server can returns custom JSON object with error and its description.

How I can get, server response object when file upload ends with an error?

Because there is no possibility to get response in UploadErrorHandler.

uploader.setUploadErrorHandler(new UploadErrorHandler()
  {
     @Override
     public boolean onUploadError( UploadErrorEvent uploadErrorEvent )
     {
        ... 
        return true;
     }
  });

Or maybe some opinions.

Thanks.


Solution

  • I've used code from Uploader class and create own Uploader

    All than you need is change this method

     private boolean uploadSuccessEventCallback( File file, String responseReceived, String serverData ){ ... }
    

    changed part:

     else
      {
         response = uploadSuccessHandler == null || uploadSuccessHandler.onUploadSuccess(new UploadSuccessEvent(file, serverData, responseReceived));
      }
    
      return response;