Package one.nio.http
Class Response
- java.lang.Object
-
- one.nio.http.Response
-
public class Response extends Object
-
-
Field Summary
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddHeader(String header)byte[]getBody()StringgetBodyUtf8()StringgetHeader(String key)intgetHeaderCount()String[]getHeaders()intgetStatus()static Responsejson(Object obj)static Responseok(byte[] body)static Responseok(String plainText)static Responseredirect(String url)voidsetBody(byte[] body)byte[]toBytes(boolean includeBody)StringtoString()
-
-
-
Field Detail
-
CONTINUE
public static final String CONTINUE
- See Also:
- Constant Field Values
-
SWITCHING_PROTOCOLS
public static final String SWITCHING_PROTOCOLS
- See Also:
- Constant Field Values
-
OK
public static final String OK
- See Also:
- Constant Field Values
-
CREATED
public static final String CREATED
- See Also:
- Constant Field Values
-
ACCEPTED
public static final String ACCEPTED
- See Also:
- Constant Field Values
-
NON_AUTHORITATIVE_INFORMATION
public static final String NON_AUTHORITATIVE_INFORMATION
- See Also:
- Constant Field Values
-
NO_CONTENT
public static final String NO_CONTENT
- See Also:
- Constant Field Values
-
RESET_CONTENT
public static final String RESET_CONTENT
- See Also:
- Constant Field Values
-
PARTIAL_CONTENT
public static final String PARTIAL_CONTENT
- See Also:
- Constant Field Values
-
MULTIPLE_CHOICES
public static final String MULTIPLE_CHOICES
- See Also:
- Constant Field Values
-
MOVED_PERMANENTLY
public static final String MOVED_PERMANENTLY
- See Also:
- Constant Field Values
-
FOUND
public static final String FOUND
- See Also:
- Constant Field Values
-
SEE_OTHER
public static final String SEE_OTHER
- See Also:
- Constant Field Values
-
NOT_MODIFIED
public static final String NOT_MODIFIED
- See Also:
- Constant Field Values
-
USE_PROXY
public static final String USE_PROXY
- See Also:
- Constant Field Values
-
TEMPORARY_REDIRECT
public static final String TEMPORARY_REDIRECT
- See Also:
- Constant Field Values
-
BAD_REQUEST
public static final String BAD_REQUEST
- See Also:
- Constant Field Values
-
UNAUTHORIZED
public static final String UNAUTHORIZED
- See Also:
- Constant Field Values
-
PAYMENT_REQUIRED
public static final String PAYMENT_REQUIRED
- See Also:
- Constant Field Values
-
FORBIDDEN
public static final String FORBIDDEN
- See Also:
- Constant Field Values
-
NOT_FOUND
public static final String NOT_FOUND
- See Also:
- Constant Field Values
-
METHOD_NOT_ALLOWED
public static final String METHOD_NOT_ALLOWED
- See Also:
- Constant Field Values
-
NOT_ACCEPTABLE
public static final String NOT_ACCEPTABLE
- See Also:
- Constant Field Values
-
PROXY_AUTHENTICATION_REQUIRED
public static final String PROXY_AUTHENTICATION_REQUIRED
- See Also:
- Constant Field Values
-
REQUEST_TIMEOUT
public static final String REQUEST_TIMEOUT
- See Also:
- Constant Field Values
-
CONFLICT
public static final String CONFLICT
- See Also:
- Constant Field Values
-
GONE
public static final String GONE
- See Also:
- Constant Field Values
-
LENGTH_REQUIRED
public static final String LENGTH_REQUIRED
- See Also:
- Constant Field Values
-
PRECONDITION_FAILED
public static final String PRECONDITION_FAILED
- See Also:
- Constant Field Values
-
REQUEST_ENTITY_TOO_LARGE
public static final String REQUEST_ENTITY_TOO_LARGE
- See Also:
- Constant Field Values
-
REQUEST_URI_TOO_LONG
public static final String REQUEST_URI_TOO_LONG
- See Also:
- Constant Field Values
-
UNSUPPORTED_MEDIA_TYPE
public static final String UNSUPPORTED_MEDIA_TYPE
- See Also:
- Constant Field Values
-
REQUESTED_RANGE_NOT_SATISFIABLE
public static final String REQUESTED_RANGE_NOT_SATISFIABLE
- See Also:
- Constant Field Values
-
EXPECTATION_FAILED
public static final String EXPECTATION_FAILED
- See Also:
- Constant Field Values
-
INTERNAL_ERROR
public static final String INTERNAL_ERROR
- See Also:
- Constant Field Values
-
NOT_IMPLEMENTED
public static final String NOT_IMPLEMENTED
- See Also:
- Constant Field Values
-
BAD_GATEWAY
public static final String BAD_GATEWAY
- See Also:
- Constant Field Values
-
SERVICE_UNAVAILABLE
public static final String SERVICE_UNAVAILABLE
- See Also:
- Constant Field Values
-
GATEWAY_TIMEOUT
public static final String GATEWAY_TIMEOUT
- See Also:
- Constant Field Values
-
HTTP_VERSION_NOT_SUPPORTED
public static final String HTTP_VERSION_NOT_SUPPORTED
- See Also:
- Constant Field Values
-
EMPTY
public static final byte[] EMPTY
-
-
Method Detail
-
ok
public static Response ok(byte[] body)
-
addHeader
public void addHeader(String header)
-
getHeaderCount
public int getHeaderCount()
-
getHeaders
public String[] getHeaders()
-
getStatus
public int getStatus()
-
getBody
public byte[] getBody()
-
setBody
public void setBody(byte[] body)
-
getBodyUtf8
public String getBodyUtf8()
-
toBytes
public byte[] toBytes(boolean includeBody)
-
-