本文整理匯總了Java中org.apache.http.HttpStatus.SC_ACCEPTED屬性的典型用法代碼示例。如果您正苦於以下問題:Java HttpStatus.SC_ACCEPTED屬性的具體用法?Java HttpStatus.SC_ACCEPTED怎麽用?Java HttpStatus.SC_ACCEPTED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.apache.http.HttpStatus
的用法示例。
在下文中一共展示了HttpStatus.SC_ACCEPTED屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: trigger
public boolean trigger(final String pipelineName) {
try {
HttpPost request = new HttpPost("/go/api/pipelines/" + URLEncoder.encode(pipelineName, "UTF-8") + "/schedule");
request.addHeader("Confirm", "true");
HttpResponse response = goApiClient.execute(request);
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_ACCEPTED) {
return true;
} else {
Log.error("Request '" + request.getMethod() + " " + request.getURI() + "' got HTTP-" + response.getStatusLine().getStatusCode());
}
} catch (IOException e) {
Log.error("Could not perform request", e);
}
return false;
}