本文整理了Java中com.atlassian.sal.api.net.Response.getStatusText
方法的一些代码示例,展示了Response.getStatusText
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.getStatusText
方法的具体详情如下:
包路径:com.atlassian.sal.api.net.Response
类名称:Response
方法名:getStatusText
暂无
代码示例来源:origin: com.atlassian.plugins.rest/atlassian-rest-module
public String getStatusText() {
return delegateResponse.getStatusText();
}
代码示例来源:origin: com.atlassian.applinks/applinks-plugin
public void handle(final Response createLinkBackResponse) throws ResponseException {
if (createLinkBackResponse.getStatusCode() == 201) {
// cool! created reciprocal link, continue
} else {
throw new ResponseException(String.format("Received %s - %s",
createLinkBackResponse.getStatusCode(),
createLinkBackResponse.getStatusText()
));
}
}
});
代码示例来源:origin: com.atlassian.applinks/applinks-plugin
public Boolean handle(final Response response) throws ResponseException {
if (response.getStatusCode() == 200) {
// deleted reciprocal link, continue
return false;
} else {
throw new ResponseException(String.format("Received %s - %s",
response.getStatusCode(),
response.getStatusText()
));
}
}
代码示例来源:origin: com.atlassian.applinks/applinks-plugin
public void handle(final Response response) throws ResponseException {
if (response.getStatusCode() == 200) {
// deleted reciprocal link, continue
} else {
throw new ResponseException(String.format("Received %s - %s",
response.getStatusCode(),
response.getStatusText()
));
}
}
});
代码示例来源: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.marvelution.atlassian.suite.plugins/atlassian-sonarqube-common
/**
* Constructor
*
* @param response the Response to get the data from
*/
public RestResponse(Response response) {
statusCode = response.getStatusCode();
statusMessage = response.getStatusText();
headers = response.getHeaders();
successful = response.isSuccessful();
try {
responseBody = IOUtils.toString(response.getResponseBodyAsStream());
json = new JSONObject(responseBody);
} catch (JSONException e) {
json = null;
// Ignoring this, probably not needed for the request that was send
} catch (Throwable e) {
errors.add("Failed to retrieve the response from SonarQube: " + e.getMessage());
}
}
代码示例来源:origin: com.atlassian.jira.plugins/jira-fisheye-plugin
public Document handle(Response response) throws ResponseException
{
log(response);
alreadyTriedURLs.add(nextTryURL.get());
if (!response.isSuccessful())
{
throw new ResponseException(String.format("Received status code %d (%s)", response.getStatusCode(), response.getStatusText()));
}
// update the redirect info
if (REDIRECT_STATUS_CODES.contains(response.getStatusCode()))
{
String location = response.getHeader("location");
if (location == null)
{
throw new ResponseException(String.format("Received status code %d (%s) but no location was specified", response.getStatusCode(), response.getStatusText()));
}
nextTryURL.set(location);
return null;
}
return extractDocumentFrom(response);
}
代码示例来源:origin: com.atlassian.applinks/applinks-plugin
public void handle(final Response response) throws ResponseException {
if (response.getStatusCode() == 200) {
Iterables.addAll(entities, response.getEntity(ReferenceEntityList.class).getEntities(typeAccessor));
} else {
throw new ResponseException(String.format("Failed to retrieve entity list, received %s response: %s",
response.getStatusCode(), response.getStatusText()));
}
}
});
代码示例来源: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.jira.plugins/jira-fisheye-plugin
public Document handle(Response response) throws ResponseException
{
log(response);
alreadyTriedURLs.add(nextTryURL.get());
if (!response.isSuccessful())
{
throw new ResponseException(String.format("Received status code %d (%s)", response.getStatusCode(), response.getStatusText()));
}
// update the redirect info
if (REDIRECT_STATUS_CODES.contains(response.getStatusCode()))
{
String location = response.getHeader("location");
if (location == null)
{
throw new ResponseException(String.format("Received status code %d (%s) but no location was specified", response.getStatusCode(), response.getStatusText()));
}
nextTryURL.set(location);
return null;
}
return extractDocumentFrom(response);
}
代码示例来源:origin: com.atlassian.studio/applinks-confluence-plugin
public void handle(Response response) throws ResponseException
{
int statusCode = response.getStatusCode();
if (statusCode == HttpServletResponse.SC_UNAUTHORIZED ||
statusCode == HttpServletResponse.SC_FORBIDDEN)
addFieldError("password", getText("editinstances.errors.authentication"));
else if (statusCode != HttpServletResponse.SC_OK)
{
log.error("Unknown error. Status: " + response.getStatusText() +
" (" + statusCode + ")");
addFieldError("url", getText("editinstances.errors.connection"));
}
}
};
代码示例来源: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.applinks/applinks-jira-plugin
public void handle(final Response response) throws ResponseException
{
final int statusCode = response.getStatusCode();
if (statusCode == HttpServletResponse.SC_UNAUTHORIZED ||
statusCode == HttpServletResponse.SC_FORBIDDEN)
addError("magicFisheyePassword", getText("editinstances.errors.fisheye.password.incorrect"));
else if (statusCode == HttpServletResponse.SC_NOT_FOUND)
addError("magicFisheyePassword", getText("editinstances.errors.fisheye.not.recognised"));
else if (statusCode != HttpServletResponse.SC_OK)
{
log.info("Unknown error checking FishEye admin password. Status: " + response.getStatusText() +
" (" + statusCode + ")");
addError("url", getText("editinstances.errors.connection"));
}
}
};
代码示例来源:origin: com.atlassian.jira.plugins/jira-fisheye-plugin
problems.add(new IntegrationProblem(stashLink,
i18n().getText("stash.integration.problem.error.message",
String.valueOf(response.getStatusCode()), response.getStatusText())));
代码示例来源:origin: com.atlassian.stash/stash-java-client-applinks
public T handle(Response response) {
try {
HttpResponse coreResponse = new HttpResponse(response.getStatusCode(), response.getStatusText(),
response.getHeaders(), response.getResponseBodyAsStream());
return responseProcessor.process(coreResponse);
} catch (IOException | ResponseException e) {
throw new StashException(e);
}
}
}
代码示例来源:origin: com.atlassian.studio/studio-theme-jira-plugin
public void handle(Response response) throws ResponseException
{
if (!response.isSuccessful())
{
addErrorMessage(getText("crucible.admin.error.status.code", Integer.toString(
response.getStatusCode()), response.getStatusText()));
}
else
{
try
{
CrucibleProjectConfig config = (CrucibleProjectConfig) XStreamUtils.fromXML(
response.getResponseBodyAsString());
setProjectConfig(config);
}
catch (RuntimeException re)
{
addErrorMessage(getText("crucible.admin.error.deserialisation"));
log.error("Error deserialising crucible admin response", re);
}
}
}
});
代码示例来源: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;
}
代码示例来源:origin: com.atlassian.cpji/cpji-jira-plugin
public RestResponse handle(final Response response) throws ResponseException
{
ErrorCollection errors = null;
if (!response.isSuccessful())
{
// Check if the response contains an ErrorCollection
try
{
final String responseString = ResponseUtil.getResponseAsTrimmedString(response);
final JSONObject json = new JSONObject(new JSONTokener(responseString));
errors = convertJsonToErrorCollection(json);
}
catch (final JSONException e)
{
// Response did not contain an ErrorCollection
errors = null;
}
}
return new RestResponse(errors, response.getStatusCode(), response.getStatusText(), response.isSuccessful());
}
}
代码示例来源:origin: com.atlassian.bamboo.plugins/bamboo-stash-plugin
public JiraRestResponse handle(Response response)
JiraRestResponse.JiraRestResponseBuilder respBuilder = new JiraRestResponse.JiraRestResponseBuilder(response.getStatusCode(), response.getStatusText());
if (!response.isSuccessful())
内容来源于网络,如有侵权,请联系作者删除!