Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Licensed to the Apache Software Foundation (ASF) under one or more
   * contributor license agreements.  See the NOTICE file distributed with
   * this work for additional information regarding copyright ownership.
   * The ASF licenses this file to You under the Apache License, Version 2.0
   * (the "License"); you may not use this file except in compliance with
   * the License.  You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package javax.websocket;
 
 import java.util.List;
 import java.util.Map;
 
 public interface ClientEndpointConfig extends EndpointConfig {
 
 
 
     public Configurator getConfigurator();
 
     public final class Builder {
 
         private static final Configurator DEFAULT_CONFIGURATOR =
                 new Configurator() {};
 
 
         public static Builder create() {
             return new Builder();
         }
 
 
         private Builder() {
             // Hide default constructor
         }
 
         private Configurator configurator = ;
         private List<StringpreferredSubprotocols = Collections.emptyList();
         private List<Extensionextensions = Collections.emptyList();
         private List<Class<? extends Encoder>> encoders =
                 Collections.emptyList();
         private List<Class<? extends Decoder>> decoders =
                 Collections.emptyList();
 
 
         public ClientEndpointConfig build() {
             return new DefaultClientEndpointConfig(,
                     );
         }
 
 
         public Builder configurator(Configurator configurator) {
             if (configurator == null) {
                 this. = ;
             } else {
                 this. = configurator;
             }
             return this;
         }
 
 
         public Builder preferredSubprotocols(
                 List<StringpreferredSubprotocols) {
             if (preferredSubprotocols == null ||
                     preferredSubprotocols.size() == 0) {
                 this. = Collections.emptyList();
             } else {
                 this. =
                         Collections.unmodifiableList(preferredSubprotocols);
             }
             return this;
         }
 
 
         public Builder extensions(
                 List<Extensionextensions) {
             if (extensions == null || extensions.size() == 0) {
                 this. = Collections.emptyList();
             } else {
                 this. = Collections.unmodifiableList(extensions);
             }
             return this;
         }
 
 
         public Builder encoders(List<Class<? extends Encoder>> encoders) {
             if (encoders == null || encoders.size() == 0) {
                 this. = Collections.emptyList();
             } else {
                 this. = Collections.unmodifiableList(encoders);
            }
            return this;
        }
        public Builder decoders(List<Class<? extends Decoder>> decoders) {
            if (decoders == null || decoders.size() == 0) {
                this. = Collections.emptyList();
            } else {
                this. = Collections.unmodifiableList(decoders);
            }
            return this;
        }
    }
    public class Configurator {

        
Provides the client with a mechanism to inspect and/or modify the headers that are sent to the server to start the WebSocket handshake.

Parameters:
headers The HTTP headers
        public void beforeRequest(Map<StringList<String>> headers) {
            // NO-OP
        }

        
Provides the client with a mechanism to inspect the handshake response that is returned from the server.

Parameters:
handshakeResponse The response
        public void afterResponse(HandshakeResponse handshakeResponse) {
            // NO-OP
        }
    }
New to GrepCode? Check out our FAQ X