src/jdk.httpserver/share/classes/sun/net/httpserver/Code.java
author phh
Sat, 30 Nov 2019 14:33:05 -0800
changeset 59330 5b96c12f909d
parent 47216 71c04702a3d5
permissions -rw-r--r--
8234541: C1 emits an empty message when it inlines successfully Summary: Use "inline" as the message when successfull Reviewed-by: thartmann, mdoerr Contributed-by: navy.xliu@gmail.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.net.httpserver;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
class Code {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
    public static final int HTTP_CONTINUE = 100;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
    public static final int HTTP_OK = 200;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
    public static final int HTTP_CREATED = 201;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
    public static final int HTTP_ACCEPTED = 202;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
    public static final int HTTP_NOT_AUTHORITATIVE = 203;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
    public static final int HTTP_NO_CONTENT = 204;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
    public static final int HTTP_RESET = 205;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
    public static final int HTTP_PARTIAL = 206;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
    public static final int HTTP_MULT_CHOICE = 300;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
    public static final int HTTP_MOVED_PERM = 301;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
    public static final int HTTP_MOVED_TEMP = 302;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
    public static final int HTTP_SEE_OTHER = 303;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
    public static final int HTTP_NOT_MODIFIED = 304;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
    public static final int HTTP_USE_PROXY = 305;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    public static final int HTTP_BAD_REQUEST = 400;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    public static final int HTTP_UNAUTHORIZED = 401;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    public static final int HTTP_PAYMENT_REQUIRED = 402;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    public static final int HTTP_FORBIDDEN = 403;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    public static final int HTTP_NOT_FOUND = 404;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    public static final int HTTP_BAD_METHOD = 405;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    public static final int HTTP_NOT_ACCEPTABLE = 406;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    public static final int HTTP_PROXY_AUTH = 407;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    public static final int HTTP_CLIENT_TIMEOUT = 408;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    public static final int HTTP_CONFLICT = 409;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    public static final int HTTP_GONE = 410;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    public static final int HTTP_LENGTH_REQUIRED = 411;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    public static final int HTTP_PRECON_FAILED = 412;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    public static final int HTTP_ENTITY_TOO_LARGE = 413;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    public static final int HTTP_REQ_TOO_LONG = 414;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    public static final int HTTP_UNSUPPORTED_TYPE = 415;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    public static final int HTTP_INTERNAL_ERROR = 500;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    public static final int HTTP_NOT_IMPLEMENTED = 501;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    public static final int HTTP_BAD_GATEWAY = 502;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    public static final int HTTP_UNAVAILABLE = 503;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    public static final int HTTP_GATEWAY_TIMEOUT = 504;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    public static final int HTTP_VERSION = 505;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    static String msg (int code) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
      switch (code) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        case HTTP_OK: return " OK";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        case HTTP_CONTINUE: return " Continue";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        case HTTP_CREATED: return " Created";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        case HTTP_ACCEPTED: return " Accepted";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        case HTTP_NOT_AUTHORITATIVE: return " Non-Authoritative Information";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        case HTTP_NO_CONTENT: return " No Content";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        case HTTP_RESET: return " Reset Content";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        case HTTP_PARTIAL: return " Partial Content";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        case HTTP_MULT_CHOICE: return " Multiple Choices";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        case HTTP_MOVED_PERM: return " Moved Permanently";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        case HTTP_MOVED_TEMP: return " Temporary Redirect";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        case HTTP_SEE_OTHER: return " See Other";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        case HTTP_NOT_MODIFIED: return " Not Modified";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        case HTTP_USE_PROXY: return " Use Proxy";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        case HTTP_BAD_REQUEST: return " Bad Request";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        case HTTP_UNAUTHORIZED: return " Unauthorized" ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        case HTTP_PAYMENT_REQUIRED: return " Payment Required";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        case HTTP_FORBIDDEN: return " Forbidden";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        case HTTP_NOT_FOUND: return " Not Found";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        case HTTP_BAD_METHOD: return " Method Not Allowed";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        case HTTP_NOT_ACCEPTABLE: return " Not Acceptable";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        case HTTP_PROXY_AUTH: return " Proxy Authentication Required";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        case HTTP_CLIENT_TIMEOUT: return " Request Time-Out";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        case HTTP_CONFLICT: return " Conflict";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        case HTTP_GONE: return " Gone";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        case HTTP_LENGTH_REQUIRED: return " Length Required";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        case HTTP_PRECON_FAILED: return " Precondition Failed";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        case HTTP_ENTITY_TOO_LARGE: return " Request Entity Too Large";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        case HTTP_REQ_TOO_LONG: return " Request-URI Too Large";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        case HTTP_UNSUPPORTED_TYPE: return " Unsupported Media Type";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        case HTTP_INTERNAL_ERROR: return " Internal Server Error";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        case HTTP_NOT_IMPLEMENTED: return " Not Implemented";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        case HTTP_BAD_GATEWAY: return " Bad Gateway";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        case HTTP_UNAVAILABLE: return " Service Unavailable";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        case HTTP_GATEWAY_TIMEOUT: return " Gateway Timeout";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        case HTTP_VERSION: return " HTTP Version Not Supported";
28523
843229b1db9f 8068795: HttpServer missing tailing space for some response codes
lpriima
parents: 25859
diff changeset
   106
        default: return " ";
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
}