public interface RestfulResponse
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
STATUS_BAD_GATEWAY
502 Bad Gateway
|
static int |
STATUS_BAD_REQUEST
400 Bad Request
|
static int |
STATUS_CONFLICT
409 Conflict
|
static int |
STATUS_EXPECTATION_FAILED
417 Expectation Failed
|
static int |
STATUS_FORBIDDEN
403 Forbidden
|
static int |
STATUS_GATEWAY_TIMEOUT
504 Gateway Timeout
|
static int |
STATUS_GONE
410 Gone
|
static int |
STATUS_HTTP_VERSION_NOT_SUPPORTED
505 HTTP Version Not Supported
|
static int |
STATUS_INTERNAL_SERVER_ERROR
500 Internal Server Error
|
static int |
STATUS_METHOD_NOT_ALLOWED
405 Method Not Allowed
|
static int |
STATUS_MISDIRECTED_REQUEST
421 Misdirected Request
|
static int |
STATUS_MOVED_PERMANENTLY
301 Moved Permanently
|
static int |
STATUS_MOVED_TEMPORARILY
302 Moved Temporarily
|
static int |
STATUS_MULTIPLE_CHOICES
300 Multiple Choices
|
static int |
STATUS_NO_CONTENT
204 No Content
|
static int |
STATUS_NON_AUTHORITATIVE_INFORMATION
203 Non-Authoritative Information (since HTTP/1.1)
|
static int |
STATUS_NOT_ACCEPTABLE
406 Not Acceptable
|
static int |
STATUS_NOT_FOUND
404 Not Found
|
static int |
STATUS_NOT_IMPLEMENTED
501 Not Implemented
|
static int |
STATUS_NOT_MODIFIED
304 Not Modified
|
static int |
STATUS_OK
200 OK
|
static int |
STATUS_PARTIAL_CONTENT
206 Partial Content
|
static int |
STATUS_PAYMENT_REQUIRED
402 Payment Required
|
static int |
STATUS_PERMANENT_REDIRECT
308 Permanent Redirect (RFC7538)
|
static int |
STATUS_REQUEST_ENTITY_TOO_LARGE
413 Request Entity Too Large
|
static int |
STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE
431 Request Header Fields Too Large (RFC6585)
|
static int |
STATUS_REQUEST_TIMEOUT
408 Request Timeout
|
static int |
STATUS_REQUEST_URI_TOO_LONG
414 Request-URI Too Long
|
static int |
STATUS_SEE_OTHER
303 See Other (since HTTP/1.1)
|
static int |
STATUS_SERVICE_UNAVAILABLE
503 Service Unavailable
|
static int |
STATUS_TEMPORARY_REDIRECT
307 Temporary Redirect (since HTTP/1.1)
|
static int |
STATUS_TOO_MANY_REQUESTS
429 Too Many Requests (RFC6585)
|
static int |
STATUS_UNAUTHORIZED
401 Unauthorized
|
static int |
STATUS_UNSUPPORTED_MEDIA_TYPE
415 Unsupported Media Type
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close()
(不响应)关闭输出/连接
|
boolean |
isRespond()
是否已响应
|
OutputStream |
openOutput()
打开响应输出流
|
void |
setHeader(String name,
String value)
设置响应的头信息
|
void |
setResponse(int timeout)
指定响应超时值,若指定则在超时未响应时自动向请求端返回STATUS_MISDIRECTED_REQUEST(421)
|
void |
setStatus(int status)
设置响应状态
|
static final int STATUS_OK
static final int STATUS_NON_AUTHORITATIVE_INFORMATION
static final int STATUS_NO_CONTENT
static final int STATUS_PARTIAL_CONTENT
static final int STATUS_MULTIPLE_CHOICES
static final int STATUS_MOVED_PERMANENTLY
static final int STATUS_MOVED_TEMPORARILY
static final int STATUS_SEE_OTHER
static final int STATUS_NOT_MODIFIED
static final int STATUS_TEMPORARY_REDIRECT
static final int STATUS_PERMANENT_REDIRECT
static final int STATUS_BAD_REQUEST
static final int STATUS_UNAUTHORIZED
static final int STATUS_PAYMENT_REQUIRED
static final int STATUS_FORBIDDEN
static final int STATUS_NOT_FOUND
static final int STATUS_METHOD_NOT_ALLOWED
static final int STATUS_NOT_ACCEPTABLE
static final int STATUS_REQUEST_TIMEOUT
static final int STATUS_CONFLICT
static final int STATUS_GONE
static final int STATUS_REQUEST_ENTITY_TOO_LARGE
static final int STATUS_REQUEST_URI_TOO_LONG
static final int STATUS_UNSUPPORTED_MEDIA_TYPE
static final int STATUS_EXPECTATION_FAILED
static final int STATUS_MISDIRECTED_REQUEST
static final int STATUS_TOO_MANY_REQUESTS
static final int STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE
static final int STATUS_INTERNAL_SERVER_ERROR
static final int STATUS_NOT_IMPLEMENTED
static final int STATUS_BAD_GATEWAY
static final int STATUS_SERVICE_UNAVAILABLE
static final int STATUS_GATEWAY_TIMEOUT
static final int STATUS_HTTP_VERSION_NOT_SUPPORTED
void setResponse(int timeout)
throws IOException
timeout - 超时值(毫秒),0则不超时IOException - IO异常时抛出void setHeader(String name, String value) throws IOException
name - 名称value - 值IOException - IO异常时抛出void setStatus(int status)
throws IOException
status - HTTP状态码(参考STATUS_xxx)IOException - IO异常时抛出OutputStream openOutput() throws IOException
IOException - IO异常时抛出void close()
boolean isRespond()
Copyright © 2022. All rights reserved.