src/java.net.http/share/classes/jdk/internal/net/http/common/ImmutableExtendedSSLSession.java
branchhttp-client-branch
changeset 56126 86e628130926
child 54099 fd332722014c
equal deleted inserted replaced
56122:1d7d3d8f8021 56126:86e628130926
       
     1 /*
       
     2  * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.  Oracle designates this
       
     8  * particular file as subject to the "Classpath" exception as provided
       
     9  * by Oracle in the LICENSE file that accompanied this code.
       
    10  *
       
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14  * version 2 for more details (a copy is included in the LICENSE file that
       
    15  * accompanied this code).
       
    16  *
       
    17  * You should have received a copy of the GNU General Public License version
       
    18  * 2 along with this work; if not, write to the Free Software Foundation,
       
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20  *
       
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    22  * or visit www.oracle.com if you need additional information or have any
       
    23  * questions.
       
    24  */
       
    25 
       
    26 package jdk.internal.net.http.common;
       
    27 
       
    28 import java.security.Principal;
       
    29 import java.util.List;
       
    30 import javax.net.ssl.SSLSession;
       
    31 import javax.net.ssl.ExtendedSSLSession;
       
    32 import javax.net.ssl.SSLSessionContext;
       
    33 import javax.net.ssl.SSLPeerUnverifiedException;
       
    34 import javax.net.ssl.SNIServerName;
       
    35 
       
    36 /**
       
    37  * All mutating methods throw UnsupportedOperationException
       
    38  */
       
    39 public class ImmutableExtendedSSLSession extends ExtendedSSLSession {
       
    40     private final ExtendedSSLSession delegate;
       
    41 
       
    42     ImmutableExtendedSSLSession(ExtendedSSLSession session) {
       
    43         this.delegate = session;
       
    44     }
       
    45 
       
    46     public byte[] getId() {
       
    47         return delegate.getId();
       
    48     }
       
    49 
       
    50     public SSLSessionContext getSessionContext() {
       
    51         return delegate.getSessionContext();
       
    52     }
       
    53 
       
    54     public long getCreationTime() {
       
    55         return delegate.getCreationTime();
       
    56     }
       
    57 
       
    58     public long getLastAccessedTime() {
       
    59         return delegate.getLastAccessedTime();
       
    60     }
       
    61 
       
    62     public void invalidate() {
       
    63         throw new UnsupportedOperationException("session is not mutable");
       
    64     }
       
    65 
       
    66     public boolean isValid() {
       
    67         return delegate.isValid();
       
    68     }
       
    69 
       
    70     public void putValue(String name, Object value) {
       
    71         throw new UnsupportedOperationException("session is not mutable");
       
    72     }
       
    73 
       
    74     public Object getValue(String name) {
       
    75         return delegate.getValue(name);
       
    76     }
       
    77 
       
    78     public void removeValue(String name) {
       
    79         throw new UnsupportedOperationException("session is not mutable");
       
    80     }
       
    81 
       
    82     public String [] getValueNames() {
       
    83         return delegate.getValueNames();
       
    84     }
       
    85 
       
    86     public java.security.cert.Certificate [] getPeerCertificates()
       
    87             throws SSLPeerUnverifiedException {
       
    88         return delegate.getPeerCertificates();
       
    89     }
       
    90 
       
    91     public java.security.cert.Certificate [] getLocalCertificates() {
       
    92         return delegate.getLocalCertificates();
       
    93     }
       
    94 
       
    95     @Deprecated
       
    96     public javax.security.cert.X509Certificate [] getPeerCertificateChain()
       
    97             throws SSLPeerUnverifiedException {
       
    98         return delegate.getPeerCertificateChain();
       
    99     }
       
   100 
       
   101     public Principal getPeerPrincipal()
       
   102             throws SSLPeerUnverifiedException {
       
   103         return delegate.getPeerPrincipal();
       
   104     }
       
   105 
       
   106     public Principal getLocalPrincipal() {
       
   107         return delegate.getLocalPrincipal();
       
   108     }
       
   109 
       
   110     public String getCipherSuite() {
       
   111         return delegate.getCipherSuite();
       
   112     }
       
   113 
       
   114     public String getProtocol() {
       
   115         return delegate.getProtocol();
       
   116     }
       
   117 
       
   118     public String getPeerHost() {
       
   119         return delegate.getPeerHost();
       
   120     }
       
   121 
       
   122     public int getPeerPort() {
       
   123         return delegate.getPeerPort();
       
   124     }
       
   125 
       
   126     public int getPacketBufferSize() {
       
   127         return delegate.getPacketBufferSize();
       
   128     }
       
   129 
       
   130     public int getApplicationBufferSize() {
       
   131         return delegate.getApplicationBufferSize();
       
   132     }
       
   133 
       
   134     public String[] getLocalSupportedSignatureAlgorithms() {
       
   135         return delegate.getLocalSupportedSignatureAlgorithms();
       
   136     }
       
   137 
       
   138     public String[] getPeerSupportedSignatureAlgorithms() {
       
   139         return delegate.getPeerSupportedSignatureAlgorithms();
       
   140     }
       
   141 
       
   142     public List<SNIServerName> getRequestedServerNames()  {
       
   143         return delegate.getRequestedServerNames();
       
   144     }
       
   145 
       
   146     public List<byte[]> getStatusResponses() {
       
   147         return delegate.getStatusResponses();
       
   148     }
       
   149 }