Android Open Source - RestLib Status Code






From Project

Back to project page RestLib.

License

The source code is released under:

MIT License

If you think the Android project RestLib listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package github.crazymumu.restlib.http;
/*from  w w w  . j a  v a 2 s .c o m*/
/**
 * Each Status-Code is described below, including a description of which
 * method(s) it can follow and any metainformation required in the response.
 * 
 * The individual values of the numeric status codes defined for HTTP/1.1:
 * 
 * 100 Continue
 * 101 Switching Protocols
 * 200 OK
 * 201 Created
 * 202 Accepted
 * 203 Non-Authoritative Information
 * 204 No Content
 * 205 Reset Content
 * 206 Partial Content
 * 300 Multiple Choices
 * 301 Moved Permanently
 * 302 Found
 * 303 See Other
 * 304 Not Modified
 * 305 Use Proxy
 * 307 Temporary Redirect
 * 400 Bad Request
 * 401 Unauthorized
 * 402 Payment Required
 * 403 Forbidden
 * 404 Not Found
 * 405 Method Not Allowed
 * 406 Not Acceptable
 * 407 Proxy Authentication Required
 * 408 Request Time-out
 * 409 Conflict
 * 410 Gone
 * 411 Length Required
 * 412 Precondition Failed
 * 413 Request Entity Too Large
 * 414 Request-URI Too Large
 * 415 Unsupported Media Type
 * 416 Requested range not satisfiable
 * 417 Expectation Failed
 * 500 Internal Server Error
 * 501 Not Implemented
 * 502 Bad Gateway
 * 503 Service Unavailable
 * 504 Gateway Time-out
 * 505 HTTP Version not supported
 * 
 * @author Crazy MuMu
 */
public interface StatusCode {
  /**
   * The client SHOULD continue with its request.
   */
  public final static int Continue = 100;

  /**
   * The server understands and is willing to comply with the client's
   * request, via the Upgrade message header field, for a change in the
   * application protocol being used on this connection.
   */
  public final static int SwitchingProtocols = 101;

  /**
   * The request has succeeded.
   */
  public final static int OK = 200;

  /**
   * The request has been fulfilled and resulted in a new resource being
   * created.
   */
  public final static int Created = 201;

  /**
   * The request has been accepted for processing, but the processing has not
   * been completed.
   */
  public final static int Accepted = 202;

  /**
   * The server has fulfilled the request but does not need to return an
   * entity-body, and might want to return updated metainformation.
   */
  public final static int NoContent = 204;

  /**
   * The server has fulfilled the request and the user agent SHOULD reset the
   * document view which caused the request to be sent.
   */
  public final static int ResetContent = 205;

  /**
   * The requested resource has been assigned a new permanent URI and any
   * future references to this resource SHOULD use one of the returned URIs.
   */
  public final static int MovedPermanently = 301;

  /**
   * The requested resource resides temporarily under a different URI.
   */
  public final static int Found = 302;

  /**
   * The response to the request can be found under a different URI and SHOULD
   * be retrieved using a GET method on that resource.
   */
  public final static int SeeOther = 303;

  /**
   * If the client has performed a conditional GET request and access is
   * allowed, but the document has not been modified, the server SHOULD
   * respond with this status code.
   */
  public final static int NotModified = 304;

  /**
   * The requested resource MUST be accessed through the proxy given by the
   * Location field.
   */
  public final static int UseProxy = 305;

  /**
   * The requested resource resides temporarily under a different URI. Since
   * the redirection MAY be altered on occasion, the client SHOULD continue to
   * use the Request-URI for future requests.
   */
  public final static int TemporaryRedirect = 307;

  /**
   * The request could not be understood by the server due to malformed
   * syntax.
   */
  public final static int BadRequest = 400;

  /**
   * The request requires user authentication.
   */
  public final static int Unauthorized = 401;

  /**
   * This code is reserved for future use.
   */
  public final static int PaymentRequired = 402;

  /**
   * The server understood the request, but is refusing to fulfill it.
   */
  public final static int Forbidden = 403;

  /**
   * The server has not found anything matching the Request-URI.
   */
  public final static int NotFound = 404;

  /**
   * The method specified in the Request-Line is not allowed for the resource
   * identified by the Request-URI.
   */
  public final static int MethodNotAllowed = 405;

  /**
   * The resource identified by the request is only capable of generating
   * response entities which have content characteristics not acceptable
   * according to the accept headers sent in the request.
   */
  public final static int NotAcceptable = 406;

  /**
   * The client did not produce a request within the time that the server was
   * prepared to wait.
   */
  public final static int RequestTimeout = 408;

  /**
   * The request could not be completed due to a conflict with the current
   * state of the resource.
   */
  public final static int Conflict = 409;

  /**
   * The requested resource is no longer available at the server and no
   * forwarding address is known.
   */
  public final static int Gone = 410;

  /**
   * The server refuses to accept the request without a defined
   * Content-Length.
   */
  public final static int LengthRequired = 411;

  /**
   * The precondition given in one or more of the request-header fields
   * evaluated to false when it was tested on the server.
   */
  public final static int PreconditionFailed = 412;

  /**
   * The server is refusing to process a request because the request entity is
   * larger than the server is willing or able to process.
   */
  public final static int RequestEntityTooLarge = 413;

  /**
   * The server is refusing to service the request because the entity of the
   * request is in a format not supported by the requested resource for the
   * requested method.
   */
  public final static int UnsupportedMediaType = 415;

  /**
   * A server SHOULD return a response with this status code if a request
   * included a Range request-header field, and none of the range-specifier
   * values in this field overlap the current extent of the selected resource,
   * and the request did not include an If-Range request-header field.
   */
  public final static int RequestedRangeNotSatisfiable = 416;

  /**
   * The expectation given in an Expect request-header field could not be met
   * by this server.
   */
  public final static int ExpectationFailed = 417;

  /**
   * The server encountered an unexpected condition which prevented it from
   * fulfilling the request.
   */
  public final static int InternalServerError = 500;

  /**
   * The server does not support the functionality required to fulfill the
   * request.
   */
  public final static int NotImplemented = 501;

  /**
   * The server, while acting as a gateway or proxy, received an invalid
   * response from the upstream server it accessed in attempting to fulfill
   * the request.
   */
  public final static int BadGateway = 502;

  /**
   * The server is currently unable to handle the request due to a temporary
   * overloading or maintenance of the server.
   */
  public final static int ServiceUnavailable = 503;

  /**
   * The server, while acting as a gateway or proxy, did not receive a timely
   * response from the upstream server specified by the URI (e.g. HTTP, FTP,
   * LDAP) or some other auxiliary server (e.g. DNS) it needed to access in
   * attempting to complete the request.
   */
  public final static int GatewayTimeout = 504;

  /**
   * The server does not support, or refuses to support, the HTTP protocol
   * version that was used in the request message.
   */
  public final static int HttpVersionNotSupported = 505;
}




Java Source Code List

github.crazymumu.restlib.RestRequest.java
github.crazymumu.restlib.RestResponse.java
github.crazymumu.restlib.RestResultReceiver.java
github.crazymumu.restlib.RestResult.java
github.crazymumu.restlib.RestService.java
github.crazymumu.restlib.core.CustomSSLSocketFactory.java
github.crazymumu.restlib.core.HttpsClient.java
github.crazymumu.restlib.core.SSLContextAlgorithm.java
github.crazymumu.restlib.http.RequestMethod.java
github.crazymumu.restlib.http.StatusCode.java
github.crazymumu.restlib.http.UserAgent.java
github.crazymumu.restlib.sample.MainActivity.java