HttpResponseCode

/**
 * 200 OK
 */
public static final HttpResponseStatus OK = new HttpResponseStatus(200, "OK");

/**
 * 201 Created
 */
public static final HttpResponseStatus CREATED = new HttpResponseStatus(201, "Created");

/** 
* 202 Accepted 
*/
public static final HttpResponseStatus ACCEPTED = new HttpResponseStatus(202, "Accepted");

/**
 * 304 Not Modified
 */
public static final HttpResponseStatus NOT_MODIFIED = new HttpResponseStatus(304, "Not Modified");

/**
 * 400 Bad Request
 */
public static final HttpResponseStatus BAD_REQUEST = new HttpResponseStatus(400, "Bad Request");

/**
 * 404 Not Found
 */
public static final HttpResponseStatus NOT_FOUND = new HttpResponseStatus(404, "Not Found");

/**
 * 408 Request Timeout
 */
public static final HttpResponseStatus REQUEST_TIMEOUT = new HttpResponseStatus(408, "Request Timeout");

/**
 * 500 Internal Server Error
 */
public static final HttpResponseStatus INTERNAL_SERVER_ERROR =
        new HttpResponseStatus(500, "Internal Server Error");

/**
 * 501 Not Implemented
 */
public static final HttpResponseStatus NOT_IMPLEMENTED = new HttpResponseStatus(501, "Not Implemented");

/**
 * 502 Bad Gateway
 */
public static final HttpResponseStatus BAD_GATEWAY = new HttpResponseStatus(502, "Bad Gateway");

/**
 * 503 Service Unavailable
 */
public static final HttpResponseStatus SERVICE_UNAVAILABLE = new HttpResponseStatus(503, "Service Unavailable");

/**
 * 504 Gateway Timeout
 */

public static final HttpResponseStatus GATEWAY_TIMEOUT = new HttpResponseStatus(504, "Gateway Timeout");

if (code < 100) {
    reasonPhrase = "Unknown Status";
} else if (code < 200) {
    reasonPhrase = "Informational";
} else if (code < 300) {
    reasonPhrase = "Successful";
} else if (code < 400) {
    reasonPhrase = "Redirection";
} else if (code < 500) {
    reasonPhrase = "Client Error";
} else if (code < 600) {
    reasonPhrase = "Server Error";
} else {
    reasonPhrase = "Unknown Status";
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值