Send feedback
  
   
 
  
    
      Class HttpStatusCodes (2.0.2)
    
    
      
      
      Stay organized with collections
     
    
      
      Save and categorize content based on your preferences.
     
    
  
  
   
  
    
  
  
    
    
    
    
  Version latestkeyboard_arrow_down  
  
 
    
    
    
    
      
  
  
  
    
public   class  HttpStatusCodes  
  Constants enumerating the HTTP status codes. Includes status codes specified in RFC2616  (HTTP/1.1).
Static Fields
   
  STATUS_CODE_ACCEPTED 
  
    
public   static   final   int   STATUS_CODE_ACCEPTED  
  Status code for a successful request that has been received but not yet acted upon.
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  STATUS_CODE_BAD_GATEWAY 
  
    
public   static   final   int   STATUS_CODE_BAD_GATEWAY  
  Status code for a bad gateway.
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  STATUS_CODE_BAD_REQUEST 
  
    
public   static   final   int   STATUS_CODE_BAD_REQUEST  
  Status code for a request that could not be understood by the server.
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  STATUS_CODE_CONFLICT 
  
    
public   static   final   int   STATUS_CODE_CONFLICT  
  Status code for a request that could not be completed due to a resource conflict.
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  STATUS_CODE_CREATED 
  
    
public   static   final   int   STATUS_CODE_CREATED  
  Status code for a successful request that has been fulfilled to create a new resource.
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  STATUS_CODE_FORBIDDEN 
  
    
public   static   final   int   STATUS_CODE_FORBIDDEN  
  Status code for a server that understood the request, but is refusing to fulfill it.
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  STATUS_CODE_FOUND 
  
    
public   static   final   int   STATUS_CODE_FOUND  
  Status code for a resource that has temporarily moved to a new URI.
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  STATUS_CODE_METHOD_NOT_ALLOWED 
  
    
public   static   final   int   STATUS_CODE_METHOD_NOT_ALLOWED  
  Status code for a method specified in the Request-Line is not allowed for the resource
 identified by the Request-URI.
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  STATUS_CODE_MOVED_PERMANENTLY 
  
    
public   static   final   int   STATUS_CODE_MOVED_PERMANENTLY  
  Status code for a resource that has permanently moved to a new URI.
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  STATUS_CODE_MULTIPLE_CHOICES 
  
    
public   static   final   int   STATUS_CODE_MULTIPLE_CHOICES  
  Status code for a resource corresponding to any one of a set of representations.
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  STATUS_CODE_NOT_FOUND 
  
    
public   static   final   int   STATUS_CODE_NOT_FOUND  
  Status code for a server that has not found anything matching the Request-URI.
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  STATUS_CODE_NOT_MODIFIED 
  
    
public   static   final   int   STATUS_CODE_NOT_MODIFIED  
  Status code for a resource that access is allowed but the document has not been modified.
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  STATUS_CODE_NO_CONTENT 
  
    
public   static   final   int   STATUS_CODE_NO_CONTENT  
  Status code for a successful request with no content information.
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  STATUS_CODE_OK 
  
    
public   static   final   int   STATUS_CODE_OK  
  Status code for a successful request.
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  STATUS_CODE_PRECONDITION_FAILED 
  
    
public   static   final   int   STATUS_CODE_PRECONDITION_FAILED  
  Status code for a request for which one of the conditions it was made under has failed.
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  STATUS_CODE_SEE_OTHER 
  
    
public   static   final   int   STATUS_CODE_SEE_OTHER  
  Status code for a resource that has moved to a new URI and should be retrieved using GET.
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  STATUS_CODE_SERVER_ERROR 
  
    
public   static   final   int   STATUS_CODE_SERVER_ERROR  
  Status code for an internal server error.
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  STATUS_CODE_SERVICE_UNAVAILABLE 
  
    
public   static   final   int   STATUS_CODE_SERVICE_UNAVAILABLE  
  Status code for a service that is unavailable on the server.
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  STATUS_CODE_TEMPORARY_REDIRECT 
  
    
public   static   final   int   STATUS_CODE_TEMPORARY_REDIRECT  
  Status code for a resource that has temporarily moved to a new URI.
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  STATUS_CODE_UNAUTHORIZED 
  
    
public   static   final   int   STATUS_CODE_UNAUTHORIZED  
  Status code for a request that requires user authentication.
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  STATUS_CODE_UNPROCESSABLE_ENTITY 
  
    
public   static   final   int   STATUS_CODE_UNPROCESSABLE_ENTITY  
  Status code for a request for which the content-type and the request's syntax were correct but
 server was not able to process entity.
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  Static Methods
   
  isRedirect(int statusCode) 
  
    
public   static   boolean   isRedirect ( int   statusCode )  
  Returns whether the given HTTP response status code is a redirect code 301, 302, 303,
 307, 308.
    
      
        Parameter  
      
        Name Description  
      
        statusCodeint  
     
  
  
  isSuccess(int statusCode) 
  
    
public   static   boolean   isSuccess ( int   statusCode )  
  Returns whether the given HTTP response status code is a success code >= 200 and < 300.
    
      
        Parameter  
      
        Name Description  
      
        statusCodeint  
     
  
  
  Constructors
   
  HttpStatusCodes() 
  
 
     
    
  
  
  
     
  
    
    
      
    
     
  
       
         
  
  
    
    Send feedback
  
   
 
       
    
    
  
  
 
  Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
  Last updated 2025-10-14 UTC.
 
 
  
  
    
    
    
      
  
  
    Need to tell us more?
  
   
 
     
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-10-14 UTC."],[],[]]