src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/ProxyAuthenticationRequired.java
author chegar
Tue, 06 Feb 2018 14:10:28 +0000
branchhttp-client-branch
changeset 56079 d23b02f37fce
parent 56041 src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ProxyAuthenticationRequired.java@b4b5e09ef3cc
permissions -rw-r--r--
http-client-branch: more remaining impl types to internal
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
56041
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
     1
/*
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
     2
 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
     4
 *
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    10
 *
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    15
 * accompanied this code).
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    16
 *
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    20
 *
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    23
 * questions.
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    24
 */
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    25
56079
d23b02f37fce http-client-branch: more remaining impl types to internal
chegar
parents: 56041
diff changeset
    26
package jdk.incubator.http.internal;
d23b02f37fce http-client-branch: more remaining impl types to internal
chegar
parents: 56041
diff changeset
    27
56041
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    28
import java.io.IOException;
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    29
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    30
/**
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    31
 * Signals that a proxy has refused a CONNECT request with a
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    32
 * 407 error code.
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    33
 */
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    34
final class ProxyAuthenticationRequired extends IOException {
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    35
    private static final long serialVersionUID = 0;
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    36
    final transient Response proxyResponse;
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    37
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    38
    /**
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    39
     * Constructs a {@code ConnectionExpiredException} with the specified detail
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    40
     * message and cause.
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    41
     *
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    42
     * @param   proxyResponse the response from the proxy
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    43
     */
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    44
    public ProxyAuthenticationRequired(Response proxyResponse) {
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    45
        super("Proxy Authentication Required");
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    46
        assert proxyResponse.statusCode() == 407;
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    47
        this.proxyResponse = proxyResponse;
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    48
    }
b4b5e09ef3cc http-client-branch: make it possible to supply proxy-authorization headers
dfuchs
parents:
diff changeset
    49
}