本文整理了Java中org.restlet.data.Status.getReasonPhrase()
方法的一些代码示例,展示了Status.getReasonPhrase()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Status.getReasonPhrase()
方法的具体详情如下:
包路径:org.restlet.data.Status
类名称:Status
方法名:getReasonPhrase
[英]Returns the reason phrase of this status. When supported by the HTTP server connector, this is returned in the first line of the HTTP response, next to to the status code.
[中]返回此状态的原因短语。当HTTP服务器连接器支持时,会在HTTP响应的第一行中返回状态代码旁边的内容。
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Constructor.
*
* @param status
* The status to associate.
* @param cause
* The wrapped cause error or exception.
*/
public ResourceException(Status status, Throwable cause) {
super((status == null) ? null : status.getReasonPhrase(), cause);
this.status = status;
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the reason phrase of the status followed by its HTTP code.
*
* @return The reason phrase of the status followed by its HTTP code.
*/
@Override
public String toString() {
return getReasonPhrase() + " (" + this.code + ")"
+ ((getDescription() == null) ? "" : " - " + getDescription());
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Returns the reason phrase of the status followed by its HTTP code.
*
* @return The reason phrase of the status followed by its HTTP code.
*/
@Override
public String toString() {
return getReasonPhrase() + " (" + this.code + ")"
+ ((getDescription() == null) ? "" : " - " + getDescription());
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Constructor.
*
* @param status
* The represented status.
* @param contactEmail
* The email address of the administrator to contact in case of
* error.
* @param homeRef
* The home URI to propose in case of error.
*/
public StatusInfo(Status status, String contactEmail, String homeRef) {
this(status.getCode(), status.getDescription(), status
.getReasonPhrase(), status.getUri(), contactEmail, homeRef);
}
代码示例来源:origin: org.restlet.jse/org.restlet.example
@Override
public Representation getRepresentation(Status status, Request request,
Response response) {
// Create the data model
Map<String, String> dataModel = new ConcurrentHashMap<String, String>();
dataModel.put("applicationName", Application.getCurrent().getName());
dataModel.put("statusDescription", response.getStatus()
.getDescription());
dataModel.put("statusReasonPhrase", response.getStatus()
.getReasonPhrase());
// Load the FreeMarker template
Representation mailFtl = new ClientResource(
LocalReference.createClapReference(getClass().getPackage())
+ "/MailStatus.ftl").get();
// Wraps the bean with a FreeMarker representation
return new TemplateRepresentation(mailFtl, dataModel,
MediaType.TEXT_HTML);
}
代码示例来源:origin: org.restlet.jse/org.restlet.example
@Override
public Representation getRepresentation(Status status, Request request,
Response response) {
// Create the data model
Map<String, String> dataModel = new TreeMap<String, String>();
dataModel.put("applicationName", Application.getCurrent().getName());
dataModel.put("statusReasonPhrase", response.getStatus()
.getReasonPhrase());
dataModel.put("statusDescription", response.getStatus()
.getDescription());
// Load the FreeMarker template
Representation mailFtl = new ClientResource(
LocalReference.createClapReference(getClass().getPackage())
+ "/MailStatus.ftl").get();
// Wraps the bean with a FreeMarker representation
return new TemplateRepresentation(mailFtl, dataModel,
MediaType.TEXT_HTML);
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Constructor.
*
* @param status
* The status to copy.
* @param throwable
* The related error or exception.
* @param description
* The description to associate.
*/
public Status(Status status, Throwable throwable, String description) {
this(status.getCode(), (throwable == null) ? status.getThrowable()
: throwable, status.getReasonPhrase(),
(description == null) ? status.getDescription() : description,
status.getUri());
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Constructor.
*
* @param status
* The status to copy.
* @param throwable
* The related error or exception.
* @param reasonPhrase
* The short reason phrase displayed next to the status code in a
* HTTP response.
* @param description
* The description to associate.
*/
public Status(Status status, Throwable throwable, String reasonPhrase,
String description) {
this(status.getCode(), (throwable == null) ? status.getThrowable()
: throwable, (reasonPhrase == null) ? status.getReasonPhrase()
: reasonPhrase, (description == null) ? status.getDescription()
: description, status.getUri());
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.platform
response.setName(Status.valueOf(code).getReasonPhrase());
if (!StringUtils.isNullOrEmpty(apiResponse.message())) {
response.setDescription(apiResponse.message());
代码示例来源:origin: org.restlet.jee/org.restlet.ext.platform
response.setName(Status.SUCCESS_OK.getReasonPhrase());
response.setDescription("");
response.setMessage(Status.SUCCESS_OK.getDescription());
} else {
response.setCode(Status.SUCCESS_NO_CONTENT.getCode());
response.setName(Status.SUCCESS_NO_CONTENT.getReasonPhrase());
response.setDescription("");
response.setMessage(Status.SUCCESS_NO_CONTENT.getDescription());
代码示例来源:origin: org.restlet.jee/org.restlet.ext.apispark
response.setName(Status.SUCCESS_OK.getReasonPhrase());
response.setDescription("");
response.setMessage(Status.SUCCESS_OK.getDescription());
} else {
response.setCode(Status.SUCCESS_NO_CONTENT.getCode());
response.setName(Status.SUCCESS_NO_CONTENT.getReasonPhrase());
response.setDescription("");
response.setMessage(Status.SUCCESS_NO_CONTENT.getDescription());
代码示例来源:origin: org.restlet.osgi/org.restlet.ext.platform
response.setName(Status.SUCCESS_OK.getReasonPhrase());
response.setDescription("");
response.setMessage(Status.SUCCESS_OK.getDescription());
} else {
response.setCode(Status.SUCCESS_NO_CONTENT.getCode());
response.setName(Status.SUCCESS_NO_CONTENT.getReasonPhrase());
response.setDescription("");
response.setMessage(Status.SUCCESS_NO_CONTENT.getDescription());
代码示例来源:origin: org.restlet.jse/org.restlet.ext.platform
response.setName(Status.SUCCESS_OK.getReasonPhrase());
response.setDescription("");
response.setMessage(Status.SUCCESS_OK.getDescription());
} else {
response.setCode(Status.SUCCESS_NO_CONTENT.getCode());
response.setName(Status.SUCCESS_NO_CONTENT.getReasonPhrase());
response.setDescription("");
response.setMessage(Status.SUCCESS_NO_CONTENT.getDescription());
代码示例来源:origin: org.restlet.gae/org.restlet.ext.platform
response.setName(Status.SUCCESS_OK.getReasonPhrase());
response.setDescription("");
response.setMessage(Status.SUCCESS_OK.getDescription());
} else {
response.setCode(Status.SUCCESS_NO_CONTENT.getCode());
response.setName(Status.SUCCESS_NO_CONTENT.getReasonPhrase());
response.setDescription("");
response.setMessage(Status.SUCCESS_NO_CONTENT.getDescription());
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Adds the response headers for the handled uniform call.
*
* @param response
* The response returned.
*/
protected void addResponseHeaders(HttpResponse response) {
try {
// Add all the necessary headers
HeaderUtils.addGeneralHeaders(response, response.getHttpCall()
.getResponseHeaders());
HeaderUtils.addResponseHeaders(response, response.getHttpCall()
.getResponseHeaders());
// Set the status code in the response
if (response.getStatus() != null) {
response.getHttpCall().setStatusCode(
response.getStatus().getCode());
response.getHttpCall().setReasonPhrase(
response.getStatus().getReasonPhrase());
}
} catch (Exception e) {
getLogger().log(Level.WARNING,
"Exception intercepted while adding the response headers",
e);
response.getHttpCall().setStatusCode(
Status.SERVER_ERROR_INTERNAL.getCode());
response.getHttpCall().setReasonPhrase(
Status.SERVER_ERROR_INTERNAL.getReasonPhrase());
}
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.apispark
response.setCode(statusCode);
response.setName(Status.valueOf(statusCode)
.getReasonPhrase());
response.setMessage("Status " + statusCode);
代码示例来源:origin: org.restlet.jee/org.restlet.ext.platform
response.setCode(statusCode);
response.setName(Status.valueOf(statusCode)
.getReasonPhrase());
response.setMessage("Status " + statusCode);
代码示例来源:origin: org.restlet.jse/org.restlet.ext.platform
response.setCode(statusCode);
response.setName(Status.valueOf(statusCode)
.getReasonPhrase());
response.setMessage("Status " + statusCode);
代码示例来源:origin: org.restlet.gae/org.restlet.ext.platform
response.setCode(statusCode);
response.setName(Status.valueOf(statusCode)
.getReasonPhrase());
response.setMessage("Status " + statusCode);
代码示例来源:origin: org.restlet.osgi/org.restlet.ext.platform
response.setCode(statusCode);
response.setName(Status.valueOf(statusCode)
.getReasonPhrase());
response.setMessage("Status " + statusCode);
内容来源于网络,如有侵权,请联系作者删除!