use of org.eclipse.jetty.websocket.jsr356.metadata.DecoderMetadata in project jetty.project by eclipse.
the class DecoderFactory method getWrapperFor.
public Wrapper getWrapperFor(Class<?> type) {
synchronized (activeWrappers) {
Wrapper wrapper = activeWrappers.get(type);
// Try parent (if needed)
if ((wrapper == null) && (parentFactory != null)) {
wrapper = parentFactory.getWrapperFor(type);
}
if (wrapper == null) {
// Attempt to create Wrapper on demand
DecoderMetadata metadata = metadatas.getMetadataByType(type);
if (metadata == null) {
return null;
}
wrapper = newWrapper(metadata);
// track wrapper
activeWrappers.put(type, wrapper);
}
return wrapper;
}
}
use of org.eclipse.jetty.websocket.jsr356.metadata.DecoderMetadata in project jetty.project by eclipse.
the class JsrSession method removeMessageHandler.
@Override
public void removeMessageHandler(MessageHandler handler) {
synchronized (wrappers) {
try {
for (MessageHandlerMetadata metadata : messageHandlerFactory.getMetadata(handler.getClass())) {
DecoderMetadata decoder = decoderFactory.getMetadataFor(metadata.getMessageClass());
MessageType key = decoder.getMessageType();
wrappers[key.ordinal()] = null;
}
updateMessageHandlerSet();
} catch (IllegalStateException e) {
LOG.warn("Unable to identify MessageHandler: " + handler.getClass().getName(), e);
}
}
}
use of org.eclipse.jetty.websocket.jsr356.metadata.DecoderMetadata in project jetty.project by eclipse.
the class DecoderFactoryTest method assertMetadataFor.
private void assertMetadataFor(Class<?> type, Class<? extends Decoder> expectedDecoderClass, MessageType expectedType) {
DecoderMetadata metadata = factory.getMetadataFor(type);
Assert.assertEquals("metadata.coderClass", metadata.getCoderClass(), expectedDecoderClass);
Assert.assertThat("metadata.messageType", metadata.getMessageType(), is(expectedType));
Assert.assertEquals("metadata.objectType", metadata.getObjectType(), type);
}
Aggregations