-
Notifications
You must be signed in to change notification settings - Fork 46
Description
As outlined in #39 (comment) ...
Danny Coward states ...
then try to find a Decoder.Text or a Decoder.TextStream. Look, in order, through developer provided ones (single list, may contain both Text and TextStream types). Then look through platform provided ones. Use the first match to decode it. If the decode works, call the MessageHandler and stop, if not, call the onError/@websocket method with the decode exception and stop.
What is the search order when the "developer provided ones" comes from 2 places (annotations and configuration)?
@ServerEndpoint(
value = "/purchase",
decoders = {AppleDecoder.class, PearDecoder.class, FruitDecoder.class},
configurator = FruitStandConfigurator.class
)
public class PurchaseEndpoint
{
}
and in the container init ...
ServerContainer container = servletContext.getAttribuet(javax.websocket.server.ServerContainer.class.getName());
ServerEndpointConfig config = ServerEndpointConfig.Builder.create(PurchaseEndpoint.class, "/floo")
.decoders(Arrays.asList(CherryDecoder.class, BananaDecoder.class)).build();
container.addEndpoint(config);
What is the resulting search order of decoders?
Option 1: (EndpointConfig wins over Annotations)
- CherryDecoder.class
- BananaDecoder.class
- AppleDecoder.class
- PearDecoder.class
- FruitDecoder.class
- Platform Provided Decoders
Option 2: (Annotation wins over EndpointConfig)
- AppleDecoder.class
- PearDecoder.class
- FruitDecoder.class
- CherryDecoder.class
- BananaDecoder.class
- Platform Provided Decoders
(Does the order of the Platform Decoders matter? I don't think so)