diff --git a/websocket/2.0/apidocs/META-INF/MANIFEST.MF b/websocket/2.0/apidocs/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..a41ee1e038 --- /dev/null +++ b/websocket/2.0/apidocs/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: default +Created-By: Apache Maven 3.6.3 +Build-Jdk: 1.8.0_202 + diff --git a/websocket/2.0/apidocs/allclasses-frame.html b/websocket/2.0/apidocs/allclasses-frame.html new file mode 100644 index 0000000000..15daab41e6 --- /dev/null +++ b/websocket/2.0/apidocs/allclasses-frame.html @@ -0,0 +1,69 @@ + + + +
+ + +Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final String |
+SEC_WEBSOCKET_ACCEPT |
+"Sec-WebSocket-Accept" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final String |
+SEC_WEBSOCKET_EXTENSIONS |
+"Sec-WebSocket-Extensions" |
+
+
+public static final String |
+SEC_WEBSOCKET_KEY |
+"Sec-WebSocket-Key" |
+
+
+public static final String |
+SEC_WEBSOCKET_PROTOCOL |
+"Sec-WebSocket-Protocol" |
+
+
+public static final String |
+SEC_WEBSOCKET_VERSION |
+"Sec-WebSocket-Version" |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
By using and/or copying this document, or the Eclipse Foundation + document from which this statement is linked, you (the licensee) agree + that you have read, understood, and will comply with the following + terms and conditions:
+ +Permission to copy, and distribute the contents of this document, or + the Eclipse Foundation document from which this statement is linked, in + any medium for any purpose and without fee or royalty is hereby + granted, provided that you include the following on ALL copies of the + document, or portions thereof, that you use:
+ +Inclusion of the full text of this NOTICE must be provided. We + request that authorship attribution be provided in any software, + documents, or other items or products that you create pursuant to the + implementation of the contents of this document, or any portion + thereof.
+ +No right to create modifications or derivatives of Eclipse Foundation + documents is granted pursuant to this license, except anyone may + prepare and distribute derivative works and portions of this document + in software that implements the specification, in supporting materials + accompanying such software, and in documentation of such software, + PROVIDED that all such works include the notice below. HOWEVER, the + publication of derivative works of this document for use as a technical + specification is expressly prohibited.
+ +The notice is:
+ +"Copyright © 2018, 2020 Eclipse Foundation. This software or + document includes material copied from or derived from + Jakarta ® WebSocket + https://jakarta.ee/specifications/websocket/2.0/"
+ +THIS DOCUMENT IS PROVIDED "AS IS," AND THE COPYRIGHT + HOLDERS AND THE ECLIPSE FOUNDATION MAKE NO REPRESENTATIONS OR + WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, + NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE + SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS + WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR + OTHER RIGHTS.
+ +THE COPYRIGHT HOLDERS AND THE ECLIPSE FOUNDATION WILL NOT BE LIABLE + FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT + OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE + CONTENTS THEREOF.
+ +The name and trademarks of the copyright holders or the Eclipse + Foundation may NOT be used in advertising or publicity pertaining to + this document or its contents without specific, written prior + permission. Title to copyright in this document will at all times + remain with copyright holders.
+ + + diff --git a/websocket/2.0/apidocs/help-doc.html b/websocket/2.0/apidocs/help-doc.html new file mode 100644 index 0000000000..eb3e8704e0 --- /dev/null +++ b/websocket/2.0/apidocs/help-doc.html @@ -0,0 +1,233 @@ + + + + + + +The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.
+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+Each annotation type has its own separate page with the following sections:
+Each enum has its own separate page with the following sections:
+Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object
. The interfaces do not inherit from java.lang.Object
.
The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+These links take you to the next or previous class, interface, package, or related page.
+These links show and hide the HTML frames. All pages are available with or without frames.
+The All Classes link shows all classes and interfaces except non-static nested types.
+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
+The Constant Field Values page lists the static final fields and their values.
+Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
ClientEndpointConfig
objects for the
+ purposes of deploying a client endpoint.null
+ configurator.null
if this exception arose from a failure to decode a text message.ServerEndpointConfig.Configurator
this configuration is using.null
if this exception arose from a failure to decode a binary message..null
if no user is authenticated for this handshake.null
if no user is authenticated for this session.ServerEndpoint
annotation.ServerEndpointConfig.Builder
objects for
+ the purposes of deploying a server endpoint.Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
@Retention(value=RUNTIME) + @Target(value=TYPE) +public @interface ClientEndpoint+
jakarta.websocket.server.ServerEndpoint
, POJOs that are annotated with this
+ annotation can have methods that, using the web socket method level annotations, are web socket lifecycle methods.
+ + For example: + +
+
+ @ClientEndpoint(subprotocols="chat")
+ public class HelloServer {
+
+ @OnMessage
+ public void processMessageFromServer(String message, Session session) {
+ System.out.println("Message came from the server ! " + message);
+ }
+
+ }
+
+
Modifier and Type | +Optional Element and Description | +
---|---|
Class<? extends ClientEndpointConfig.Configurator> |
+configurator
+An optional custom configurator class that the developer would like to use to provide custom configuration of new
+ instances of this endpoint.
+ |
+
Class<? extends Decoder>[] |
+decoders
+The array of Java classes that are to act as Decoders for messages coming into the client.
+ |
+
Class<? extends Encoder>[] |
+encoders
+The array of Java classes that are to act as Encoders for messages sent by the client.
+ |
+
String[] |
+subprotocols
+The names of the subprotocols this client supports.
+ |
+
public abstract String[] subprotocols+
public abstract Class<? extends ClientEndpointConfig.Configurator> configurator+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public static final class ClientEndpointConfig.Builder +extends Object+
ClientEndpointConfig
objects for the
+ purposes of deploying a client endpoint. Here are some examples: Building a plain configuration with no encoders,
+ decoders, subprotocols or extensions.
+ ClientEndpointConfig cec = ClientEndpointConfig.Builder.create().build();
+
+
+ Building a configuration with no subprotocols and a custom configurator.
+
+
+
+ ClientEndpointConfig customCec = ClientEndpointConfig.Builder.create()
+ .preferredSubprotocols(mySubprotocols)
+ .configurator(new MyClientConfigurator())
+ .build();
+
+
Modifier and Type | +Method and Description | +
---|---|
ClientEndpointConfig |
+build()
+Builds a configuration object using the attributes set on this builder.
+ |
+
ClientEndpointConfig.Builder |
+configurator(ClientEndpointConfig.Configurator clientEndpointConfigurator)
+Sets the configurator object for the configuration this builder will build.
+ |
+
static ClientEndpointConfig.Builder |
+create()
+Creates a new builder object with no subprotocols, extensions, encoders, decoders and a
+null
+ configurator. |
+
ClientEndpointConfig.Builder |
+decoders(List<Class<? extends Decoder>> decoders)
+Assign the list of decoder implementation classes the client will use.
+ |
+
ClientEndpointConfig.Builder |
+encoders(List<Class<? extends Encoder>> encoders)
+Assign the list of encoder implementation classes the client will use.
+ |
+
ClientEndpointConfig.Builder |
+extensions(List<Extension> extensions)
+Set the extensions for the configuration this builder will build.
+ |
+
ClientEndpointConfig.Builder |
+preferredSubprotocols(List<String> preferredSubprotocols)
+Set the preferred sub protocols for the configuration this builder will build.
+ |
+
public static ClientEndpointConfig.Builder create()+
null
+ configurator.public ClientEndpointConfig build()+
public ClientEndpointConfig.Builder configurator(ClientEndpointConfig.Configurator clientEndpointConfigurator)+
clientEndpointConfigurator
- the configuratorpublic ClientEndpointConfig.Builder preferredSubprotocols(List<String> preferredSubprotocols)+
preferredSubprotocols
- the preferred subprotocol names.public ClientEndpointConfig.Builder extensions(List<Extension> extensions)+
extensions
- the extensionspublic ClientEndpointConfig.Builder encoders(List<Class<? extends Encoder>> encoders)+
encoders
- the encoder implementation classespublic ClientEndpointConfig.Builder decoders(List<Class<? extends Decoder>> decoders)+
decoders
- the decoder implementation classesComments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public static class ClientEndpointConfig.Configurator +extends Object+
Constructor and Description | +
---|
Configurator() |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+afterResponse(HandshakeResponse hr)
+This method is called by the implementation after it has received a handshake response from the server as a
+ result of a handshake interaction it initiated.
+ |
+
void |
+beforeRequest(Map<String,List<String>> headers)
+This method is called by the implementation after it has formulated the handshake request that will be used
+ to initiate the connection to the server, but before it has sent any part of the request.
+ |
+
public void beforeRequest(Map<String,List<String>> headers)+
headers
- the mutable map of handshake request headers the implementation is about to send to start the
+ handshake interaction.public void afterResponse(HandshakeResponse hr)+
hr
- the handshake response sent by the server.Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public interface ClientEndpointConfig +extends EndpointConfig+
ClientEndpointConfig.Builder
. Developers can override some of the
+ configuration operations by providing an implementation of ClientEndpointConfig.Configurator
.Modifier and Type | +Interface and Description | +
---|---|
static class |
+ClientEndpointConfig.Builder
+The ClientEndpointConfig.Builder is a class used for creating
+ClientEndpointConfig objects for the
+ purposes of deploying a client endpoint. |
+
static class |
+ClientEndpointConfig.Configurator
+The Configurator class may be extended by developers who want to provide custom configuration algorithms, such as
+ intercepting the opening handshake, or providing arbitrary methods and algorithms that can be accessed from each
+ endpoint instance configured with this configurator.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
ClientEndpointConfig.Configurator |
+getConfigurator()
+Return the custom configurator for this configuration.
+ |
+
List<Extension> |
+getExtensions()
+Return the extensions, in order of preference, favorite first, that this client would like to use for its
+ sessions.
+ |
+
List<String> |
+getPreferredSubprotocols()
+Return the ordered list of sub protocols a client endpoint would like to use, in order of preference, favorite
+ first that this client would like to use for its sessions.
+ |
+
getDecoders, getEncoders, getUserProperties
List<String> getPreferredSubprotocols()+
List<Extension> getExtensions()+
ClientEndpointConfig.Configurator getConfigurator()+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public static interface CloseReason.CloseCode
+Modifier and Type | +Method and Description | +
---|---|
int |
+getCode()
+Returns the code number, for example the integer '1000' for normal closure.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public static enum CloseReason.CloseCodes +extends Enum<CloseReason.CloseCodes> +implements CloseReason.CloseCode+
Enum Constant and Description | +
---|
CANNOT_ACCEPT
+1003 indicates that an endpoint is terminating the connection because it has received a type of data it
+ cannot accept (e.g., an endpoint that understands only text data MAY send this if it receives a binary
+ message).
+ |
+
CLOSED_ABNORMALLY
+1006 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint.
+ |
+
GOING_AWAY
+1001 indicates that an endpoint is "going away", such as a server going down or a browser having navigated
+ away from a page.
+ |
+
NO_EXTENSION
+1010 indicates that an endpoint (client) is terminating the connection because it has expected the server to
+ negotiate one or more extension, but the server didn't return them in the response message of the WebSocket
+ handshake.
+ |
+
NO_STATUS_CODE
+1005 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint.
+ |
+
NORMAL_CLOSURE
+1000 indicates a normal closure, meaning that the purpose for which the connection was established has been
+ fulfilled.
+ |
+
NOT_CONSISTENT
+1007 indicates that an endpoint is terminating the connection because it has received data within a message
+ that was not consistent with the type of the message (e.g., non-UTF-8 data within a text message).
+ |
+
PROTOCOL_ERROR
+1002 indicates that an endpoint is terminating the connection due to a protocol error.
+ |
+
RESERVED
+Reserved.
+ |
+
SERVICE_RESTART
+1012 indicates that the service will be restarted.
+ |
+
TLS_HANDSHAKE_FAILURE
+1015 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint.
+ |
+
TOO_BIG
+1009 indicates that an endpoint is terminating the connection because it has received a message that is too
+ big for it to process.
+ |
+
TRY_AGAIN_LATER
+1013 indicates that the service is experiencing overload
+ |
+
UNEXPECTED_CONDITION
+1011 indicates that a server is terminating the connection because it encountered an unexpected condition
+ that prevented it from fulfilling the request.
+ |
+
VIOLATED_POLICY
+1008 indicates that an endpoint is terminating the connection because it has received a message that violates
+ its policy.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
static CloseReason.CloseCode |
+getCloseCode(int code)
+Creates a CloseCode from the given int code number.
+ |
+
int |
+getCode()
+Return the code number of this status code.
+ |
+
static CloseReason.CloseCodes |
+valueOf(String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static CloseReason.CloseCodes[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
public static final CloseReason.CloseCodes NORMAL_CLOSURE+
public static final CloseReason.CloseCodes GOING_AWAY+
public static final CloseReason.CloseCodes PROTOCOL_ERROR+
public static final CloseReason.CloseCodes CANNOT_ACCEPT+
public static final CloseReason.CloseCodes RESERVED+
public static final CloseReason.CloseCodes NO_STATUS_CODE+
public static final CloseReason.CloseCodes CLOSED_ABNORMALLY+
public static final CloseReason.CloseCodes NOT_CONSISTENT+
public static final CloseReason.CloseCodes VIOLATED_POLICY+
public static final CloseReason.CloseCodes TOO_BIG+
public static final CloseReason.CloseCodes NO_EXTENSION+
public static final CloseReason.CloseCodes UNEXPECTED_CONDITION+
public static final CloseReason.CloseCodes SERVICE_RESTART+
public static final CloseReason.CloseCodes TRY_AGAIN_LATER+
public static final CloseReason.CloseCodes TLS_HANDSHAKE_FAILURE+
public static CloseReason.CloseCodes[] values()+
+for (CloseReason.CloseCodes c : CloseReason.CloseCodes.values()) + System.out.println(c); +
public static CloseReason.CloseCodes valueOf(String name)+
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static CloseReason.CloseCode getCloseCode(int code)+
code
- the integer code numberIllegalArgumentException
- if the code is not a valid close codepublic int getCode()+
getCode
in interface CloseReason.CloseCode
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Modifier and Type | +Class and Description | +
---|---|
static interface |
+CloseReason.CloseCode
+A marker interface for the close codes.
+ |
+
static class |
+CloseReason.CloseCodes
+An Enumeration of status codes for a web socket close that are defined in the specification.
+ |
+
Constructor and Description | +
---|
CloseReason(CloseReason.CloseCode closeCode,
+ String reasonPhrase)
+Creates a reason for closing a web socket connection with the given code and reason phrase.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
CloseReason.CloseCode |
+getCloseCode()
+The Close code associated with this CloseReason.
+ |
+
String |
+getReasonPhrase()
+The reason phrase associated with this CloseReason.
+ |
+
String |
+toString()
+Converts the CloseReason to a debug-friendly string.
+ |
+
public CloseReason(CloseReason.CloseCode closeCode, + String reasonPhrase)+
closeCode
- the close code, may not be null
reasonPhrase
- the reason phrase, may be null
.public CloseReason.CloseCode getCloseCode()+
public String getReasonPhrase()+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public abstract class ContainerProvider +extends Object+
Constructor and Description | +
---|
ContainerProvider() |
+
Modifier and Type | +Method and Description | +
---|---|
protected abstract WebSocketContainer |
+getContainer()
+Create a new instance of the the WebSocket container implementation.
+ |
+
static WebSocketContainer |
+getWebSocketContainer()
+Obtain a new instance of a WebSocketContainer.
+ |
+
public static WebSocketContainer getWebSocketContainer()+
null
.ServiceConfigurationError
- If there is a problem loading one of the discovered ContainerProvider
+ implementations. A ServiceConfigurationError is viewed as a serious problem so the exception is allowed
+ to propagate rather than swallowing the exception and attempting to load the next provider (if any).protected abstract WebSocketContainer getContainer()+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public class DecodeException +extends Exception+
Constructor and Description | +
---|
DecodeException(ByteBuffer bb,
+ String message)
+Constructs a DecodedException with the given ByteBuffer that cannot be decoded, and reason why.
+ |
+
DecodeException(ByteBuffer bb,
+ String message,
+ Throwable cause)
+Constructor with the binary data that could not be decoded, and the reason why it failed to be, and the cause.
+ |
+
DecodeException(String encodedString,
+ String message)
+Constructs a DecodedException with the given encoded string that cannot be decoded, and reason why.
+ |
+
DecodeException(String encodedString,
+ String message,
+ Throwable cause)
+Constructor with the text data that could not be decoded, and the reason why it failed to be, and the cause.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
ByteBuffer |
+getBytes()
+Return the ByteBuffer containing either the whole message, or the partial message, that could not be decoded, or
+
+null if this exception arose from a failure to decode a text message. |
+
String |
+getText()
+Return the encoded string that is either the whole message, or the partial message that could not be decoded, or
+
+null if this exception arose from a failure to decode a binary message.. |
+
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public DecodeException(ByteBuffer bb, + String message, + Throwable cause)+
bb
- the byte buffer containing the (part of) the message that could not be decoded.message
- the reason for the failure.cause
- the cause of the error.public DecodeException(String encodedString, + String message, + Throwable cause)+
encodedString
- the string representing the (part of) the message that could not be decoded.message
- the reason for the failure.cause
- the cause of the error.public DecodeException(ByteBuffer bb, + String message)+
bb
- the byte buffer containing the (part of) the message that could not be decoded.message
- the reason for the failure.public DecodeException(String encodedString, + String message)+
encodedString
- the string representing the (part of) the message that could not be decoded.message
- the reason for the failure.public ByteBuffer getBytes()+
null
if this exception arose from a failure to decode a text message.null
for text message failures.public String getText()+
null
if this exception arose from a failure to decode a binary message..null
for binary message failures.Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
T
- The type of the object that is decodedpublic static interface Decoder.Binary<T> +extends Decoder+
Decoder.Binary<T>, Decoder.BinaryStream<T>, Decoder.Text<T>, Decoder.TextStream<T>
Modifier and Type | +Method and Description | +
---|---|
T |
+decode(ByteBuffer bytes)
+Decode the given bytes into an object of type T.
+ |
+
boolean |
+willDecode(ByteBuffer bytes)
+Answer whether the given bytes can be decoded into an object of type T.
+ |
+
T decode(ByteBuffer bytes) + throws DecodeException+
+ It is not safe for other threads to use the ByteBuffer until the decoding of the given bytes is complete. If + the decoding completes successfully, the buffer's limit will be unchanged and the buffer's position + will be equal to the limit. If the decoding does not complete successfully, the state of the buffer is + undefined.
bytes
- the bytes to be decoded.DecodeException
- If the provided bytes cannot be decoded to type Tboolean willDecode(ByteBuffer bytes)+
+ It is not safe for other threads to use the ByteBuffer until this method completes. When the method + completes, the buffer will be in the same state as it was at the start of the method call.
bytes
- the bytes to be decoded.Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
T
- The type of the object that is decodedpublic static interface Decoder.BinaryStream<T> +extends Decoder+
Decoder.Binary<T>, Decoder.BinaryStream<T>, Decoder.Text<T>, Decoder.TextStream<T>
Modifier and Type | +Method and Description | +
---|---|
T |
+decode(InputStream is)
+Decode the given bytes read from the input stream into an object of type T.
+ |
+
T decode(InputStream is) + throws DecodeException, + IOException+
is
- the input stream carrying the bytes.DecodeException
- If the provided input stream cannot be decoded to type TIOException
- If an error occurs reading the input streamComments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
T
- The type of the object that is decodedpublic static interface Decoder.Text<T> +extends Decoder+
Decoder.Binary<T>, Decoder.BinaryStream<T>, Decoder.Text<T>, Decoder.TextStream<T>
Modifier and Type | +Method and Description | +
---|---|
T |
+decode(String s)
+Decode the given String into an object of type T.
+ |
+
boolean |
+willDecode(String s)
+Answer whether the given String can be decoded into an object of type T.
+ |
+
T decode(String s) + throws DecodeException+
s
- string to be decoded.DecodeException
- If the provided string cannot be decoded to type Tboolean willDecode(String s)+
s
- the string being tested for decodability.Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
T
- The type of the object that is decodedpublic static interface Decoder.TextStream<T> +extends Decoder+
Decoder.Binary<T>, Decoder.BinaryStream<T>, Decoder.Text<T>, Decoder.TextStream<T>
Modifier and Type | +Method and Description | +
---|---|
T |
+decode(Reader reader)
+Reads the websocket message from the implementation provided Reader and decodes it into an instance of the
+ supplied object type.
+ |
+
T decode(Reader reader) + throws DecodeException, + IOException+
reader
- the reader from which to read the web socket message.DecodeException
- If the data from the provided reader cannot be decoded to type TIOException
- If an error occurs reading from the readerComments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public interface Decoder
+init(jakarta.websocket.EndpointConfig)
and destroy()
methods.Modifier and Type | +Interface and Description | +
---|---|
static interface |
+Decoder.Binary<T>
+This interface defines how a custom object (of type T) is decoded from a web socket message in the form of a byte
+ buffer.
+ |
+
static interface |
+Decoder.BinaryStream<T>
+This interface defines how a custom object is decoded from a web socket message in the form of a binary stream.
+ |
+
static interface |
+Decoder.Text<T>
+This interface defines how a custom object is decoded from a web socket message in the form of a string.
+ |
+
static interface |
+Decoder.TextStream<T>
+This interface defines how a custom object of type T is decoded from a web socket message in the form of a
+ character stream.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
default void |
+destroy()
+This method is called when the decoder is about to be removed from service in order that any resources the
+ decoder used may be closed gracefully.
+ |
+
default void |
+init(EndpointConfig config)
+This method is called with the endpoint configuration object of the endpoint this decoder is intended for when it
+ is about to be brought into service.
+ |
+
default void init(EndpointConfig config)+
config
- the endpoint configuration object when being brought into servicedefault void destroy()+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public class DeploymentException +extends Exception+
Constructor and Description | +
---|
DeploymentException(String message)
+Creates a deployment exception with the given reason for the deployment failure.
+ |
+
DeploymentException(String message,
+ Throwable cause)
+Creates a deployment exception with the given reason for the deployment failure and wrapped cause of the failure.
+ |
+
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public class EncodeException +extends Exception+
Constructor and Description | +
---|
EncodeException(Object object,
+ String message)
+Constructor with the object being encoded, and the reason why it failed to be.
+ |
+
EncodeException(Object object,
+ String message,
+ Throwable cause)
+Constructor with the object being encoded, and the reason why it failed to be, and the cause.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
Object |
+getObject()
+Return the Object that could not be encoded.
+ |
+
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public EncodeException(Object object, + String message)+
object
- the object that could not be encoded.message
- the reason for the failure.public EncodeException(Object object, + String message, + Throwable cause)+
object
- the object that could not be encoded.message
- the reason for the failure.cause
- the cause of the problem.Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
T
- The type of the custom object that this Encoder can encoder to a ByteBuffer.public static interface Encoder.Binary<T> +extends Encoder+
Encoder.Binary<T>, Encoder.BinaryStream<T>, Encoder.Text<T>, Encoder.TextStream<T>
Modifier and Type | +Method and Description | +
---|---|
ByteBuffer |
+encode(T object)
+Encode the given object into a byte array.
+ |
+
ByteBuffer encode(T object) + throws EncodeException+
object
- the object being encoded.EncodeException
- The provided object could not be encoded to a byte bufferComments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
T
- the type of the object this encoder can encode.public static interface Encoder.BinaryStream<T> +extends Encoder+
Encoder.Binary<T>, Encoder.BinaryStream<T>, Encoder.Text<T>, Encoder.TextStream<T>
Modifier and Type | +Method and Description | +
---|---|
void |
+encode(T object,
+ OutputStream os)
+Encode the given object into a binary stream written to the implementation provided OutputStream.
+ |
+
void encode(T object, + OutputStream os) + throws EncodeException, + IOException+
object
- the object being encoded.os
- the output stream where the encoded data is written.EncodeException
- The provided object could not be encoded to an output streamIOException
- If an error occurred writing to the output streamComments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
T
- The type of the custom developer object that this Encoder can encode into a String.public static interface Encoder.Text<T> +extends Encoder+
Encoder.Binary<T>, Encoder.BinaryStream<T>, Encoder.Text<T>, Encoder.TextStream<T>
Modifier and Type | +Method and Description | +
---|---|
String |
+encode(T object)
+Encode the given object into a String.
+ |
+
String encode(T object) + throws EncodeException+
object
- the object being encoded.EncodeException
- The provided object could not be encoded as a stringComments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
T
- the type of the object this encoder can encode to a CharacterStream.public static interface Encoder.TextStream<T> +extends Encoder+
Encoder.Binary<T>, Encoder.BinaryStream<T>, Encoder.Text<T>, Encoder.TextStream<T>
Modifier and Type | +Method and Description | +
---|---|
void |
+encode(T object,
+ Writer writer)
+Encode the given object to a character stream writing it to the supplied Writer.
+ |
+
void encode(T object, + Writer writer) + throws EncodeException, + IOException+
object
- the object to be encoded.writer
- the writer provided by the web socket runtime to write the encoded data.EncodeException
- if there was an error encoding the object due to its state.IOException
- if there was an exception writing to the writer.Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public interface Encoder
+init(jakarta.websocket.EndpointConfig)
and destroy()
methods.Modifier and Type | +Interface and Description | +
---|---|
static interface |
+Encoder.Binary<T>
+This interface defines how to provide a way to convert a custom object into a binary message.
+ |
+
static interface |
+Encoder.BinaryStream<T>
+This interface may be implemented by encoding algorithms that want to write the encoded object to a binary
+ stream.
+ |
+
static interface |
+Encoder.Text<T>
+This interface defines how to provide a way to convert a custom object into a text message.
+ |
+
static interface |
+Encoder.TextStream<T>
+This interface may be implemented by encoding algorithms that want to write the encoded object to a character
+ stream.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
default void |
+destroy()
+This method is called when the encoder is about to be removed from service in order that any resources the
+ encoder used may be closed gracefully.
+ |
+
default void |
+init(EndpointConfig config)
+This method is called with the endpoint configuration object of the endpoint this encoder is intended for when it
+ is about to be brought into service.
+ |
+
default void init(EndpointConfig config)+
config
- the endpoint configuration object when being brought into servicedefault void destroy()+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public abstract class Endpoint +extends Object+
onOpen
method, the programmatic
+ endpoint gains access to the Session
object, to which the developer may add MessageHandler
+ implementations in order to intercept incoming websocket messages. Each instance of a websocket endpoint is
+ guaranteed not to be called by more than one thread at a time per active connection.
+
+ + If deployed as a client endpoint, it will be instantiated once for the single connection to the server. + +
+ When deployed as a server endpoint, the implementation uses the
+ jakarta.websocket.server.ServerEndpointConfig.Configurator#getEndpointInstance
method to obtain the endpoint
+ instance it will use for each new client connection. If the developer uses the default
+ jakarta.websocket.server.ServerEndpointConfig.Configurator
, there will be precisely one endpoint instance per
+ active client connection. Consequently, in this typical case, when implementing/overriding the methods of Endpoint,
+ the developer is guaranteed that there will be at most one thread calling each endpoint instance at a time.
+
+
+ If the developer provides a custom jakarta.websocket.server.ServerEndpointConfig.Configurator
which overrides
+ the default policy for endpoint instance creation, for example, using a single Endpoint instance for multiple client
+ connections, the developer may need to write code that can execute concurrently.
+
+
+ Here is an example of a simple endpoint that echoes any incoming text message back to the sender. + +
+
+ public class EchoServer extends Endpoint {
+
+ public void onOpen(Session session, EndpointConfig config) {
+ final RemoteEndpoint remote = session.getBasicRemote();
+ session.addMessageHandler(String.class, new MessageHandler.Whole<String<() {
+ public void onMessage(String text) {
+ try {
+ remote.sendString("Got your message (" + text + "). Thanks !");
+ } catch (IOException ioe) {
+ // handle send failure here
+ }
+ }
+ });
+ }
+
+ }
+
+
Modifier and Type | +Method and Description | +
---|---|
void |
+onClose(Session session,
+ CloseReason closeReason)
+This method is called immediately prior to the session with the remote peer being closed.
+ |
+
void |
+onError(Session session,
+ Throwable thr)
+Developers may implement this method when the web socket session creates some kind of error that is not modeled
+ in the web socket protocol.
+ |
+
abstract void |
+onOpen(Session session,
+ EndpointConfig config)
+Developers must implement this method to be notified when a new conversation has just begun.
+ |
+
public abstract void onOpen(Session session, + EndpointConfig config)+
+ Note: +
MessageHandler
s from this method. No messages will be
+ mapped to the appropriate MessageHandler
until this method has completed.session
- the session that has just been activated.config
- the configuration used to configure this endpoint.public void onClose(Session session, + CloseReason closeReason)+
session
- the session about to be closed.closeReason
- the reason the session was closed.public void onError(Session session, + Throwable thr)+
+ There are a number of categories of exception that this method is (currently) defined to handle: +
SessionException
sDecodeException
ssession
- the session in use when the error occurs.thr
- the throwable representing the problem.Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public interface EndpointConfig
+Modifier and Type | +Method and Description | +
---|---|
List<Class<? extends Decoder>> |
+getDecoders()
+Return the Decoder implementation classes configured.
+ |
+
List<Class<? extends Encoder>> |
+getEncoders()
+Return the Encoder implementation classes configured.
+ |
+
Map<String,Object> |
+getUserProperties()
+This method returns a modifiable Map that the developer may use to store application specific information
+ relating to the endpoint that uses this configuration instance.
+ |
+
List<Class<? extends Encoder>> getEncoders()+
List<Class<? extends Decoder>> getDecoders()+
MessageHandler.Whole.onMessage(Object)
callbacks.Map<String,Object> getUserProperties()+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public static interface Extension.Parameter
+Modifier and Type | +Method and Description | +
---|---|
String |
+getName()
+Return the name of the extension parameter.
+ |
+
String |
+getValue()
+Return the value of the extension parameter.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public interface Extension
+Modifier and Type | +Interface and Description | +
---|---|
static interface |
+Extension.Parameter
+This member interface defines a single websocket extension parameter.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
String |
+getName()
+The name of the extension.
+ |
+
List<Extension.Parameter> |
+getParameters()
+The extension parameters for this extension in the order they appear in the http headers.
+ |
+
String getName()+
List<Extension.Parameter> getParameters()+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public interface HandshakeResponse
+Modifier and Type | +Field and Description | +
---|---|
static String |
+SEC_WEBSOCKET_ACCEPT
+The Sec-WebSocket-Accept header name.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
Map<String,List<String>> |
+getHeaders()
+Return the map of HTTP headers to header values sent by the WebSocket server.
+ |
+
static final String SEC_WEBSOCKET_ACCEPT+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
T
- The type of the object that represent pieces of the incoming message that this MessageHandler will
+ consume.public static interface MessageHandler.Partial<T> +extends MessageHandler+
+ For handling parts of text messages, the type T is String
+
+
+ For handling parts of binary messages, the allowable types for T are +
ByteBuffer
+ Developers should not continue to reference message objects of type ByteBuffer
after the
+ completion of the onMessage() call, since they may be recycled by the implementation.
+
+
+ Note: Implementations may choose their own schemes for delivering large messages in smaller parts through this + API. These schemes may or may not bear a relationship to the underlying websocket dataframes in which the message + is received off the wire.
MessageHandler.Partial<T>, MessageHandler.Whole<T>
Modifier and Type | +Method and Description | +
---|---|
void |
+onMessage(T partialMessage,
+ boolean last)
+Called when the next part of a message has been fully received.
+ |
+
void onMessage(T partialMessage, + boolean last)+
partialMessage
- the partial message data.last
- flag to indicate if this partialMessage is the last of the whole message being
+ delivered.Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
T
- The type of the message object that this MessageHandler will consume.public static interface MessageHandler.Whole<T> +extends MessageHandler+
+ For handling incoming text messages, the allowed types for T are +
String
Reader
Decoder.Text
or Decoder.TextStream
+ configured+ For handling incoming binary messages, the allowed types for T are +
ByteBuffer
InputStream
Decoder.Binary
or
+ Decoder.BinaryStream
configured
+
+ For handling incoming pong messages, the type of T is PongMessage
+
+
+ Developers should not continue to reference message objects of type Reader
,
+ ByteBuffer
or InputStream
after the completion of the onMessage() call, since
+ they may be recycled by the implementation.
MessageHandler.Partial<T>, MessageHandler.Whole<T>
Modifier and Type | +Method and Description | +
---|---|
void |
+onMessage(T message)
+Called when the message has been fully received.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public interface MessageHandler
+
+ See Endpoint
for a usage example.
Modifier and Type | +Interface and Description | +
---|---|
static interface |
+MessageHandler.Partial<T>
+This kind of handler is notified by the implementation as it becomes ready to deliver parts of a whole message.
+ |
+
static interface |
+MessageHandler.Whole<T>
+This kind of handler is notified by the container on arrival of a complete message.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
@Retention(value=RUNTIME) + @Target(value=METHOD) +public @interface OnClose+
+ The method may only take the following parameters:- +
Session
parameterCloseReason
parameterjakarta.websocket.server.PathParam
annotation.
+ The parameters may appear in any order. See Endpoint.onClose(jakarta.websocket.Session, jakarta.websocket.CloseReason)
for more details on how the session parameter
+ may be used during method calls annotated with this annotation.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
@Retention(value=RUNTIME) + @Target(value=METHOD) +public @interface OnError+
Endpoint.onError(jakarta.websocket.Session, java.lang.Throwable)
for a description of the different categories of error.
+
+ + The method may only take the following parameters:- +
Session
parameterThrowable
parameterjakarta.websocket.server.PathParam
annotation+ The parameters may appear in any order.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
@Retention(value=RUNTIME) + @Target(value=METHOD) +public @interface OnMessage+
+ The allowed parameters are: +
String
to receive the whole messageReader
to receive the whole message as a blocking streamDecoder.Text
or
+ Decoder.TextStream
).ByteBuffer
to receive the whole messageByteBuffer
and boolean pair to receive the message in partsInputStream
to receive the whole message as a blocking streamDecoder.Binary
or
+ Decoder.BinaryStream
).PongMessage
for handling pong messagesjakarta.websocket.server.PathParam
+ annotation for server endpoints.Session
parameter+ The parameters may be listed in any order. + +
+ The method may have a non-void return type, in which case the web socket runtime must interpret this as a web socket + message to return to the peer. The allowed data types for this return type, other than void, are String, ByteBuffer, + byte[], any Java primitive or class equivalent, and anything for which there is an encoder. If the method uses a Java + primitive as a return value, the implementation must construct the text message to send using the standard Java + string representation of the Java primitive unless there developer provided encoder for the type configured for this + endpoint, in which case that encoder must be used. If the method uses a class equivalent of a Java primitive as a + return value, the implementation must construct the text message from the Java primitive equivalent as described + above. + +
+ Developers should note that if developer closes the session during the invocation of a method with a return type, the + method will complete but the return value will not be delivered to the remote endpoint. The send failure will be + passed back into the endpoint's error handling method. + +
+ For example: + +
+
+ @OnMessage
+ public void processGreeting(String message, Session session) {
+ System.out.println("Greeting received:" + message);
+ }
+
+
+
+ For example:
+
+
+
+ @OnMessage
+ public void processUpload(byte[] b, boolean last, Session session) {
+ // process partial data here, which check on last to see if these is more on the way
+ }
+
+
+
+ Developers should not continue to reference message objects of type Reader
,
+ ByteBuffer
or InputStream
after the annotated method has completed, since they may
+ be recycled by the implementation.Modifier and Type | +Optional Element and Description | +
---|---|
long |
+maxMessageSize
+Specifies the maximum size of message in bytes that the method this annotates will be able to process, or -1 to
+ indicate that there is no maximum.
+ |
+
public abstract long maxMessageSize+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
@Retention(value=RUNTIME) + @Target(value=METHOD) +public @interface OnOpen+
+ The method may only take the following parameters:- +
Session
parameterEndpointConfig
parameterjakarta.websocket.server.PathParam
annotation.+ The parameters may appear in any order.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public interface PongMessage
+MessageHandler.Basic<PongMessage>
. The payload of the PongMessage is the application data sent by the peer.Modifier and Type | +Method and Description | +
---|---|
ByteBuffer |
+getApplicationData()
+The application data inside the pong message from the peer.
+ |
+
ByteBuffer getApplicationData()+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public static interface RemoteEndpoint.Async +extends RemoteEndpoint+
RemoteEndpoint.Async, RemoteEndpoint.Basic
Modifier and Type | +Method and Description | +
---|---|
long |
+getSendTimeout()
+Return the number of milliseconds the implementation will timeout attempting to send a websocket message.
+ |
+
Future<Void> |
+sendBinary(ByteBuffer data)
+Initiates the asynchronous transmission of a binary message.
+ |
+
void |
+sendBinary(ByteBuffer data,
+ SendHandler handler)
+Initiates the asynchronous transmission of a binary message.
+ |
+
Future<Void> |
+sendObject(Object data)
+Initiates the asynchronous transmission of a custom developer object.
+ |
+
void |
+sendObject(Object data,
+ SendHandler handler)
+Initiates the asynchronous transmission of a custom developer object.
+ |
+
Future<Void> |
+sendText(String text)
+Initiates the asynchronous transmission of a text message.
+ |
+
void |
+sendText(String text,
+ SendHandler handler)
+Initiates the asynchronous transmission of a text message.
+ |
+
void |
+setSendTimeout(long timeoutmillis)
+Sets the number of milliseconds the implementation will timeout attempting to send a websocket message.
+ |
+
flushBatch, getBatchingAllowed, sendPing, sendPong, setBatchingAllowed
long getSendTimeout()+
void setSendTimeout(long timeoutmillis)+
timeoutmillis
- The number of milliseconds this RemoteEndpoint will wait before timing out an incomplete
+ asynchronous message send.void sendText(String text, + SendHandler handler)+
text
- the text being sent.handler
- the handler which will be notified of progress.IllegalArgumentException
- if the text or the handler is null
.Future<Void> sendText(String text)+
null
upon successful completion. Errors in transmission are wrapped in the
+ ExecutionException
thrown when querying the Future object.text
- the text being sent.IllegalArgumentException
- if the text is null
.Future<Void> sendBinary(ByteBuffer data)+
null
upon successful completion. Errors in transmission are wrapped in the
+ ExecutionException
thrown when querying the Future object.
+ + It is not safe for other threads to use the ByteBuffer until the sending of this message is complete. If the + sending of the message completes successfully, the buffer's limit will be unchanged and the buffer's position + will be equal to the limit. If the sending of the message does not complete successfully, the state of the + buffer is undefined.
data
- the data being sent.IllegalArgumentException
- if the data is null
.void sendBinary(ByteBuffer data, + SendHandler handler)+
+ It is not safe for other threads to use the ByteBuffer until the sending of this message is complete. If the + sending of the message completes successfully, the buffer's limit will be unchanged and the buffer's position + will be equal to the limit. If the sending of the message does not complete successfully, the state of the + buffer is undefined.
data
- the data being sent, must not be null
.handler
- the handler that will be notified of progress, must not be null
.IllegalArgumentException
- if either the data or the handler are null
.Future<Void> sendObject(Object data)+
null
upon successful completion. Errors in transmission are wrapped
+ in the ExecutionException
thrown when querying the Future object.data
- the object being sent.IllegalArgumentException
- if the data is null
.void sendObject(Object data, + SendHandler handler)+
data
- the object being sent.handler
- the handler that will be notified of progress, must not be null
.IllegalArgumentException
- if either the data or the handler are null
.Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public static interface RemoteEndpoint.Basic +extends RemoteEndpoint+
getSendStream
and
+ getSendWriter
which present traditional blocking I/O streams to
+ write messages.
+
+
+ If the websocket connection underlying this RemoteEndpoint is busy sending a message when a call is made to send
+ another one, for example if two threads attempt to call a send method concurrently, or if a developer attempts to
+ send a new message while in the middle of sending an existing one, the send method called while the connection is
+ already busy may throw an IllegalStateException
.
RemoteEndpoint.Async, RemoteEndpoint.Basic
Modifier and Type | +Method and Description | +
---|---|
OutputStream |
+getSendStream()
+Opens an output stream on which a binary message may be sent.
+ |
+
Writer |
+getSendWriter()
+Opens a character stream on which a text message may be sent.
+ |
+
void |
+sendBinary(ByteBuffer data)
+Send a binary message, returning when all of the message has been transmitted.
+ |
+
void |
+sendBinary(ByteBuffer partialByte,
+ boolean isLast)
+Send a binary message in parts, blocking until all of the message has been transmitted.
+ |
+
void |
+sendObject(Object data)
+Sends a custom developer object, blocking until it has been transmitted.
+ |
+
void |
+sendText(String text)
+Send a text message, blocking until all of the message has been transmitted.
+ |
+
void |
+sendText(String partialMessage,
+ boolean isLast)
+Send a text message in parts, blocking until all of the message has been transmitted.
+ |
+
flushBatch, getBatchingAllowed, sendPing, sendPong, setBatchingAllowed
void sendText(String text) + throws IOException+
text
- the message to be sent.IOException
- if there is a problem delivering the message.IllegalArgumentException
- if the text is null
.void sendBinary(ByteBuffer data) + throws IOException+
+ It is not safe for other threads to use the ByteBuffer until the sending of this message is complete. If the + sending of the message completes successfully, the buffer's limit will be unchanged and the buffer's position + will be equal to the limit. If the sending of the message does not complete successfully, the state of the + buffer is undefined.
data
- the message to be sent.IOException
- if there is a problem delivering the message.IllegalArgumentException
- if the data is null
.void sendText(String partialMessage, + boolean isLast) + throws IOException+
partialMessage
- the parts of the message being sent.isLast
- Whether the partial message being sent is the last part of the message.IOException
- if there is a problem delivering the message fragment.IllegalArgumentException
- if the partialMessage is null
.void sendBinary(ByteBuffer partialByte, + boolean isLast) + throws IOException+
+ It is not safe for other threads to use the ByteBuffer until the sending of this partial message is complete. + If the sending of the partial message completes successfully, the buffer's limit will be unchanged and the + buffer's position will be equal to the limit. If the sending of the partial message does not complete + successfully, the state of the buffer is undefined.
partialByte
- the part of the message being sent.isLast
- Whether the partial message being sent is the last part of the message.IOException
- if there is a problem delivering the partial message.IllegalArgumentException
- if the partialByte is null
.OutputStream getSendStream() + throws IOException+
write()
methods before the output stream is closed then no WebSocket binary messages will
+ be sent. If at least one call is made to one of the write()
methods before the output stream is
+ closed then at least one WebSocket binary message will be sent even if that message is of zero length.IOException
- if there is a problem obtaining the OutputStream to write the binary message.Writer getSendWriter() + throws IOException+
write()
or append()
methods before the writer is closed then no WebSocket text messages
+ will be sent. If at least one call is made to one of the write()
or append()
methods before
+ the writer is closed then at least one WebSocket text message will be sent even if that message is of zero
+ length.IOException
- if there is a problem obtaining the Writer to write the text message.void sendObject(Object data) + throws IOException, + EncodeException+
data
- the object to be sent.IOException
- if there is a communication error sending the message object.EncodeException
- if there was a problem encoding the message object into the form of a native
+ websocket message.IllegalArgumentException
- if the data parameter is null
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public interface RemoteEndpoint
+Session.getBasicRemote()
or
+ Session.getAsyncRemote()
. Objects of this kind include numerous ways to send web socket messages. There are
+ two kinds of RemoteEndpoint objects: RemoteEndpoint.Basic for synchronous sending of websocket messages, and
+ RemoteEndpoint.Async for sending messages asynchronously.
+
+ + There is no guarantee of the successful delivery of a web socket message to the peer, but if the action of sending a + message causes an error known to the container, the API throws it. RemoteEndpoints include a variety of ways to send + messages: by whole message, in parts, and in various data formats including websocket pings and pongs. + +
+ Implementations may or may not support batching of messages. More detail of the expected semantics of implementations
+ that do support batching are laid out in setBatchingAllowed(boolean)
.
+
+
+ Note: Implementations may choose their own schemes for sending large messages in smaller parts. These schemes may or + may not bear a relationship to the underlying websocket dataframes in which the message is ultimately sent on the + wire. + +
+ If the underlying connection is closed and methods on the RemoteEndpoint are attempted to be called, they will result + in an error being generated. For the methods that send messages, this will be an IOException, for the methods that + alter configuration of the endpoint, this will be runtime IllegalArgumentExceptions.
Modifier and Type | +Interface and Description | +
---|---|
static interface |
+RemoteEndpoint.Async
+This representation of the peer of a web socket conversation has the ability to send messages asynchronously.
+ |
+
static interface |
+RemoteEndpoint.Basic
+This representation of the peer of a web socket conversation has the ability to send messages synchronously.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+flushBatch()
+This method is only used when batching is allowed for this RemoteEndpint.
+ |
+
boolean |
+getBatchingAllowed()
+Return whether the implementation is allowed to batch outgoing messages before sending.
+ |
+
void |
+sendPing(ByteBuffer applicationData)
+Send a Ping message containing the given application data to the remote endpoint.
+ |
+
void |
+sendPong(ByteBuffer applicationData)
+Allows the developer to send an unsolicited Pong message containing the given application data in order to serve
+ as a unidirectional heartbeat for the session.
+ |
+
void |
+setBatchingAllowed(boolean allowed)
+Indicate to the implementation that it is allowed to batch outgoing messages before sending.
+ |
+
void setBatchingAllowed(boolean allowed) + throws IOException+
allowed
- whether the implementation is allowed to batch messages.IOException
- if batching is being disabled and there are unsent messages this error may be thrown as the
+ implementation sends the batch of unsent messages if there is a problem.boolean getBatchingAllowed()+
setBatchingAllowed
.true
if the implementation is allowed to batch outgoing messages before sending, otherwise
+ false
void flushBatch() + throws IOException+
IOException
- if the sending of any unsent messages failedvoid sendPing(ByteBuffer applicationData) + throws IOException, + IllegalArgumentException+
+ It is not safe for other threads to use the ByteBuffer until the sending of this message is complete. If the + sending of the message completes successfully, the buffer's limit will be unchanged and the buffer's position + will be equal to the limit. If the sending of the message does not complete successfully, the state of the buffer + is undefined.
applicationData
- the data to be carried in the ping request.IOException
- if the ping failed to be sentIllegalArgumentException
- if the applicationData exceeds the maximum allowed payload of 125 bytesvoid sendPong(ByteBuffer applicationData) + throws IOException, + IllegalArgumentException+
+ It is not safe for other threads to use the ByteBuffer until the sending of this message is complete. If the + sending of the message completes successfully, the buffer's limit will be unchanged and the buffer's position + will be equal to the limit. If the sending of the message does not complete successfully, the state of the buffer + is undefined.
applicationData
- the application data to be carried in the pong response.IOException
- if the pong failed to be sentIllegalArgumentException
- if the applicationData exceeds the maximum allowed payload of 125 bytesComments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public interface SendHandler
+Modifier and Type | +Method and Description | +
---|---|
void |
+onResult(SendResult result)
+Called once the message has been transmitted.
+ |
+
void onResult(SendResult result)+
result
- the result.Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public final class SendResult +extends Object+
Constructor and Description | +
---|
SendResult()
+Construct a SendResult signifying a successful send carrying no exception.
+ |
+
SendResult(Throwable exception)
+Construct a SendResult carrying an exception.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
Throwable |
+getException()
+The problem sending the message.
+ |
+
boolean |
+isOK()
+Determines if this result is ok or not.
+ |
+
public SendResult(Throwable exception)+
exception
- the exception causing a send failure.public SendResult()+
public Throwable getException()+
null
if the send was successful.public boolean isOK()+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public interface Session +extends Closeable+
+ Once the session is closed, it is no longer valid for use by applications. Calling any of its methods (with the
+ exception of the close() methods) once the session has been closed will result in an
+ IllegalStateException
being thrown. Developers should retrieve any information from the session
+ during the Endpoint.onClose(jakarta.websocket.Session, jakarta.websocket.CloseReason)
method. Following the convention of Closeable
calling the Session
+ close() methods after the Session has been closed has no effect.
+
+ Session objects may be called by multiple threads. Implementations must ensure the integrity of the mutable + properties of the session under such circumstances.
Modifier and Type | +Method and Description | +
---|---|
<T> void |
+addMessageHandler(Class<T> clazz,
+ MessageHandler.Partial<T> handler)
+Register to handle to incoming messages in this conversation.
+ |
+
<T> void |
+addMessageHandler(Class<T> clazz,
+ MessageHandler.Whole<T> handler)
+Register to handle to incoming messages in this conversation.
+ |
+
void |
+addMessageHandler(MessageHandler handler)
+Register to handle to incoming messages in this conversation.
+ |
+
void |
+close()
+Close the current conversation with a normal status code and no reason phrase.
+ |
+
void |
+close(CloseReason closeReason)
+Close the current conversation, giving a reason for the closure.
+ |
+
RemoteEndpoint.Async |
+getAsyncRemote()
+Return a reference a RemoteEndpoint object representing the peer of this conversation that is able to send
+ messages asynchronously to the peer.
+ |
+
RemoteEndpoint.Basic |
+getBasicRemote()
+Return a reference a RemoteEndpoint object representing the peer of this conversation that is able to send
+ messages synchronously to the peer.
+ |
+
WebSocketContainer |
+getContainer()
+Return the container that this session is part of.
+ |
+
String |
+getId()
+Returns a string containing the unique identifier assigned to this session.
+ |
+
int |
+getMaxBinaryMessageBufferSize()
+The maximum length of incoming binary messages that this Session can buffer.
+ |
+
long |
+getMaxIdleTimeout()
+Return the number of milliseconds before this conversation may be closed by the container if it is inactive, i.e.
+ |
+
int |
+getMaxTextMessageBufferSize()
+The maximum length of incoming text messages that this Session can buffer.
+ |
+
Set<MessageHandler> |
+getMessageHandlers()
+Return an unmodifiable copy of the set of MessageHandlers for this Session.
+ |
+
List<Extension> |
+getNegotiatedExtensions()
+Return the list of extensions currently in use for this conversation.
+ |
+
String |
+getNegotiatedSubprotocol()
+Return the sub protocol agreed during the websocket handshake for this conversation.
+ |
+
Set<Session> |
+getOpenSessions()
+Return a copy of the Set of all the open web socket sessions that represent connections to the same endpoint to
+ which this session represents a connection.
+ |
+
Map<String,String> |
+getPathParameters()
+Return a map of the path parameter names and values used associated with the request this session was opened
+ under.
+ |
+
String |
+getProtocolVersion()
+Returns the version of the websocket protocol currently being used.
+ |
+
String |
+getQueryString()
+Return the query string associated with the request this session was opened under.
+ |
+
Map<String,List<String>> |
+getRequestParameterMap()
+Return the request parameters associated with the request this session was opened under.
+ |
+
URI |
+getRequestURI()
+Return the URI under which this session was opened, including the query string if there is one.
+ |
+
Principal |
+getUserPrincipal()
+Return the authenticated user for this Session or
+null if no user is authenticated for this session. |
+
Map<String,Object> |
+getUserProperties()
+While the session is open, this method returns a Map that the developer may use to store application specific
+ information relating to this session instance.
+ |
+
boolean |
+isOpen()
+Return true if and only if the underlying socket is open.
+ |
+
boolean |
+isSecure()
+Return true if and only if the underlying socket is using a secure transport.
+ |
+
void |
+removeMessageHandler(MessageHandler handler)
+Remove the given MessageHandler from the set belonging to this session.
+ |
+
void |
+setMaxBinaryMessageBufferSize(int length)
+Sets the maximum length of incoming binary messages that this Session can buffer.
+ |
+
void |
+setMaxIdleTimeout(long milliseconds)
+Set the non-zero number of milliseconds before this session will be closed by the container if it is inactive, ie
+ no messages are either sent or received.
+ |
+
void |
+setMaxTextMessageBufferSize(int length)
+Sets the maximum length of incoming text messages that this Session can buffer.
+ |
+
WebSocketContainer getContainer()+
void addMessageHandler(MessageHandler handler) + throws IllegalStateException+
MessageHandler.Whole
and MessageHandler.Partial
.
+ Adding more than one of any one type will result in a runtime exception.
+
+ This method is not safe to use unless you are providing an anonymous class derived directly from
+ MessageHandler.Whole
or MessageHandler.Partial
. In all other
+ cases (Lambda Expressions, more complex inheritance or generic type arrangements), one of the following methods
+ have to be used: addMessageHandler(Class, jakarta.websocket.MessageHandler.Whole)
or
+ addMessageHandler(Class, jakarta.websocket.MessageHandler.Partial)
.
handler
- the MessageHandler to be added.IllegalStateException
- if there is already a MessageHandler registered for the same native websocket
+ message type as this handler.<T> void addMessageHandler(Class<T> clazz, + MessageHandler.Whole<T> handler)+
MessageHandler.Whole
and MessageHandler.Partial
.
+ Adding more than one of any one type will result in a runtime exception.T
- type of message that the given handler is intended for.clazz
- type of the message processed by message handler to be registered.handler
- whole message handler to be added.IllegalStateException
- if there is already a MessageHandler registered for the same native websocket
+ message type as this handler.<T> void addMessageHandler(Class<T> clazz, + MessageHandler.Partial<T> handler)+
MessageHandler.Whole
and MessageHandler.Partial
.
+ Adding more than one of any one type will result in a runtime exception.T
- type of message that the given handler is intended for.clazz
- type of the message processed by message handler to be registered.handler
- partial message handler to be added.IllegalStateException
- if there is already a MessageHandler registered for the same native websocket
+ message type as this handler.Set<MessageHandler> getMessageHandlers()+
void removeMessageHandler(MessageHandler handler)+
handler
- the handler to be removed.String getProtocolVersion()+
String getNegotiatedSubprotocol()+
List<Extension> getNegotiatedExtensions()+
boolean isSecure()+
boolean isOpen()+
long getMaxIdleTimeout()+
void setMaxIdleTimeout(long milliseconds)+
milliseconds
- the number of milliseconds.void setMaxBinaryMessageBufferSize(int length)+
length
- the maximum length.int getMaxBinaryMessageBufferSize()+
CloseReason.CloseCodes.TOO_BIG
.void setMaxTextMessageBufferSize(int length)+
length
- the maximum length.int getMaxTextMessageBufferSize()+
CloseReason.CloseCodes.TOO_BIG
.RemoteEndpoint.Async getAsyncRemote()+
RemoteEndpoint.Basic getBasicRemote()+
String getId()+
void close() + throws IOException+
close
in interface AutoCloseable
close
in interface Closeable
IOException
- if there was a connection error closing the connection.void close(CloseReason closeReason) + throws IOException+
CloseReason.CloseCodes.NO_STATUS_CODE
.closeReason
- the reason for the closure.IOException
- if there was a connection error closing the connectionURI getRequestURI()+
Map<String,List<String>> getRequestParameterMap()+
String getQueryString()+
Map<String,String> getPathParameters()+
Map<String,Object> getUserProperties()+
Principal getUserPrincipal()+
null
if no user is authenticated for this session.Set<Session> getOpenSessions()+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public class SessionException +extends Exception+
Constructor and Description | +
---|
SessionException(String message,
+ Throwable cause,
+ Session session)
+Creates a new instance of this exception with the given message, the wrapped cause of the exception and the
+ session with which the problem is associated.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
Session |
+getSession()
+Return the Session on which the problem occurred.
+ |
+
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public SessionException(String message, + Throwable cause, + Session session)+
message
- a description of the problemcause
- the error that caused the problemsession
- the session on which the problem occurred.Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public interface WebSocketContainer
++ A WebSocketContainer may be accessed by concurrent threads, so implementations must ensure the integrity of its + mutable attributes in such circumstances.
Modifier and Type | +Method and Description | +
---|---|
Session |
+connectToServer(Class<?> annotatedEndpointClass,
+ URI path)
+Connect the supplied annotated endpoint to its server.
+ |
+
Session |
+connectToServer(Class<? extends Endpoint> endpointClass,
+ ClientEndpointConfig cec,
+ URI path)
+Connect the supplied programmatic endpoint to its server with the given configuration.
+ |
+
Session |
+connectToServer(Endpoint endpointInstance,
+ ClientEndpointConfig cec,
+ URI path)
+Connect the supplied programmatic client endpoint instance to its server with the given configuration.
+ |
+
Session |
+connectToServer(Object annotatedEndpointInstance,
+ URI path)
+Connect the supplied annotated endpoint instance to its server.
+ |
+
long |
+getDefaultAsyncSendTimeout()
+Return the number of milliseconds the implementation will timeout attempting to send a websocket message for all
+ RemoteEndpoints associated with this container.
+ |
+
int |
+getDefaultMaxBinaryMessageBufferSize()
+Returns the default maximum size of incoming binary message that this container will buffer.
+ |
+
long |
+getDefaultMaxSessionIdleTimeout()
+Return the default time in milliseconds after which any web socket sessions in this container will be closed if
+ it has been inactive.
+ |
+
int |
+getDefaultMaxTextMessageBufferSize()
+Returns the default maximum size of incoming text message that this container will buffer.
+ |
+
Set<Extension> |
+getInstalledExtensions()
+Return the set of Extensions installed in the container.
+ |
+
void |
+setAsyncSendTimeout(long timeoutmillis)
+Sets the number of milliseconds the implementation will timeout attempting to send a websocket message for all
+ RemoteEndpoints associated with this container.
+ |
+
void |
+setDefaultMaxBinaryMessageBufferSize(int max)
+Sets the default maximum size of incoming binary message that this container will buffer.
+ |
+
void |
+setDefaultMaxSessionIdleTimeout(long timeout)
+Sets the default time in milliseconds after which any web socket sessions in this container will be closed if it
+ has been inactive.
+ |
+
void |
+setDefaultMaxTextMessageBufferSize(int max)
+Sets the maximum size of incoming text message that this container will buffer.
+ |
+
long getDefaultAsyncSendTimeout()+
void setAsyncSendTimeout(long timeoutmillis)+
timeoutmillis
- the timeout in milliseconds or a non-positive number for no timeoutSession connectToServer(Object annotatedEndpointInstance, + URI path) + throws DeploymentException, + IOException+
ClientEndpoint
annotation. This method blocks until the
+ connection is established, or throws an error if either the connection could not be made or there was a problem
+ with the supplied endpoint class. If the developer uses this method to deploy the client endpoint, services like
+ dependency injection that are supported, for example, when the implementation is part of the Java EE platform may
+ not be available. If the client endpoint uses dependency injection, use
+ connectToServer(java.lang.Class, java.net.URI)
instead.annotatedEndpointInstance
- the annotated websocket client endpoint instance.path
- the complete path to the server endpoint.DeploymentException
- if the annotated endpoint instance is not valid.IOException
- if there was a network or protocol problem that prevented the client endpoint being
+ connected to its server.IllegalStateException
- if called during the deployment phase of the containing application.Session connectToServer(Class<?> annotatedEndpointClass, + URI path) + throws DeploymentException, + IOException+
ClientEndpoint
annotation. This method blocks until the connection is
+ established, or throws an error if either the connection could not be made or there was a problem with the
+ supplied endpoint class.annotatedEndpointClass
- the annotated websocket client endpoint.path
- the complete path to the server endpoint.DeploymentException
- if the class is not a valid annotated endpoint class.IOException
- if there was a network or protocol problem that prevented the client endpoint being
+ connected to its server.IllegalStateException
- if called during the deployment phase of the containing application.Session connectToServer(Endpoint endpointInstance, + ClientEndpointConfig cec, + URI path) + throws DeploymentException, + IOException+
connectToServer(java.lang.Class, jakarta.websocket.ClientEndpointConfig, java.net.URI)
+ instead.endpointInstance
- the programmatic client endpoint instance Endpoint
.path
- the complete path to the server endpoint.cec
- the configuration used to configure the programmatic endpoint.DeploymentException
- if the configuration is not validIOException
- if there was a network or protocol problem that prevented the client endpoint being
+ connected to its serverIllegalStateException
- if called during the deployment phase of the containing application.Session connectToServer(Class<? extends Endpoint> endpointClass, + ClientEndpointConfig cec, + URI path) + throws DeploymentException, + IOException+
endpointClass
- the programmatic client endpoint class Endpoint
.path
- the complete path to the server endpoint.cec
- the configuration used to configure the programmatic endpoint.DeploymentException
- if the configuration is not validIOException
- if there was a network or protocol problem that prevented the client endpoint being
+ connected to its serverIllegalStateException
- if called during the deployment phase of the containing application.long getDefaultMaxSessionIdleTimeout()+
Session.setMaxIdleTimeout(long)
void setDefaultMaxSessionIdleTimeout(long timeout)+
Session.setMaxIdleTimeout(long)
timeout
- the maximum time in milliseconds.int getDefaultMaxBinaryMessageBufferSize()+
Session.setMaxBinaryMessageBufferSize(int)
void setDefaultMaxBinaryMessageBufferSize(int max)+
max
- the maximum size of binary message in number of bytes.int getDefaultMaxTextMessageBufferSize()+
Session.setMaxTextMessageBufferSize(int)
void setDefaultMaxTextMessageBufferSize(int max)+
max
- the maximum size of text message in number of bytes.Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
ClientEndpointConfig.Builder |
+ClientEndpointConfig.Builder.configurator(ClientEndpointConfig.Configurator clientEndpointConfigurator)
+Sets the configurator object for the configuration this builder will build.
+ |
+
static ClientEndpointConfig.Builder |
+ClientEndpointConfig.Builder.create()
+Creates a new builder object with no subprotocols, extensions, encoders, decoders and a
+null
+ configurator. |
+
ClientEndpointConfig.Builder |
+ClientEndpointConfig.Builder.decoders(List<Class<? extends Decoder>> decoders)
+Assign the list of decoder implementation classes the client will use.
+ |
+
ClientEndpointConfig.Builder |
+ClientEndpointConfig.Builder.encoders(List<Class<? extends Encoder>> encoders)
+Assign the list of encoder implementation classes the client will use.
+ |
+
ClientEndpointConfig.Builder |
+ClientEndpointConfig.Builder.extensions(List<Extension> extensions)
+Set the extensions for the configuration this builder will build.
+ |
+
ClientEndpointConfig.Builder |
+ClientEndpointConfig.Builder.preferredSubprotocols(List<String> preferredSubprotocols)
+Set the preferred sub protocols for the configuration this builder will build.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
ClientEndpointConfig.Configurator |
+ClientEndpointConfig.getConfigurator()
+Return the custom configurator for this configuration.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
ClientEndpointConfig.Builder |
+ClientEndpointConfig.Builder.configurator(ClientEndpointConfig.Configurator clientEndpointConfigurator)
+Sets the configurator object for the configuration this builder will build.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
ClientEndpointConfig |
+ClientEndpointConfig.Builder.build()
+Builds a configuration object using the attributes set on this builder.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
Session |
+WebSocketContainer.connectToServer(Class<? extends Endpoint> endpointClass,
+ ClientEndpointConfig cec,
+ URI path)
+Connect the supplied programmatic endpoint to its server with the given configuration.
+ |
+
Session |
+WebSocketContainer.connectToServer(Endpoint endpointInstance,
+ ClientEndpointConfig cec,
+ URI path)
+Connect the supplied programmatic client endpoint instance to its server with the given configuration.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
Modifier and Type | +Class and Description | +
---|---|
static class |
+CloseReason.CloseCodes
+An Enumeration of status codes for a web socket close that are defined in the specification.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
CloseReason.CloseCode |
+CloseReason.getCloseCode()
+The Close code associated with this CloseReason.
+ |
+
static CloseReason.CloseCode |
+CloseReason.CloseCodes.getCloseCode(int code)
+Creates a CloseCode from the given int code number.
+ |
+
Constructor and Description | +
---|
CloseReason(CloseReason.CloseCode closeCode,
+ String reasonPhrase)
+Creates a reason for closing a web socket connection with the given code and reason phrase.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
static CloseReason.CloseCodes |
+CloseReason.CloseCodes.valueOf(String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static CloseReason.CloseCodes[] |
+CloseReason.CloseCodes.values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+Session.close(CloseReason closeReason)
+Close the current conversation, giving a reason for the closure.
+ |
+
void |
+Endpoint.onClose(Session session,
+ CloseReason closeReason)
+This method is called immediately prior to the session with the remote peer being closed.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
T |
+Decoder.Binary.decode(ByteBuffer bytes)
+Decode the given bytes into an object of type T.
+ |
+
T |
+Decoder.BinaryStream.decode(InputStream is)
+Decode the given bytes read from the input stream into an object of type T.
+ |
+
T |
+Decoder.TextStream.decode(Reader reader)
+Reads the websocket message from the implementation provided Reader and decodes it into an instance of the
+ supplied object type.
+ |
+
T |
+Decoder.Text.decode(String s)
+Decode the given String into an object of type T.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
jakarta.websocket.server | +
+ This package contains all the Jakarta WebSocket APIs used only by server side applications.
+ |
+
Modifier and Type | +Interface and Description | +
---|---|
static interface |
+Decoder.Binary<T>
+This interface defines how a custom object (of type T) is decoded from a web socket message in the form of a byte
+ buffer.
+ |
+
static interface |
+Decoder.BinaryStream<T>
+This interface defines how a custom object is decoded from a web socket message in the form of a binary stream.
+ |
+
static interface |
+Decoder.Text<T>
+This interface defines how a custom object is decoded from a web socket message in the form of a string.
+ |
+
static interface |
+Decoder.TextStream<T>
+This interface defines how a custom object of type T is decoded from a web socket message in the form of a
+ character stream.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
List<Class<? extends Decoder>> |
+EndpointConfig.getDecoders()
+Return the Decoder implementation classes configured.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
ClientEndpointConfig.Builder |
+ClientEndpointConfig.Builder.decoders(List<Class<? extends Decoder>> decoders)
+Assign the list of decoder implementation classes the client will use.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
ServerEndpointConfig.Builder |
+ServerEndpointConfig.Builder.decoders(List<Class<? extends Decoder>> decoders)
+Sets the decoder implementation classes to use in the configuration.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
jakarta.websocket.server | +
+ This package contains all the Jakarta WebSocket APIs used only by server side applications.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
Session |
+WebSocketContainer.connectToServer(Class<?> annotatedEndpointClass,
+ URI path)
+Connect the supplied annotated endpoint to its server.
+ |
+
Session |
+WebSocketContainer.connectToServer(Class<? extends Endpoint> endpointClass,
+ ClientEndpointConfig cec,
+ URI path)
+Connect the supplied programmatic endpoint to its server with the given configuration.
+ |
+
Session |
+WebSocketContainer.connectToServer(Endpoint endpointInstance,
+ ClientEndpointConfig cec,
+ URI path)
+Connect the supplied programmatic client endpoint instance to its server with the given configuration.
+ |
+
Session |
+WebSocketContainer.connectToServer(Object annotatedEndpointInstance,
+ URI path)
+Connect the supplied annotated endpoint instance to its server.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+ServerContainer.addEndpoint(Class<?> endpointClass)
+Deploys the given annotated endpoint into this ServerContainer during the initialization phase of deploying the
+ application.
+ |
+
void |
+ServerContainer.addEndpoint(ServerEndpointConfig serverConfig) |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
String |
+Encoder.Text.encode(T object)
+Encode the given object into a String.
+ |
+
ByteBuffer |
+Encoder.Binary.encode(T object)
+Encode the given object into a byte array.
+ |
+
void |
+Encoder.BinaryStream.encode(T object,
+ OutputStream os)
+Encode the given object into a binary stream written to the implementation provided OutputStream.
+ |
+
void |
+Encoder.TextStream.encode(T object,
+ Writer writer)
+Encode the given object to a character stream writing it to the supplied Writer.
+ |
+
void |
+RemoteEndpoint.Basic.sendObject(Object data)
+Sends a custom developer object, blocking until it has been transmitted.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
jakarta.websocket.server | +
+ This package contains all the Jakarta WebSocket APIs used only by server side applications.
+ |
+
Modifier and Type | +Interface and Description | +
---|---|
static interface |
+Encoder.Binary<T>
+This interface defines how to provide a way to convert a custom object into a binary message.
+ |
+
static interface |
+Encoder.BinaryStream<T>
+This interface may be implemented by encoding algorithms that want to write the encoded object to a binary
+ stream.
+ |
+
static interface |
+Encoder.Text<T>
+This interface defines how to provide a way to convert a custom object into a text message.
+ |
+
static interface |
+Encoder.TextStream<T>
+This interface may be implemented by encoding algorithms that want to write the encoded object to a character
+ stream.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
List<Class<? extends Encoder>> |
+EndpointConfig.getEncoders()
+Return the Encoder implementation classes configured.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
ClientEndpointConfig.Builder |
+ClientEndpointConfig.Builder.encoders(List<Class<? extends Encoder>> encoders)
+Assign the list of encoder implementation classes the client will use.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
ServerEndpointConfig.Builder |
+ServerEndpointConfig.Builder.encoders(List<Class<? extends Encoder>> encoders)
+Sets the list of encoder implementation classes for this builder.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
jakarta.websocket.server | +
+ This package contains all the Jakarta WebSocket APIs used only by server side applications.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
Session |
+WebSocketContainer.connectToServer(Endpoint endpointInstance,
+ ClientEndpointConfig cec,
+ URI path)
+Connect the supplied programmatic client endpoint instance to its server with the given configuration.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
Session |
+WebSocketContainer.connectToServer(Class<? extends Endpoint> endpointClass,
+ ClientEndpointConfig cec,
+ URI path)
+Connect the supplied programmatic endpoint to its server with the given configuration.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
Set<ServerEndpointConfig> |
+ServerApplicationConfig.getEndpointConfigs(Set<Class<? extends Endpoint>> endpointClasses)
+Return a set of ServerEndpointConfig instances that the server container will use to deploy the programmatic
+ endpoints.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
jakarta.websocket.server | +
+ This package contains all the Jakarta WebSocket APIs used only by server side applications.
+ |
+
Modifier and Type | +Interface and Description | +
---|---|
interface |
+ClientEndpointConfig
+The ClientEndpointConfig is a special kind of endpoint configuration object that contains web socket configuration
+ information specific only to client endpoints.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
default void |
+Encoder.init(EndpointConfig config)
+This method is called with the endpoint configuration object of the endpoint this encoder is intended for when it
+ is about to be brought into service.
+ |
+
default void |
+Decoder.init(EndpointConfig config)
+This method is called with the endpoint configuration object of the endpoint this decoder is intended for when it
+ is about to be brought into service.
+ |
+
abstract void |
+Endpoint.onOpen(Session session,
+ EndpointConfig config)
+Developers must implement this method to be notified when a new conversation has just begun.
+ |
+
Modifier and Type | +Interface and Description | +
---|---|
interface |
+ServerEndpointConfig
+The ServerEndpointConfig is a special kind of endpoint configuration object that contains web socket configuration
+ information specific only to server endpoints.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
List<Extension.Parameter> |
+Extension.getParameters()
+The extension parameters for this extension in the order they appear in the http headers.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
jakarta.websocket.server | +
+ This package contains all the Jakarta WebSocket APIs used only by server side applications.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
List<Extension> |
+ClientEndpointConfig.getExtensions()
+Return the extensions, in order of preference, favorite first, that this client would like to use for its
+ sessions.
+ |
+
Set<Extension> |
+WebSocketContainer.getInstalledExtensions()
+Return the set of Extensions installed in the container.
+ |
+
List<Extension> |
+Session.getNegotiatedExtensions()
+Return the list of extensions currently in use for this conversation.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
ClientEndpointConfig.Builder |
+ClientEndpointConfig.Builder.extensions(List<Extension> extensions)
+Set the extensions for the configuration this builder will build.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
List<Extension> |
+ServerEndpointConfig.getExtensions()
+Return the websocket extensions configured.
+ |
+
List<Extension> |
+ServerEndpointConfig.Configurator.getNegotiatedExtensions(List<Extension> installed,
+ List<Extension> requested)
+Return the ordered list of extensions that t server endpoint will support given the requested extension list
+ passed in, the empty list if none.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
ServerEndpointConfig.Builder |
+ServerEndpointConfig.Builder.extensions(List<Extension> extensions)
+Sets the extensions to use in the configuration.
+ |
+
List<Extension> |
+ServerEndpointConfig.Configurator.getNegotiatedExtensions(List<Extension> installed,
+ List<Extension> requested)
+Return the ordered list of extensions that t server endpoint will support given the requested extension list
+ passed in, the empty list if none.
+ |
+
List<Extension> |
+ServerEndpointConfig.Configurator.getNegotiatedExtensions(List<Extension> installed,
+ List<Extension> requested)
+Return the ordered list of extensions that t server endpoint will support given the requested extension list
+ passed in, the empty list if none.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
jakarta.websocket.server | +
+ This package contains all the Jakarta WebSocket APIs used only by server side applications.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+ClientEndpointConfig.Configurator.afterResponse(HandshakeResponse hr)
+This method is called by the implementation after it has received a handshake response from the server as a
+ result of a handshake interaction it initiated.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+ServerEndpointConfig.Configurator.modifyHandshake(ServerEndpointConfig sec,
+ HandshakeRequest request,
+ HandshakeResponse response)
+Called by the container after it has formulated a handshake response resulting from a well-formed handshake
+ request.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
<T> void |
+Session.addMessageHandler(Class<T> clazz,
+ MessageHandler.Partial<T> handler)
+Register to handle to incoming messages in this conversation.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
<T> void |
+Session.addMessageHandler(Class<T> clazz,
+ MessageHandler.Whole<T> handler)
+Register to handle to incoming messages in this conversation.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
Modifier and Type | +Interface and Description | +
---|---|
static interface |
+MessageHandler.Partial<T>
+This kind of handler is notified by the implementation as it becomes ready to deliver parts of a whole message.
+ |
+
static interface |
+MessageHandler.Whole<T>
+This kind of handler is notified by the container on arrival of a complete message.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
Set<MessageHandler> |
+Session.getMessageHandlers()
+Return an unmodifiable copy of the set of MessageHandlers for this Session.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+Session.addMessageHandler(MessageHandler handler)
+Register to handle to incoming messages in this conversation.
+ |
+
void |
+Session.removeMessageHandler(MessageHandler handler)
+Remove the given MessageHandler from the set belonging to this session.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
RemoteEndpoint.Async |
+Session.getAsyncRemote()
+Return a reference a RemoteEndpoint object representing the peer of this conversation that is able to send
+ messages asynchronously to the peer.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
RemoteEndpoint.Basic |
+Session.getBasicRemote()
+Return a reference a RemoteEndpoint object representing the peer of this conversation that is able to send
+ messages synchronously to the peer.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
Modifier and Type | +Interface and Description | +
---|---|
static interface |
+RemoteEndpoint.Async
+This representation of the peer of a web socket conversation has the ability to send messages asynchronously.
+ |
+
static interface |
+RemoteEndpoint.Basic
+This representation of the peer of a web socket conversation has the ability to send messages synchronously.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+RemoteEndpoint.Async.sendBinary(ByteBuffer data,
+ SendHandler handler)
+Initiates the asynchronous transmission of a binary message.
+ |
+
void |
+RemoteEndpoint.Async.sendObject(Object data,
+ SendHandler handler)
+Initiates the asynchronous transmission of a custom developer object.
+ |
+
void |
+RemoteEndpoint.Async.sendText(String text,
+ SendHandler handler)
+Initiates the asynchronous transmission of a text message.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+SendHandler.onResult(SendResult result)
+Called once the message has been transmitted.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
Session |
+WebSocketContainer.connectToServer(Class<?> annotatedEndpointClass,
+ URI path)
+Connect the supplied annotated endpoint to its server.
+ |
+
Session |
+WebSocketContainer.connectToServer(Class<? extends Endpoint> endpointClass,
+ ClientEndpointConfig cec,
+ URI path)
+Connect the supplied programmatic endpoint to its server with the given configuration.
+ |
+
Session |
+WebSocketContainer.connectToServer(Endpoint endpointInstance,
+ ClientEndpointConfig cec,
+ URI path)
+Connect the supplied programmatic client endpoint instance to its server with the given configuration.
+ |
+
Session |
+WebSocketContainer.connectToServer(Object annotatedEndpointInstance,
+ URI path)
+Connect the supplied annotated endpoint instance to its server.
+ |
+
Session |
+SessionException.getSession()
+Return the Session on which the problem occurred.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
Set<Session> |
+Session.getOpenSessions()
+Return a copy of the Set of all the open web socket sessions that represent connections to the same endpoint to
+ which this session represents a connection.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+Endpoint.onClose(Session session,
+ CloseReason closeReason)
+This method is called immediately prior to the session with the remote peer being closed.
+ |
+
void |
+Endpoint.onError(Session session,
+ Throwable thr)
+Developers may implement this method when the web socket session creates some kind of error that is not modeled
+ in the web socket protocol.
+ |
+
abstract void |
+Endpoint.onOpen(Session session,
+ EndpointConfig config)
+Developers must implement this method to be notified when a new conversation has just begun.
+ |
+
Constructor and Description | +
---|
SessionException(String message,
+ Throwable cause,
+ Session session)
+Creates a new instance of this exception with the given message, the wrapped cause of the exception and the
+ session with which the problem is associated.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
jakarta.websocket.server | +
+ This package contains all the Jakarta WebSocket APIs used only by server side applications.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
WebSocketContainer |
+Session.getContainer()
+Return the container that this session is part of.
+ |
+
protected abstract WebSocketContainer |
+ContainerProvider.getContainer()
+Create a new instance of the the WebSocket container implementation.
+ |
+
static WebSocketContainer |
+ContainerProvider.getWebSocketContainer()
+Obtain a new instance of a WebSocketContainer.
+ |
+
Modifier and Type | +Interface and Description | +
---|---|
interface |
+ServerContainer
+The ServerContainer is the specialized view of the WebSocketContainer available in server-side deployments.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
See: Description
+Interface | +Description | +
---|---|
ClientEndpointConfig | +
+ The ClientEndpointConfig is a special kind of endpoint configuration object that contains web socket configuration
+ information specific only to client endpoints.
+ |
+
CloseReason.CloseCode | +
+ A marker interface for the close codes.
+ |
+
Decoder | +
+ The Decoder interface holds member interfaces that define how a developer can provide the web socket container a way
+ web socket messages into developer defined custom objects.
+ |
+
Decoder.Binary<T> | +
+ This interface defines how a custom object (of type T) is decoded from a web socket message in the form of a byte
+ buffer.
+ |
+
Decoder.BinaryStream<T> | +
+ This interface defines how a custom object is decoded from a web socket message in the form of a binary stream.
+ |
+
Decoder.Text<T> | +
+ This interface defines how a custom object is decoded from a web socket message in the form of a string.
+ |
+
Decoder.TextStream<T> | +
+ This interface defines how a custom object of type T is decoded from a web socket message in the form of a
+ character stream.
+ |
+
Encoder | +
+ The Encoder interface defines how developers can provide a way to convert their custom objects into web socket
+ messages.
+ |
+
Encoder.Binary<T> | +
+ This interface defines how to provide a way to convert a custom object into a binary message.
+ |
+
Encoder.BinaryStream<T> | +
+ This interface may be implemented by encoding algorithms that want to write the encoded object to a binary
+ stream.
+ |
+
Encoder.Text<T> | +
+ This interface defines how to provide a way to convert a custom object into a text message.
+ |
+
Encoder.TextStream<T> | +
+ This interface may be implemented by encoding algorithms that want to write the encoded object to a character
+ stream.
+ |
+
EndpointConfig | +
+ The endpoint configuration contains all the information needed during the handshake process for this end point.
+ |
+
Extension | +
+ A simple representation of a websocket extension as a name and map of extension parameters.
+ |
+
Extension.Parameter | +
+ This member interface defines a single websocket extension parameter.
+ |
+
HandshakeResponse | +
+ The handshake response represents the WebSocket-defined HTTP response that is the response to the opening handshake
+ request.
+ |
+
MessageHandler | +
+ Developers implement MessageHandlers in order to receive incoming messages during a web socket conversation.
+ |
+
MessageHandler.Partial<T> | +
+ This kind of handler is notified by the implementation as it becomes ready to deliver parts of a whole message.
+ |
+
MessageHandler.Whole<T> | +
+ This kind of handler is notified by the container on arrival of a complete message.
+ |
+
PongMessage | +
+ The PongMessage interface represents a web socket pong.
+ |
+
RemoteEndpoint | +
+ The RemoteEndpoint object is supplied by the container and represents the 'other end' or peer of the Web Socket
+ conversation.
+ |
+
RemoteEndpoint.Async | +
+ This representation of the peer of a web socket conversation has the ability to send messages asynchronously.
+ |
+
RemoteEndpoint.Basic | +
+ This representation of the peer of a web socket conversation has the ability to send messages synchronously.
+ |
+
SendHandler | +
+ A simple callback object for asynchronous sending of web socket messages.
+ |
+
Session | +
+ A Web Socket session represents a conversation between two web socket endpoints.
+ |
+
WebSocketContainer | +
+ A WebSocketContainer is an implementation provided object that provides applications a view on the container running
+ it.
+ |
+
Class | +Description | +
---|---|
ClientEndpointConfig.Builder | +
+ The ClientEndpointConfig.Builder is a class used for creating
+ClientEndpointConfig objects for the
+ purposes of deploying a client endpoint. |
+
ClientEndpointConfig.Configurator | +
+ The Configurator class may be extended by developers who want to provide custom configuration algorithms, such as
+ intercepting the opening handshake, or providing arbitrary methods and algorithms that can be accessed from each
+ endpoint instance configured with this configurator.
+ |
+
CloseReason | +
+ A class encapsulating the reason why a web socket has been closed, or why it is being asked to close.
+ |
+
ContainerProvider | +
+ Provider class that allows the developer to get a reference to the implementation of the WebSocketContainer.
+ |
+
Endpoint | +
+ The Web Socket Endpoint represents an object that can handle websocket conversations.
+ |
+
SendResult | +
+ The result of asynchronously sending a web socket message.
+ |
+
Enum | +Description | +
---|---|
CloseReason.CloseCodes | +
+ An Enumeration of status codes for a web socket close that are defined in the specification.
+ |
+
Exception | +Description | +
---|---|
DecodeException | +
+ A general exception that occurs when trying to decode a custom object from a text or binary message.
+ |
+
DeploymentException | +
+ Checked exception indicating some kind of failure either to publish an endpoint on its server, or a failure to
+ connect a client to its server.
+ |
+
EncodeException | +
+ A general exception that occurs when trying to encode a custom object to a string or binary message.
+ |
+
SessionException | +
+ A SessionException represents a general exception type reporting problems occurring on a websocket session.
+ |
+
Annotation Type | +Description | +
---|---|
ClientEndpoint | +
+ The ClientEndpoint annotation a class level annotation is used to denote that a POJO is a web socket client and can
+ be deployed as such.
+ |
+
OnClose | +
+ This method level annotation can be used to decorate a Java method that wishes to be called when a web socket session
+ is closing.
+ |
+
OnError | +
+ This method level annotation can be used to decorate a Java method that wishes to be called in order to handle
+ errors.
+ |
+
OnMessage | +
+ This method level annotation can be used to make a Java method receive incoming web socket messages.
+ |
+
OnOpen | +
+ This method level annotation can be used to decorate a Java method that wishes to be called when a new web socket
+ session is open.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
jakarta.websocket.server | +
+ This package contains all the Jakarta WebSocket APIs used only by server side applications.
+ |
+
Class and Description | +
---|
ClientEndpointConfig
+ The ClientEndpointConfig is a special kind of endpoint configuration object that contains web socket configuration
+ information specific only to client endpoints.
+ |
+
ClientEndpointConfig.Builder
+ The ClientEndpointConfig.Builder is a class used for creating
+ClientEndpointConfig objects for the
+ purposes of deploying a client endpoint. |
+
ClientEndpointConfig.Configurator
+ The Configurator class may be extended by developers who want to provide custom configuration algorithms, such as
+ intercepting the opening handshake, or providing arbitrary methods and algorithms that can be accessed from each
+ endpoint instance configured with this configurator.
+ |
+
CloseReason
+ A class encapsulating the reason why a web socket has been closed, or why it is being asked to close.
+ |
+
CloseReason.CloseCode
+ A marker interface for the close codes.
+ |
+
CloseReason.CloseCodes
+ An Enumeration of status codes for a web socket close that are defined in the specification.
+ |
+
DecodeException
+ A general exception that occurs when trying to decode a custom object from a text or binary message.
+ |
+
Decoder
+ The Decoder interface holds member interfaces that define how a developer can provide the web socket container a way
+ web socket messages into developer defined custom objects.
+ |
+
DeploymentException
+ Checked exception indicating some kind of failure either to publish an endpoint on its server, or a failure to
+ connect a client to its server.
+ |
+
EncodeException
+ A general exception that occurs when trying to encode a custom object to a string or binary message.
+ |
+
Encoder
+ The Encoder interface defines how developers can provide a way to convert their custom objects into web socket
+ messages.
+ |
+
Endpoint
+ The Web Socket Endpoint represents an object that can handle websocket conversations.
+ |
+
EndpointConfig
+ The endpoint configuration contains all the information needed during the handshake process for this end point.
+ |
+
Extension
+ A simple representation of a websocket extension as a name and map of extension parameters.
+ |
+
Extension.Parameter
+ This member interface defines a single websocket extension parameter.
+ |
+
HandshakeResponse
+ The handshake response represents the WebSocket-defined HTTP response that is the response to the opening handshake
+ request.
+ |
+
MessageHandler
+ Developers implement MessageHandlers in order to receive incoming messages during a web socket conversation.
+ |
+
MessageHandler.Partial
+ This kind of handler is notified by the implementation as it becomes ready to deliver parts of a whole message.
+ |
+
MessageHandler.Whole
+ This kind of handler is notified by the container on arrival of a complete message.
+ |
+
RemoteEndpoint
+ The RemoteEndpoint object is supplied by the container and represents the 'other end' or peer of the Web Socket
+ conversation.
+ |
+
RemoteEndpoint.Async
+ This representation of the peer of a web socket conversation has the ability to send messages asynchronously.
+ |
+
RemoteEndpoint.Basic
+ This representation of the peer of a web socket conversation has the ability to send messages synchronously.
+ |
+
SendHandler
+ A simple callback object for asynchronous sending of web socket messages.
+ |
+
SendResult
+ The result of asynchronously sending a web socket message.
+ |
+
Session
+ A Web Socket session represents a conversation between two web socket endpoints.
+ |
+
WebSocketContainer
+ A WebSocketContainer is an implementation provided object that provides applications a view on the container running
+ it.
+ |
+
Class and Description | +
---|
Decoder
+ The Decoder interface holds member interfaces that define how a developer can provide the web socket container a way
+ web socket messages into developer defined custom objects.
+ |
+
DeploymentException
+ Checked exception indicating some kind of failure either to publish an endpoint on its server, or a failure to
+ connect a client to its server.
+ |
+
Encoder
+ The Encoder interface defines how developers can provide a way to convert their custom objects into web socket
+ messages.
+ |
+
Endpoint
+ The Web Socket Endpoint represents an object that can handle websocket conversations.
+ |
+
EndpointConfig
+ The endpoint configuration contains all the information needed during the handshake process for this end point.
+ |
+
Extension
+ A simple representation of a websocket extension as a name and map of extension parameters.
+ |
+
HandshakeResponse
+ The handshake response represents the WebSocket-defined HTTP response that is the response to the opening handshake
+ request.
+ |
+
WebSocketContainer
+ A WebSocketContainer is an implementation provided object that provides applications a view on the container running
+ it.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public interface HandshakeRequest
+Modifier and Type | +Field and Description | +
---|---|
static String |
+SEC_WEBSOCKET_EXTENSIONS
+The Sec-WebSocket-Extensions header name
+ |
+
static String |
+SEC_WEBSOCKET_KEY
+The Sec-WebSocket-Key header name
+ |
+
static String |
+SEC_WEBSOCKET_PROTOCOL
+The Sec-WebSocket-Protocol header name
+ |
+
static String |
+SEC_WEBSOCKET_VERSION
+The Sec-WebSocket-Version header name
+ |
+
Modifier and Type | +Method and Description | +
---|---|
Map<String,List<String>> |
+getHeaders()
+Return the read only map of HTTP headers to header values that came with the handshake request.
+ |
+
Object |
+getHttpSession()
+Return a reference to the HttpSession that the web socket handshake that started this conversation was part of,
+ if the implementation is part of a Java EE web container.
+ |
+
Map<String,List<String>> |
+getParameterMap()
+Return the request parameters associated with the request.
+ |
+
String |
+getQueryString()
+Return the query string associated with the request.
+ |
+
URI |
+getRequestURI()
+Return the request URI of the handshake request.
+ |
+
Principal |
+getUserPrincipal()
+Return the authenticated user or
+null if no user is authenticated for this handshake. |
+
boolean |
+isUserInRole(String role)
+Checks whether the current user is in the given role.
+ |
+
static final String SEC_WEBSOCKET_KEY+
static final String SEC_WEBSOCKET_PROTOCOL+
static final String SEC_WEBSOCKET_VERSION+
static final String SEC_WEBSOCKET_EXTENSIONS+
Map<String,List<String>> getHeaders()+
Principal getUserPrincipal()+
null
if no user is authenticated for this handshake.URI getRequestURI()+
boolean isUserInRole(String role)+
false
.role
- the role being checked.Object getHttpSession()+
null
if either the websocket implementation is not part of a Java EE web
+ container, or there is no HttpSession associated with the opening handshake request.Map<String,List<String>> getParameterMap()+
String getQueryString()+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
@Retention(value=RUNTIME) + @Target(value=PARAMETER) +public @interface PathParam+
ServerEndpoint
annotation. The method parameter may be of type String, any Java
+ primitive type or any boxed version thereof. If a client URI matches the URI-template, but the requested path
+ parameter cannot be decoded, then the websocket's error handler will be called.
+
+ + For example:- + +
+
+ @ServerEndpoint("/bookings/{guest-id}")
+ public class BookingServer {
+
+ @OnMessage
+ public void processBookingRequest(@PathParam("guest-id") String guestID, String message, Session session) {
+ // process booking from the given guest here
+ }
+ }
+
+
+
+ + For example:- + +
+
+ @ServerEndpoint("/rewards/{vip-level}")
+ public class RewardServer {
+
+ @OnMessage
+ public void processReward(@PathParam("vip-level") Integer vipLevel, String message, Session session) {
+ // process reward here
+ }
+ }
+
+
public abstract String value+
null
.Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public interface ServerApplicationConfig
+Modifier and Type | +Method and Description | +
---|---|
Set<Class<?>> |
+getAnnotatedEndpointClasses(Set<Class<?>> scanned)
+Return a set of annotated endpoint classes that the server container must deploy.
+ |
+
Set<ServerEndpointConfig> |
+getEndpointConfigs(Set<Class<? extends Endpoint>> endpointClasses)
+Return a set of ServerEndpointConfig instances that the server container will use to deploy the programmatic
+ endpoints.
+ |
+
Set<ServerEndpointConfig> getEndpointConfigs(Set<Class<? extends Endpoint>> endpointClasses)+
endpointClasses
- the set of all the Endpoint classes in the archive containing the implementation of this
+ interface.Set<Class<?>> getAnnotatedEndpointClasses(Set<Class<?>> scanned)+
scanned
- the set of all the annotated endpoint classes in the archive containing the implementation of this
+ interface.Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public interface ServerContainer +extends WebSocketContainer+
+ For websocket enabled web containers, developers may obtain a reference to the ServerContainer instance by retrieving
+ it as an attribute named jakarta.websocket.server.ServerContainer
on the ServletContext. This way, the
+ registration methods held on this interface may be called to register server endpoints from a ServletContextListener
+ during the deployment of the WAR file containing the endpoint.
+
+ WebSocket implementations that run outside the web container may have other means by which to provide a + ServerContainer instance to the developer at application deployment time. +
++ Once the application deployment phase is complete, and the websocket application has begun accepting incoming + connections, the registration methods may no longer be called.
Modifier and Type | +Method and Description | +
---|---|
void |
+addEndpoint(Class<?> endpointClass)
+Deploys the given annotated endpoint into this ServerContainer during the initialization phase of deploying the
+ application.
+ |
+
void |
+addEndpoint(ServerEndpointConfig serverConfig) |
+
connectToServer, connectToServer, connectToServer, connectToServer, getDefaultAsyncSendTimeout, getDefaultMaxBinaryMessageBufferSize, getDefaultMaxSessionIdleTimeout, getDefaultMaxTextMessageBufferSize, getInstalledExtensions, setAsyncSendTimeout, setDefaultMaxBinaryMessageBufferSize, setDefaultMaxSessionIdleTimeout, setDefaultMaxTextMessageBufferSize
void addEndpoint(Class<?> endpointClass) + throws DeploymentException+
endpointClass
- the class of the annotated endpointDeploymentException
- if the annotated endpoint was badly formed.IllegalStateException
- if the containing websocket application has already been deployed.void addEndpoint(ServerEndpointConfig serverConfig) + throws DeploymentException+
serverConfig
- the configuration instance representing the logical endpoint that will be registered.DeploymentException
- if the endpoint was badly formed.IllegalStateException
- if the containing websocket application has already been deployed.Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
@Retention(value=RUNTIME) + @Target(value=TYPE) +public @interface ServerEndpoint+
+ The annotated class must have a public no-arg constructor. + +
+ For example: + +
+
+ @ServerEndpoint("/hello");
+ public class HelloServer {
+
+ @OnMessage
+ public void processGreeting(String message, Session session) {
+ System.out.println("Greeting received:" + message);
+ }
+
+ }
+
+
Modifier and Type | +Required Element and Description | +
---|---|
String |
+value
+The URI or URI-template, level-1 (See RFC 6570) where the
+ endpoint will be deployed.
+ |
+
Modifier and Type | +Optional Element and Description | +
---|---|
Class<? extends ServerEndpointConfig.Configurator> |
+configurator
+The optional custom configurator class that the developer would like to use to further configure new instances of
+ this endpoint.
+ |
+
Class<? extends Decoder>[] |
+decoders
+The ordered array of decoder classes this endpoint will use.
+ |
+
Class<? extends Encoder>[] |
+encoders
+The ordered array of encoder classes this endpoint will use.
+ |
+
String[] |
+subprotocols
+The ordered array of web socket protocols this endpoint supports.
+ |
+
public abstract String value+
+
+ @ServerEndpoint("/chat")
+ @ServerEndpoint("/chat/{user}")
+ @ServerEndpoint("/booking/{privilege-level}")
+
+
public abstract String[] subprotocols+
public abstract Class<? extends Decoder>[] decoders+
public abstract Class<? extends Encoder>[] encoders+
public abstract Class<? extends ServerEndpointConfig.Configurator> configurator+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public static final class ServerEndpointConfig.Builder +extends Object+
ServerEndpointConfig.Builder
objects for
+ the purposes of deploying a server endpoint.
+
+ + Here are some examples: + +
+ Building a plain configuration for an endpoint with just a path. + +
+
+ ServerEndpointConfig config = ServerEndpointConfig.Builder.create(ProgrammaticEndpoint.class, "/foo").build();
+
+
+
+ + Building a configuration with no subprotocols and a custom configurator. + +
+
+ ServerEndpointConfig config = ServerEndpointConfig.Builder.create(ProgrammaticEndpoint.class, "/bar")
+ .subprotocols(subprotocols)
+ .configurator(new MyServerConfigurator())
+ .build();
+
+
Modifier and Type | +Method and Description | +
---|---|
ServerEndpointConfig |
+build()
+Builds the configuration object using the current attributes that have been set on this builder object.
+ |
+
ServerEndpointConfig.Builder |
+configurator(ServerEndpointConfig.Configurator serverEndpointConfigurator)
+Sets the custom configurator to use on the configuration object built by this builder.
+ |
+
static ServerEndpointConfig.Builder |
+create(Class<?> endpointClass,
+ String path)
+Creates the builder with the mandatory information of the endpoint class (programmatic or annotated), the
+ relative URI or URI-template to use, and with no subprotocols, extensions, encoders, decoders or custom
+ configurator.
+ |
+
ServerEndpointConfig.Builder |
+decoders(List<Class<? extends Decoder>> decoders)
+Sets the decoder implementation classes to use in the configuration.
+ |
+
ServerEndpointConfig.Builder |
+encoders(List<Class<? extends Encoder>> encoders)
+Sets the list of encoder implementation classes for this builder.
+ |
+
ServerEndpointConfig.Builder |
+extensions(List<Extension> extensions)
+Sets the extensions to use in the configuration.
+ |
+
ServerEndpointConfig.Builder |
+subprotocols(List<String> subprotocols)
+Sets the subprotocols to use in the configuration.
+ |
+
public static ServerEndpointConfig.Builder create(Class<?> endpointClass, + String path)+
endpointClass
- the class of the endpoint to configurepath
- The URI or URI template where the endpoint will be deployed. A trailing "/" will be
+ ignored and the path must begin with /.public ServerEndpointConfig build()+
public ServerEndpointConfig.Builder encoders(List<Class<? extends Encoder>> encoders)+
encoders
- the encoderspublic ServerEndpointConfig.Builder decoders(List<Class<? extends Decoder>> decoders)+
decoders
- the decoderspublic ServerEndpointConfig.Builder subprotocols(List<String> subprotocols)+
subprotocols
- the subprotocols.public ServerEndpointConfig.Builder extensions(List<Extension> extensions)+
extensions
- the extensions to use.public ServerEndpointConfig.Builder configurator(ServerEndpointConfig.Configurator serverEndpointConfigurator)+
serverEndpointConfigurator
- the configuratorComments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public static class ServerEndpointConfig.Configurator +extends Object+
Constructor and Description | +
---|
Configurator() |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+checkOrigin(String originHeaderValue)
+Check the value of the Origin header (See Origin Header) the
+ client passed during the opening handshake.
+ |
+
<T> T |
+getEndpointInstance(Class<T> endpointClass)
+This method is called by the container each time a new client connects to the logical endpoint this
+ configurator configures.
+ |
+
List<Extension> |
+getNegotiatedExtensions(List<Extension> installed,
+ List<Extension> requested)
+Return the ordered list of extensions that t server endpoint will support given the requested extension list
+ passed in, the empty list if none.
+ |
+
String |
+getNegotiatedSubprotocol(List<String> supported,
+ List<String> requested)
+Return the subprotocol the server endpoint has chosen from the requested list supplied by a client who wishes
+ to connect, or none if there wasn't one this server endpoint liked.
+ |
+
void |
+modifyHandshake(ServerEndpointConfig sec,
+ HandshakeRequest request,
+ HandshakeResponse response)
+Called by the container after it has formulated a handshake response resulting from a well-formed handshake
+ request.
+ |
+
public String getNegotiatedSubprotocol(List<String> supported, + List<String> requested)+
+ The default platform implementation of this method returns the first subprotocol in the list sent by the + client that the server supports, or the empty string if there isn't one.
requested
- the requested subprotocols from the client endpointsupported
- the subprotocols supported by the server endpointpublic List<Extension> getNegotiatedExtensions(List<Extension> installed, + List<Extension> requested)+
+ The default platform implementation of this method returns a list containing all of the requested extensions + passed to this method that it supports, using the order in the requested extensions, the empty list if none.
installed
- the installed extensions on the implementation.requested
- the requested extensions, in the order they were requested by the clientpublic boolean checkOrigin(String originHeaderValue)+
+ The platform default implementation of this method makes a check of the validity of the Origin header sent + along with the opening handshake following the recommendation at: + Sending the Server's Opening Handshake.
originHeaderValue
- the value of the origin header passed by the client.public void modifyHandshake(ServerEndpointConfig sec, + HandshakeRequest request, + HandshakeResponse response)+
+ If the developer does not override this method, no further modification of the request and response are made + by the implementation.
sec
- the configuration object involved in the handshakerequest
- the opening handshake request.response
- the proposed opening handshake responsepublic <T> T getEndpointInstance(Class<T> endpointClass) + throws InstantiationException+
T
- the type of the endpointendpointClass
- the class of the endpointInstantiationException
- if there was an error producing the endpoint instance.Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
public interface ServerEndpointConfig +extends EndpointConfig+
ServerEndpointConfig.Builder
. Certain configuration operations can be
+ customized by providing a ServerEndpointConfig.Configurator
Modifier and Type | +Interface and Description | +
---|---|
static class |
+ServerEndpointConfig.Builder
+The ServerEndpointConfig.Builder is a class used for creating
+ServerEndpointConfig.Builder objects for
+ the purposes of deploying a server endpoint. |
+
static class |
+ServerEndpointConfig.Configurator
+The ServerEndpointConfig.Configurator class may be extended by developers who want to provide custom
+ configuration algorithms, such as intercepting the opening handshake, or providing arbitrary methods and
+ algorithms that can be accessed from each endpoint instance configured with this configurator.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
ServerEndpointConfig.Configurator |
+getConfigurator()
+Return the
+ServerEndpointConfig.Configurator this configuration is using. |
+
Class<?> |
+getEndpointClass()
+Returns the Class of the endpoint this configuration is configuring.
+ |
+
List<Extension> |
+getExtensions()
+Return the websocket extensions configured.
+ |
+
String |
+getPath()
+Return the path for this endpoint configuration.
+ |
+
List<String> |
+getSubprotocols()
+Return the websocket subprotocols configured.
+ |
+
getDecoders, getEncoders, getUserProperties
Class<?> getEndpointClass()+
String getPath()+
List<String> getSubprotocols()+
List<Extension> getExtensions()+
ServerEndpointConfig.Configurator getConfigurator()+
ServerEndpointConfig.Configurator
this configuration is using. If none was set by calling
+ ServerEndpointConfig.Builder.configurator(jakarta.websocket.server.ServerEndpointConfig.Configurator)
this
+ methods returns the platform default configurator.Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket.server | +
+ This package contains all the Jakarta WebSocket APIs used only by server side applications.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+ServerEndpointConfig.Configurator.modifyHandshake(ServerEndpointConfig sec,
+ HandshakeRequest request,
+ HandshakeResponse response)
+Called by the container after it has formulated a handshake response resulting from a well-formed handshake
+ request.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket.server | +
+ This package contains all the Jakarta WebSocket APIs used only by server side applications.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
ServerEndpointConfig.Builder |
+ServerEndpointConfig.Builder.configurator(ServerEndpointConfig.Configurator serverEndpointConfigurator)
+Sets the custom configurator to use on the configuration object built by this builder.
+ |
+
static ServerEndpointConfig.Builder |
+ServerEndpointConfig.Builder.create(Class<?> endpointClass,
+ String path)
+Creates the builder with the mandatory information of the endpoint class (programmatic or annotated), the
+ relative URI or URI-template to use, and with no subprotocols, extensions, encoders, decoders or custom
+ configurator.
+ |
+
ServerEndpointConfig.Builder |
+ServerEndpointConfig.Builder.decoders(List<Class<? extends Decoder>> decoders)
+Sets the decoder implementation classes to use in the configuration.
+ |
+
ServerEndpointConfig.Builder |
+ServerEndpointConfig.Builder.encoders(List<Class<? extends Encoder>> encoders)
+Sets the list of encoder implementation classes for this builder.
+ |
+
ServerEndpointConfig.Builder |
+ServerEndpointConfig.Builder.extensions(List<Extension> extensions)
+Sets the extensions to use in the configuration.
+ |
+
ServerEndpointConfig.Builder |
+ServerEndpointConfig.Builder.subprotocols(List<String> subprotocols)
+Sets the subprotocols to use in the configuration.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket.server | +
+ This package contains all the Jakarta WebSocket APIs used only by server side applications.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
ServerEndpointConfig.Configurator |
+ServerEndpointConfig.getConfigurator()
+Return the
+ServerEndpointConfig.Configurator this configuration is using. |
+
Modifier and Type | +Method and Description | +
---|---|
ServerEndpointConfig.Builder |
+ServerEndpointConfig.Builder.configurator(ServerEndpointConfig.Configurator serverEndpointConfigurator)
+Sets the custom configurator to use on the configuration object built by this builder.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket.server | +
+ This package contains all the Jakarta WebSocket APIs used only by server side applications.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
ServerEndpointConfig |
+ServerEndpointConfig.Builder.build()
+Builds the configuration object using the current attributes that have been set on this builder object.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
Set<ServerEndpointConfig> |
+ServerApplicationConfig.getEndpointConfigs(Set<Class<? extends Endpoint>> endpointClasses)
+Return a set of ServerEndpointConfig instances that the server container will use to deploy the programmatic
+ endpoints.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+ServerContainer.addEndpoint(ServerEndpointConfig serverConfig) |
+
void |
+ServerEndpointConfig.Configurator.modifyHandshake(ServerEndpointConfig sec,
+ HandshakeRequest request,
+ HandshakeResponse response)
+Called by the container after it has formulated a handshake response resulting from a well-formed handshake
+ request.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
See: Description
+Interface | +Description | +
---|---|
HandshakeRequest | +
+ The handshake request represents the WebSocket defined HTTP GET request for the opening handshake of a WebSocket
+ session.
+ |
+
ServerApplicationConfig | +
+ Developers include implementations of ServerApplicationConfig in an archive containing websocket endpoints (WAR file,
+ or JAR file within the WAR file) in order to specify the websocket endpoints within the archive the implementation
+ must deploy.
+ |
+
ServerContainer | +
+ The ServerContainer is the specialized view of the WebSocketContainer available in server-side deployments.
+ |
+
ServerEndpointConfig | +
+ The ServerEndpointConfig is a special kind of endpoint configuration object that contains web socket configuration
+ information specific only to server endpoints.
+ |
+
Class | +Description | +
---|---|
ServerEndpointConfig.Builder | +
+ The ServerEndpointConfig.Builder is a class used for creating
+ServerEndpointConfig.Builder objects for
+ the purposes of deploying a server endpoint. |
+
ServerEndpointConfig.Configurator | +
+ The ServerEndpointConfig.Configurator class may be extended by developers who want to provide custom
+ configuration algorithms, such as intercepting the opening handshake, or providing arbitrary methods and
+ algorithms that can be accessed from each endpoint instance configured with this configurator.
+ |
+
Annotation Type | +Description | +
---|---|
PathParam | +
+ This annotation may be used to annotate method parameters on server endpoints where a URI-template has been used in
+ the path-mapping of the
+ServerEndpoint annotation. |
+
ServerEndpoint | +
+ This class level annotation declares that the class it decorates is a web socket endpoint that will be deployed and
+ made available in the URI-space of a web socket server.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Package | +Description | +
---|---|
jakarta.websocket.server | +
+ This package contains all the Jakarta WebSocket APIs used only by server side applications.
+ |
+
Class and Description | +
---|
HandshakeRequest
+ The handshake request represents the WebSocket defined HTTP GET request for the opening handshake of a WebSocket
+ session.
+ |
+
ServerEndpointConfig
+ The ServerEndpointConfig is a special kind of endpoint configuration object that contains web socket configuration
+ information specific only to server endpoints.
+ |
+
ServerEndpointConfig.Builder
+ The ServerEndpointConfig.Builder is a class used for creating
+ServerEndpointConfig.Builder objects for
+ the purposes of deploying a server endpoint. |
+
ServerEndpointConfig.Configurator
+ The ServerEndpointConfig.Configurator class may be extended by developers who want to provide custom
+ configuration algorithms, such as intercepting the opening handshake, or providing arbitrary methods and
+ algorithms that can be accessed from each endpoint instance configured with this configurator.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
+ + diff --git a/websocket/2.0/apidocs/overview-summary.html b/websocket/2.0/apidocs/overview-summary.html new file mode 100644 index 0000000000..cad82c46fd --- /dev/null +++ b/websocket/2.0/apidocs/overview-summary.html @@ -0,0 +1,150 @@ + + + + + + +
Package | +Description | +
---|---|
jakarta.websocket | +
+ This package contains all the Jakartq WebSocket APIs common to both the client and server side.
+ |
+
jakarta.websocket.server | +
+ This package contains all the Jakarta WebSocket APIs used only by server side applications.
+ |
+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.
ByteBuffer bb+
String encodedString+
Object object+
Session session+
Comments to: websocket-dev@eclipse.org.
Copyright © 2018, 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.