This method verifies if the underlying server response can be cast to: {@link com.lindar.wellrested.vo.Result}
19010
public boolean isResult() {
        if (StringUtils.isNotBlank(serverResponse)) {
            try {
                return fromJson.castTo(Result.class) != null;
            } catch (Exception e) {
                log.warn("isResult: exception occurred - {}", e);
            }
        }
        return false;
    }
183806
public boolean checkResponseForException() {
    if (!finished && rsp != null) {
      Exception e;
      if ((e = rsp.getException()) != null) {
        setError(e.getMessage());
        setFinished();
        return true;
      }
    }
    return false;
  }
200811
@Override
	public void error(AuthzTrans trans, HttpServletResponse response, Result<?> result) {
		String msg = result.details==null?"%s":"%s - " + result.details.trim();
		String msgId;
		String[] detail;
		if(result.variables==null) {
			detail = new String[1];
		} else {
			int l = result.variables.length;
			detail=new String[l+1];
			System.arraycopy(result.variables, 0, detail, 1, l);
		}
		//int httpstatus;
		
		switch(result.status) {
			case ERR_ActionNotCompleted:
				msgId = "SVC1202";
				detail[0] = "Accepted, Action not complete";
				response.setStatus(/*httpstatus=*/202);
				break;

			case ERR_Policy:
				msgId = "SVC3403";
				detail[0] = FORBIDDEN;
				response.setStatus(/*httpstatus=*/403);
				break;
			case ERR_Security:
				msgId = "SVC2403";
				detail[0] = FORBIDDEN;
				response.setStatus(/*httpstatus=*/403);
				break;
			case ERR_Denied:
				msgId = "SVC1403";
				detail[0] = FORBIDDEN;
				response.setStatus(/*httpstatus=*/403);
				break;
			// This is still forbidden to directly impact, but can be Requested when passed
			// with "request=true" query Param
			case ERR_FutureNotRequested:
				msgId = "SVC2403";
				detail[0] = msg;
				response.setStatus(/*httpstatus=*/403);
				break;
				
			case ERR_NsNotFound:
				msgId = "SVC2404";
				detail[0] = NOT_FOUND;
				response.setStatus(/*httpstatus=*/404);
				break;
			case ERR_RoleNotFound:
				msgId = "SVC3404";
				detail[0] = NOT_FOUND;
				response.setStatus(/*httpstatus=*/404);
				break;
			case ERR_PermissionNotFound:
				msgId = "SVC4404";
				detail[0] = NOT_FOUND;
				response.setStatus(/*httpstatus=*/404);
				break;
			case ERR_UserNotFound:
				msgId = "SVC5404";
				detail[0] = NOT_FOUND;
				response.setStatus(/*httpstatus=*/404);
				break;
			case ERR_UserRoleNotFound:
				msgId = "SVC6404";
				detail[0] = NOT_FOUND;
				response.setStatus(/*httpstatus=*/404);
				break;
			case ERR_DelegateNotFound:
				msgId = "SVC7404";
				detail[0] = NOT_FOUND;
				response.setStatus(/*httpstatus=*/404);
				break;
			case ERR_NotFound:
				msgId = "SVC1404";
				detail[0] = NOT_FOUND;
				response.setStatus(/*httpstatus=*/404);
				break;

			case ERR_InvalidDelegate:
				msgId="SVC2406";
				detail[0] = NOT_ACCEPTABLE;
				response.setStatus(/*httpstatus=*/406);
				break;
			case ERR_BadData:
				msgId="SVC1406";
				detail[0] = NOT_ACCEPTABLE;
				response.setStatus(/*httpstatus=*/406);
				break;
				
			case ERR_ConflictAlreadyExists:
				msgId = "SVC1409";
				detail[0] = "Conflict Already Exists";
				response.setStatus(/*httpstatus=*/409);
				break;
			
			case ERR_DependencyExists:
				msgId = "SVC1424";
				detail[0] = "Failed Dependency";
				response.setStatus(/*httpstatus=*/424);
				break;
			
			case ERR_NotImplemented:
				msgId = "SVC1501";
				detail[0] = "Not Implemented"; 
				response.setStatus(/*httpstatus=*/501);
				break;
				
			case Status.ACC_Future:
				msgId = "SVC1202";
				detail[0] = "Accepted for Future, pending Approvals";
				response.setStatus(/*httpstatus=*/202);
				break;
			case ERR_ChoiceNeeded:
				msgId = "SVC1300";
				detail = result.variables;
				response.setStatus(/*httpstatus=*/300);
				break;
			case ERR_Backend: 
				msgId = "SVC2500";
				detail[0] = GENERAL_SERVICE_ERROR;
				response.setStatus(/*httpstatus=*/500);
				break;

			default: 
				msgId = "SVC1500";
				detail[0] = GENERAL_SERVICE_ERROR;
				response.setStatus(/*httpstatus=*/500);
				break;
		}

		try {
			StringBuilder holder = new StringBuilder();
			errDF.newData(trans).load(
				service.mapper()
					.errorFromMessage(holder,msgId,msg,detail))
						.to(response.getOutputStream());
			trans.checkpoint(
					holder.toString(),
//					String.format("ErrResp [" +	msgId +	"] " + msg,(Object[])detail),
					Env.ALWAYS);
		} catch (Exception e) {
			trans.error().log(e,"unable to send response for",msg);
		}
	}
1082208
@Override
    public AuthenticationStatus notifyContainerAboutLogin(CredentialValidationResult result) {
        if (CredentialValidationResult.Status.VALID.equals(result.getStatus())) {
            this.result = result;
            return notifyContainerAboutLogin(result.getCallerPrincipal(), result.getCallerGroups());
        }
        return AuthenticationStatus.SEND_FAILURE;
    }
928480
public final void requestProcessed (Object result)
    {
        @SuppressWarnings("unchecked") T casted = (T)result;
        requestCompleted(casted);
    }
1074184
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);
            }
        }
    }
1113310
@SuppressWarnings("unchecked")
  T result(final Object r) {
    return (T) (r == NULL ? null : r);
  }
229744
public boolean isFailure(R result, Throwable failure) {
    for (BiPredicate<R, Throwable> predicate : failureConditions) {
      try {
        if (predicate.test(result, failure))
          return true;
      } catch (Exception ignored) {
        // Ignore confused user-supplied predicates.
        // They should not be allowed to halt execution of the operation.
      }
    }

    // Fail by default if a failure is not checked by a condition
    return failure != null && !failuresChecked;
  }
45487
boolean success(T result) {
        State<T> oldState;
        synchronized (mutex) {
            if (state.isCompleted()) {
                return false;
            }
            oldState = state;
            state = state.getSuccessState(result);
        }
        oldState.callSuccessCallbacks(result);
        return true;

    }
217811
boolean isFailure(ExecutionResult result) {
    return failureConditions.isEmpty() ?
        result.getFailure() != null :
        isFailure((R) result.getResult(), result.getFailure());
  }
64804
function onSingleEntityReceived( serverResponse ) {
			if( !serverResponse.data[ configuration.entityName ] ) {
				throw new Error( "The response from the server was not in the expected format. It should have a member named '" + configuration.entityName + "'." );
			}

			self.__entityCacheRaw = serverResponse.data;
			self.__onDataAvailable( serverResponse.data );
		}
924024
protected Object parseEvalReply(EvalResult result) {
    String status = result.getStatus();

    if (!status.equals("completed")) {
      if (status.equals("unhandled-exception")) {
        // Would be great give the JS error here, but it appears that by the
        // time we callFunctionOnObject the error object has gone...
        throw new ScopeException("Ecmascript exception");
      } else if (status.equals("cancelled-by-scheduler")) {
        // TODO: what is the best approach here?
        return null;
      }
    }

    String dataType = result.getType();
    if (dataType.equals("object")) {
      return result.getObjectValue();
    } else {
      return parseValue(dataType, result.getValue());
    }
  }
660204
protected final void validateSuccess(final Status status) {
        String statusValue = status.getStatusCode().getValue();
        if (!StatusCode.SUCCESS.equals(statusValue)) {
            final StatusMessage statusMessage = status.getStatusMessage();
            if (statusMessage != null) {
                statusValue += " / " + statusMessage.getMessage();
            }
            throw new SAMLException("Response is not success ; actual " + statusValue);
        }
    }
989010
protected int validateProxyResponse(WsByteBuffer[] buffers) {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "validateProxyResponse");
        }

        int status = STATUS_NOT_DONE;
        // Drain the proxy response
        for (int i = 0; i < buffers.length; i++) {

            buffers[i].flip();
            byte[] data = new byte[buffers[i].limit()];
            buffers[i].get(data);
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "buffer: [" + new String(data) + "]");
            }

            // exit if the first buffer does not contain the "HTTP   200"
            // We assume that the first buffer contains the first line of the
            // HTTPResponse
            if (!this.isProxyResponseValid) {
                this.isProxyResponseValid = containsHTTP200(data);
                if (!this.isProxyResponseValid) {
                    // top level methods will call connectFailed
                    status = STATUS_ERROR;
                    break;
                }
            }

            // exit if the end of the response was found
            if (containsEOLDelimiters(data)) {
                status = STATUS_DONE;
                break;
            }

            // we are going to need to do another read, clear this buffer
            buffers[i].clear();
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "validateProxyResponse, rc=" + status);
        }
        return status;
    }
945893
private OperationResult getOperationResult() {
        if (operationResult == null) {
            this.operationResult = (OperationResult) marshaller.unmarshal(new StringSource(getPayload(String.class)));
        }

        return operationResult;
    }
455558
public static boolean checkResponseStatus(JSONObject jsonResponse) {

        if (jsonResponse != null) {

            if (jsonResponse.getBoolean("ok")) {

                return true;
            } else {

                System.err.println("The API returned the following error: " + jsonResponse.getString("description"));
            }
        } else {

            System.err.println("JSON Response was null, something went wrong...");
        }

        return false;
    }
94468
@Override
  public void ok(Object result)
  {
    Object resultCvt = _marshal.convert(result);
    
    delegate().ok(resultCvt);
  }