com.atlassian.sal.api.net.Response.isSuccessful()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中com.atlassian.sal.api.net.Response.isSuccessful方法的一些代码示例,展示了Response.isSuccessful的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.isSuccessful方法的具体详情如下:
包路径:com.atlassian.sal.api.net.Response
类名称:Response
方法名:isSuccessful

Response.isSuccessful介绍

暂无

代码示例

代码示例来源:origin: com.atlassian.applinks/applinks-plugin-core

public ApplicationStatus handle(final Response response) throws ResponseException
  {
    return response.isSuccessful() ?
        ApplicationStatus.AVAILABLE :
        ApplicationStatus.UNAVAILABLE;
  }
});

代码示例来源:origin: com.atlassian.applinks/applinks-plugin

public Boolean handle(final Response restResponse) throws ResponseException {
    return restResponse.isSuccessful();
  }
});

代码示例来源:origin: com.atlassian.plugins.rest/atlassian-rest-module

public boolean isSuccessful() {
  return delegateResponse.isSuccessful();
}

代码示例来源:origin: com.atlassian.refapp/platform-ctk-plugin

public void handle(final Response response) throws ResponseException {
    assertTrue(response.isSuccessful());
  }
});

代码示例来源:origin: com.atlassian.refapp/platform-ctk-plugin

public void handle(final Response response) throws ResponseException {
    assertTrue(response.isSuccessful());
  }
});

代码示例来源:origin: com.atlassian.applinks/applinks-plugin

public ErrorListEntity handle(final Response response) throws ResponseException {
    // 201 means we created a new application link.
    // 200 means there already is an application link and we just updated this one.
    return !response.isSuccessful() ?
        response.getEntity(ErrorListEntity.class) :
        null;
  }
});

代码示例来源:origin: com.atlassian.applinks/applinks-plugin

public void handle(final Response restResponse) throws ResponseException {
    if (restResponse.isSuccessful()) {
      rpcUrlValid.set(true);
    }
  }
});

代码示例来源:origin: com.marvelution.atlassian.suite.plugins/atlassian-sonarqube-common

@Override
public ApplicationStatus handle(final Response response) throws ResponseException {
  return response.isSuccessful() || (response.getStatusCode() == HttpStatus.SC_FORBIDDEN) ?
      ApplicationStatus.AVAILABLE : ApplicationStatus.UNAVAILABLE;
}

代码示例来源:origin: com.atlassian.applinks/applinks-jira-plugin

public void handle(final Response response) throws ResponseException
  {
    if (!response.isSuccessful())
    {
      log.error("Error calling " + request + ". Response: " + response.getResponseBodyAsString());
      returnValue.set(false);
    }
    else
    {
      returnValue.set(true);
    }
  }
};

代码示例来源:origin: com.marvelution.jira.plugins/jira-jenkins-plugin

@Override
public ApplicationStatus handle(final Response response) throws ResponseException {
  return response.isSuccessful() || (response.getStatusCode() == HttpStatus.SC_FORBIDDEN) || (response.getStatusCode()
      == HttpStatus.SC_UNAUTHORIZED) ? ApplicationStatus.AVAILABLE : ApplicationStatus.UNAVAILABLE;
}

代码示例来源:origin: com.marvelution.jira.plugins/jira-jenkins-plugin

public RestResponse(Response response) {
  statusCode = response.getStatusCode();
  statusMessage = response.getStatusText();
  successful = response.isSuccessful();
  try {
    responseBody = IOUtils.toString(response.getResponseBodyAsStream(), "UTF-8");
    json = new JSONObject(responseBody);
  } catch (JSONException e) {
    json = null;
    errors.add("Failed to parse server response as JSON: " + e.getMessage());
  } catch (Throwable e) {
    errors.add("Failed to retrieve the response from Jenkins: " + e.getMessage());
  }
}

代码示例来源:origin: com.atlassian.applinks/applinks-plugin-core

public String handle(final Response response) throws ResponseException
  {
    if (!response.isSuccessful())
    {
      throw new ResponseStatusException("Unexpected response received. Status code: " + response.getStatusCode(), response);
    }

    return response.getResponseBodyAsString();
  }
}

代码示例来源:origin: com.atlassian.applinks/applinks-trustedapps-plugin

public void handle(final Response response) throws ResponseException {
    if (response.isSuccessful()) {
      success.set(true);
    } else {
      errorMessage.set(String.format("Response code: %d: %s",
          response.getStatusCode(), response.getResponseBodyAsString()));
    }
  }
});

代码示例来源:origin: com.atlassian.jwt/jwt-plugin

@Override
  public void handle(Response response) throws ResponseException
  {
    if (!response.isSuccessful())
    {
      throw new ResponseException("Registration failed, received " +
          response.getStatusCode() + " " + response.getStatusText() +
          " from peer.");
    }
  }
});

代码示例来源:origin: com.atlassian.applinks/applinks-common

public String handle(final Response response) throws ResponseException {
    if (!response.isSuccessful()) {
      throw new ResponseStatusException("Unexpected response received. Status code: " + response.getStatusCode(), response);
    }

    return response.getResponseBodyAsString();
  }
}

代码示例来源:origin: com.atlassian.cpji/cpji-jira-plugin

@Override
  protected IssueCreationResultBean parseResponse(Response response) throws ResponseException, JSONException {
    if (response.isSuccessful()) {
      return response.getEntity(IssueCreationResultBean.class);
    } else {
      ErrorBean errorBean = response.getEntity(ErrorBean.class);
      return provideResponseStatus(NegativeResponseStatus.errorOccured(jiraLocation, errorBean));
    }
  }
});

代码示例来源:origin: com.atlassian.cpji/cpji-jira-plugin

@Override
protected SuccessfulResponse parseResponse(Response response) throws ResponseException, JSONException {
  if (response.isSuccessful()) {
    return SuccessfulResponse.build(jiraLocation);
  } else {
    return provideResponseStatus(NegativeResponseStatus.errorOccured(jiraLocation, ResponseUtil.getResponseAsTrimmedString(response)));
  }
}

代码示例来源:origin: com.atlassian.refapp/atlassian-refapp-applinks-plugin

public Void handle(final Response response) throws ResponseException {
  if (response.isSuccessful()) {
    final String body = response.getResponseBodyAsString();
    if (body == null || "".equals(body)) {
      status.set(AuthenticationStatus.ANONYMOUS);
    } else {
      username.set(body);
      status.set(AuthenticationStatus.ACCEPTED);
    }
  } else {
    status.set(AuthenticationStatus.COMMUNICATION_ERROR);
    errorMessage.set(String.format("%s: %s", response.getStatusCode(), response.getStatusText()));
  }
  return null;
}

代码示例来源:origin: com.atlassian.jira/jira-issue-link-confluence-plugin

private static <T, B extends Builder<T>> RemoteResponse<List<T>> handleResponse(final Response response, final AbstractConfluenceSaxHandler<T, B> handler) throws ResponseException
{
  final String responseString = getResponseBodyAsString(response);
  List<T> entities = null;
  ErrorCollection errors = null;
  if (response.isSuccessful() && !StringUtils.isBlank(responseString))
  {
    entities = parseXml(responseString, handler);
    if (handler.hasFault())
    {
      errors = new SimpleErrorCollection();
      errors.addErrorMessage(handler.getFaultString());
    }
  }
  return new RemoteResponse<List<T>>(entities, errors, response);
}

代码示例来源:origin: com.atlassian.confluence.plugins/confluence-jira3-plugin

public Object handle(Response resp) throws ResponseException
{
  try
  {
    if("ERROR".equals(resp.getHeader("X-Seraph-Trusted-App-Status")))
    {
      String taError = resp.getHeader("X-Seraph-Trusted-App-Error");
      throw new TrustedAppsException(taError);
    }
    checkForErrors(resp.isSuccessful(), resp.getStatusCode(), resp.getStatusText());
    responseHandler.handleJiraResponse(resp.getResponseBodyAsStream(), null);
  }
  catch (IOException e)
  {
    throw new ResponseException(e);
  }
  return null;
}

相关文章