Package org.eclipse.jetty.websocket.jsr356.encoders

Examples of org.eclipse.jetty.websocket.jsr356.encoders.PrimitiveEncoderMetadataSet


                }
                return;
            }
            if (wrapper.wantsPartialMessages())
            {
                activeMessage = new TextPartialMessage(wrapper);
            }
            else if (wrapper.wantsStreams())
            {
                final MessageReader stream = new MessageReader(new MessageInputStream());
                activeMessage = stream;
View Full Code Here


                    }
                });
            }
            else
            {
                activeMessage = new TextWholeMessage(this,wrapper);
            }
        }

        activeMessage.appendFrame(buffer,fin);
View Full Code Here

        {
            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)
View Full Code Here

    {
        if (LOG.isDebugEnabled())
        {
            LOG.debug("getMetadataFor({})",type);
        }
        DecoderMetadata metadata = metadatas.getMetadataByType(type);

        if (metadata != null)
        {
            return metadata;
        }
View Full Code Here

            }

            if (wrapper == null)
            {
                // Attempt to create Wrapper on demand
                DecoderMetadata metadata = metadatas.getMetadataByType(type);
                if (metadata == null)
                {
                    return null;
                }
                wrapper = newWrapper(metadata);
View Full Code Here

    {
        List<MessageHandlerMetadata> metadatas = factory.getMetadata(ByteArrayPartialHandler.class);
        Assert.assertThat("Metadata.list.size",metadatas.size(),is(1));

        MessageHandlerMetadata handlerMetadata = metadatas.get(0);
        DecoderMetadata decoderMetadata = decoders.getMetadataFor(handlerMetadata.getMessageClass());
        Assert.assertThat("Message Type",decoderMetadata.getMessageType(),is(MessageType.BINARY));
        Assert.assertThat("Message Class",handlerMetadata.getMessageClass(),is((Type)byte[].class));
    }
View Full Code Here

    {
        List<MessageHandlerMetadata> metadatas = factory.getMetadata(StringPartialHandler.class);
        Assert.assertThat("Metadata.list.size",metadatas.size(),is(1));

        MessageHandlerMetadata handlerMetadata = metadatas.get(0);
        DecoderMetadata decoderMetadata = decoders.getMetadataFor(handlerMetadata.getMessageClass());
        Assert.assertThat("Message Type",decoderMetadata.getMessageType(),is(MessageType.TEXT));
        Assert.assertThat("Message Class",handlerMetadata.getMessageClass(),is((Type)String.class));
    }
View Full Code Here

    private DecoderMetadataSet metadatas;
    private DecoderFactory factory;

    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);
    }
View Full Code Here

    }

    @Test
    public void testMatchDateDecoder()
    {
        DecoderMetadata metadata = new DecoderMetadata(DateDecoder.class,Date.class,MessageType.TEXT,false);
        JsrParamIdDecoder paramId = new JsrParamIdDecoder(metadata);

        JsrCallable callable = getOnMessageCallableFrom(DateTextSocket.class,"onMessage");
        Param param = new Param(0,Date.class,null);
View Full Code Here

    }

    private void assertDecoderType(Class<? extends Decoder> expectedDecoder, MessageType expectedMsgType, Class<?> type)
    {
        PrimitiveDecoderMetadataSet primitives = new PrimitiveDecoderMetadataSet();
        DecoderMetadata metadata = primitives.getMetadataByType(type);
        String prefix = String.format("Metadata By Type [%s]",type.getName());
        Assert.assertThat(prefix,metadata,notNullValue());

        assertClassEquals(prefix + ".coderClass",metadata.getCoderClass(),expectedDecoder);
        Assert.assertThat(prefix + ".messageType",metadata.getMessageType(),is(expectedMsgType));
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.websocket.jsr356.encoders.PrimitiveEncoderMetadataSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.