本文整理了Java中org.restlet.data.Status.getCode()
方法的一些代码示例,展示了Status.getCode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Status.getCode()
方法的具体详情如下:
包路径:org.restlet.data.Status
类名称:Status
方法名:getCode
[英]Returns the corresponding code (HTTP or WebDAV or custom code).
[中]返回相应的代码(HTTP或WebDAV或自定义代码)。
代码示例来源:origin: internetarchive/heritrix3
@Override
public Representation getRepresentation(Status status, Request request, Response response) {
StringWriter st = new StringWriter();
PrintWriter pw = new PrintWriter(st);
if(status.getCode()==404){
pw.append("<h1>Page not found</h1>\n");
pw.append("The page you are looking for does not exist. "+
"You may be able to recover by going " +
"<a href='javascript:history.back();void(0);'>back</a>.\n");
}
else{
pw.append("<h1>An error occurred</h1>\n");
pw.append(
"You may be able to recover and try something " +
"else by going " +
"<a href='javascript:history.back();void(0);'>back</a>.\n");
if(status.getThrowable()!=null) {
pw.append("<h2>Cause: "+
status.getThrowable().toString()+"</h2>\n");
pw.append("<pre>");
status.getThrowable().printStackTrace(pw);
pw.append("</pre>");
}
}
pw.flush();
return new StringRepresentation(st.toString(),MediaType.TEXT_HTML);
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/** {@inheritDoc} */
@Override
public int hashCode() {
return getCode();
}
代码示例来源:origin: org.restlet/org.restlet
/** {@inheritDoc} */
@Override
public int hashCode() {
return getCode();
}
代码示例来源:origin: icclab/cyclops
public HTTPOutput(String description, Object result) {
this.status = Status.SUCCESS_OK;
this.description = description;
this.code = status.getCode();
this.result = result;
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Indicates if the status is a redirection status, meaning "Further action
* must be taken in order to complete the request".
*
* @return True if the status is a redirection status.
*/
public boolean isRedirection() {
return isRedirection(getCode());
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Indicates if the status is a success status, meaning "The action was
* successfully received, understood, and accepted".
*
* @return True if the status is a success status.
*/
public boolean isSuccess() {
return isSuccess(getCode());
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Indicates if the status is an error (client or server) status.
*
* @return True if the status is an error (client or server) status.
*/
public boolean isError() {
return isError(getCode());
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Indicates if the status is a redirection status, meaning "Further action
* must be taken in order to complete the request".
*
* @return True if the status is a redirection status.
*/
public boolean isRedirection() {
return isRedirection(getCode());
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Indicates if the status is a connector error status, meaning "The
* connector failed to send or receive an apparently valid message".
*
* @return True if the status is a connector error status.
*/
public boolean isConnectorError() {
return isConnectorError(getCode());
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Indicates if the status is a client error status, meaning "The request
* contains bad syntax or cannot be fulfilled".
*
* @return True if the status is a client error status.
*/
public boolean isClientError() {
return isClientError(getCode());
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Indicates if the status is a connector error status, meaning "The
* connector failed to send or receive an apparently valid message".
*
* @return True if the status is a connector error status.
*/
public boolean isConnectorError() {
return isConnectorError(getCode());
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Indicates if the status is a client error status, meaning "The request
* contains bad syntax or cannot be fulfilled".
*
* @return True if the status is a client error status.
*/
public boolean isClientError() {
return isClientError(getCode());
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Indicates if the status is a global error status, meaning "The server has
* definitive information about a particular user".
*
* @return True if the status is a global error status.
*/
public boolean isGlobalError() {
return isGlobalError(getCode());
}
代码示例来源:origin: org.sonatype.nexus/nexus-test-utils
@Override
protected boolean matchesSafely( Response item )
{
return item.getStatus().getCode() == expectedStatusCode;
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Indicates if the status is an information status, meaning "request
* received, continuing process".
*
* @return True if the status is an information status.
*/
public boolean isInformational() {
return isInformational(getCode());
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Indicates if the status is a server error status, meaning "The server
* failed to fulfill an apparently valid request".
*
* @return True if the status is a server error status.
*/
public boolean isServerError() {
return isServerError(getCode());
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Constructor.
*
* @param status
* The status to copy.
* @param description
* The description to associate.
*/
public Status(final Status status, final String description) {
this(status.getCode(), status.getName(), description, status.getUri());
}
代码示例来源:origin: org.restlet.gae/org.restlet.ext.platform
/**
* Constructor. The default status code is {@link Status#SUCCESS_OK}.
*/
public Response() {
setCode(Status.SUCCESS_OK.getCode());
setMessage(Status.SUCCESS_OK.getDescription());
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.apispark
/**
* Constructor. The default status code is {@link Status#SUCCESS_OK}.
*/
public Response() {
setCode(Status.SUCCESS_OK.getCode());
setMessage(Status.SUCCESS_OK.getDescription());
}
代码示例来源:origin: org.restlet.osgi/org.restlet.ext.platform
/**
* Constructor. The default status code is {@link Status#SUCCESS_OK}.
*/
public Response() {
setCode(Status.SUCCESS_OK.getCode());
setMessage(Status.SUCCESS_OK.getDescription());
}
内容来源于网络,如有侵权,请联系作者删除!