public void parseResponse(String results) {

        cancelUpdateProgress();
        stopLoadingAnimation();

        if ((!m_canceled) && CmsStringUtil.isNotEmptyOrWhitespaceOnly(results)) {
            JSONObject jsonObject = JSONParser.parseStrict(results).isObject();
            boolean success = jsonObject.get(I_CmsUploadConstants.KEY_SUCCESS).isBoolean().booleanValue();
            // If the upload is done so fast that we did not receive any progress information, then
            // the content length is unknown. For that reason take the request size to show how
            // much bytes were uploaded.
            double size = jsonObject.get(I_CmsUploadConstants.KEY_REQUEST_SIZE).isNumber().doubleValue();
            long requestSize = new Double(size).longValue();
            if (m_contentLength == 0) {
                m_contentLength = requestSize;
            }
            if (success) {
                m_uploadedFiles = new ArrayList<String>();
                List<String> uploadedFileIds = new ArrayList<String>();
                displayDialogInfo(
                    org.opencms.gwt.client.Messages.get().key(
                        org.opencms.gwt.client.Messages.GUI_UPLOAD_INFO_FINISHING_0),
                    false);
                JSONValue uploadedFilesVal = jsonObject.get(I_CmsUploadConstants.KEY_UPLOADED_FILE_NAMES);
                JSONValue uploadHook = jsonObject.get(I_CmsUploadConstants.KEY_UPLOAD_HOOK);
                String hookUri = null;
                if ((uploadHook != null) && (uploadHook.isString() != null)) {
                    hookUri = uploadHook.isString().stringValue();
                    JSONValue uploadedFileIdsVal = jsonObject.get(I_CmsUploadConstants.KEY_UPLOADED_FILES);
                    JSONArray uploadedFileIdsArray = uploadedFileIdsVal.isArray();
                    if (uploadedFileIdsArray != null) {
                        for (int i = 0; i < uploadedFileIdsArray.size(); i++) {
                            JSONString entry = uploadedFileIdsArray.get(i).isString();
                            if (entry != null) {
                                uploadedFileIds.add(entry.stringValue());
                            }
                        }
                    }
                }
                JSONArray uploadedFilesArray = uploadedFilesVal.isArray();
                if (uploadedFilesArray != null) {
                    for (int i = 0; i < uploadedFilesArray.size(); i++) {
                        JSONString entry = uploadedFilesArray.get(i).isString();
                        if (entry != null) {
                            m_uploadedFiles.add(entry.stringValue());
                        }
                    }
                }
                m_progressInfo.finish();
                final I_CmsUploadContext context = m_context;
                closeOnSuccess();
                if (hookUri != null) {
                    // Set the context to be null so that it isn't called when the upload dialog closed;
                    // we want it to be called when the upload property dialog is closed instead.<p>
                    m_context = null;
                    CloseHandler<PopupPanel> closeHandler;
                    closeHandler = new CloseHandler<PopupPanel>() {

                        public void onClose(CloseEvent<PopupPanel> event) {

                            if (context != null) {
                                context.onUploadFinished(m_uploadedFiles);
                            }
                        }
                    };

                    String title = Messages.get().key(Messages.GUI_UPLOAD_HOOK_DIALOG_TITLE_0);
                    CmsUploadHookDialog.openDialog(title, hookUri, uploadedFileIds, closeHandler);
                }
            } else {
                String message = jsonObject.get(I_CmsUploadConstants.KEY_MESSAGE).isString().stringValue();
                String stacktrace = jsonObject.get(I_CmsUploadConstants.KEY_STACKTRACE).isString().stringValue();
                showErrorReport(message, stacktrace);
            }
        }
    }
public void parseResponse ( String results ) { cancelUpdateProgress ( ) ; stopLoadingAnimation ( ) ; if ( ( ! m_canceled ) && CmsStringUtil . isNotEmptyOrWhitespaceOnly ( results ) ) { JSONObject jsonObject = JSONParser . parseStrict ( results ) . isObject ( ) ; boolean success = jsonObject . get ( I_CmsUploadConstants . KEY_SUCCESS ) . isBoolean ( ) . booleanValue ( ) ; double size = jsonObject . get ( I_CmsUploadConstants . KEY_REQUEST_SIZE ) . isNumber ( ) . doubleValue ( ) ; long requestSize = new Double ( size ) . longValue ( ) ; if ( m_contentLength == 0 ) { m_contentLength = requestSize ; } if ( success ) { m_uploadedFiles = new ArrayList < String > ( ) ; List < String > uploadedFileIds = new ArrayList < String > ( ) ; displayDialogInfo ( org . opencms . gwt . client . Messages . get ( ) . key ( org . opencms . gwt . client . Messages . GUI_UPLOAD_INFO_FINISHING_0 ) , false ) ; JSONValue uploadedFilesVal = jsonObject . get ( I_CmsUploadConstants . KEY_UPLOADED_FILE_NAMES ) ; JSONValue uploadHook = jsonObject . get ( I_CmsUploadConstants . KEY_UPLOAD_HOOK ) ; String hookUri = null ; if ( ( uploadHook != null ) && ( uploadHook . isString ( ) != null ) ) { hookUri = uploadHook . isString ( ) . stringValue ( ) ; JSONValue uploadedFileIdsVal = jsonObject . get ( I_CmsUploadConstants . KEY_UPLOADED_FILES ) ; JSONArray uploadedFileIdsArray = uploadedFileIdsVal . isArray ( ) ; if ( uploadedFileIdsArray != null ) { for ( int i = 0 ; i < uploadedFileIdsArray . size ( ) ; i ++ ) { JSONString entry = uploadedFileIdsArray . get ( i ) . isString ( ) ; if ( entry != null ) { uploadedFileIds . add ( entry . stringValue ( ) ) ; } } } } JSONArray uploadedFilesArray = uploadedFilesVal . isArray ( ) ; if ( uploadedFilesArray != null ) { for ( int i = 0 ; i < uploadedFilesArray . size ( ) ; i ++ ) { JSONString entry = uploadedFilesArray . get ( i ) . isString ( ) ; if ( entry != null ) { m_uploadedFiles . add ( entry . stringValue ( ) ) ; } } } m_progressInfo . finish ( ) ; final I_CmsUploadContext context = m_context ; closeOnSuccess ( ) ; if ( hookUri != null ) { m_context = null ; CloseHandler < PopupPanel > closeHandler ; closeHandler = new CloseHandler < PopupPanel > ( ) { public void onClose ( CloseEvent < PopupPanel > event ) { if ( context != null ) { context . onUploadFinished ( m_uploadedFiles ) ; } } } ; String title = Messages . get ( ) . key ( Messages . GUI_UPLOAD_HOOK_DIALOG_TITLE_0 ) ; CmsUploadHookDialog . openDialog ( title , hookUri , uploadedFileIds , closeHandler ) ; } } else { String message = jsonObject . get ( I_CmsUploadConstants . KEY_MESSAGE ) . isString ( ) . stringValue ( ) ; String stacktrace = jsonObject . get ( I_CmsUploadConstants . KEY_STACKTRACE ) . isString ( ) . stringValue ( ) ; showErrorReport ( message , stacktrace ) ; } } }
Parses the upload response of the server and decides what to do.<p>

@param results a JSON Object