Skip to content

Package: EndpointConfig

EndpointConfig

Coverage

1: /*
2: * Copyright (c) 2018, 2019 Oracle and/or its affiliates and others.
3: * All rights reserved.
4: *
5: * This program and the accompanying materials are made available under the
6: * terms of the Eclipse Public License v. 2.0, which is available at
7: * http://www.eclipse.org/legal/epl-2.0.
8: *
9: * This Source Code may also be made available under the following Secondary
10: * Licenses when the conditions for such availability set forth in the
11: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
12: * version 2 with the GNU Classpath Exception, which is available at
13: * https://www.gnu.org/software/classpath/license.html.
14: *
15: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16: */
17:
18: package jakarta.websocket;
19:
20: import java.util.List;
21: import java.util.Map;
22:
23: /**
24: * The endpoint configuration contains all the information needed during the handshake process for this end point. All
25: * endpoints specify, for example, a URI. In the case of a server endpoint, the URI signifies the URI to which the
26: * endpoint will be mapped. In the case of a client application the URI signifies the URI of the server to which the
27: * client endpoint will attempt to connect.
28: *
29: * @author dannycoward
30: */
31: public interface EndpointConfig {
32:
33: /**
34: * Return the Encoder implementation classes configured. These will be instantiated by the container to encode
35: * custom objects passed into the send() methods on remote endpoints.
36: *
37: * @return the encoder implementation classes, an empty list if none.
38: */
39: List<Class<? extends Encoder>> getEncoders();
40:
41: /**
42: * Return the Decoder implementation classes configured. These will be instantiated by the container to decode
43: * incoming messages into the expected custom objects on {@link MessageHandler.Whole#onMessage(Object)} callbacks.
44: *
45: * @return the decoder implementation classes, the empty list if none.
46: */
47: List<Class<? extends Decoder>> getDecoders();
48:
49: /**
50: * This method returns a modifiable Map that the developer may use to store application specific information
51: * relating to the endpoint that uses this configuration instance. Web socket applications running on distributed
52: * implementations of the web container should make any application specific objects stored here
53: * java.io.Serializable, or the object may not be recreated after a failover.
54: *
55: * @return a modifiable Map of application data.
56: */
57: Map<String, Object> getUserProperties();
58: }