Package org.eclipse.jetty.http

Examples of org.eclipse.jetty.http.MetaData


            else
            {
                toDecode = buffer;
            }

            MetaData result = hpackDecoder.decode(toDecode);

            buffer.limit(limit);
            byteBufferPool.release(blockBuffer);

            return result;
View Full Code Here


                    }
                    break;
                }
                case HEADERS:
                {
                    MetaData metaData = headerBlockParser.parse(buffer, length);
                    if (metaData != null)
                    {
                        state = State.PADDING;
                        loop = paddingLength == 0;
                        if (onPushPromise(streamId, metaData))
View Full Code Here

    }

    @Override
    protected boolean emptyBody()
    {
        MetaData metaData = headerBlockParser.parse(BufferUtil.EMPTY_BUFFER, 0);
        boolean result = onHeaders(0, 0, false, metaData);
        reset();
        return result;
    }
View Full Code Here

                    loop = length == 0;
                    break;
                }
                case HEADERS:
                {
                    MetaData metaData = headerBlockParser.parse(buffer, length);
                    if (metaData != null)
                    {
                        state = State.PADDING;
                        loop = paddingLength == 0;
                        if (onHeaders(streamId, weight, exclusive, metaData))
View Full Code Here

    }

    @Override
    public Result parse(ByteBuffer buffer)
    {
        MetaData metaData = headerBlockParser.parse(buffer, getBodyLength());
        if (metaData != null)
        {
            // TODO: CONTINUATION frames are not supported for now, we just parse them to keep HPACK happy.
            return Result.ASYNC;
        }
View Full Code Here

        ByteBuffer buffer = BufferUtil.allocate(16*1024);
       
        HttpFields fields0 = new HttpFields();
        fields0.add("1234567890","1234567890123456789012345678901234567890");
        fields0.add("Cookie","abcdeffhijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQR");
        MetaData original0= new MetaData(HttpVersion.HTTP_2,fields0);
       
        BufferUtil.clearToFill(buffer);
        encoder.encode(buffer,original0);
        BufferUtil.flipToFlush(buffer,0);
        MetaData decoded0 = (MetaData)decoder.decode(buffer);

        Assert.assertEquals(original0,decoded0);
              
        HttpFields fields1 = new HttpFields();
        fields1.add("1234567890","1234567890123456789012345678901234567890");
        fields1.add("Cookie","abcdeffhijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQR");
        fields1.add("x","y");
        MetaData original1 = new MetaData(HttpVersion.HTTP_2,fields1);

        BufferUtil.clearToFill(buffer);
        encoder.encode(buffer,original1);
        BufferUtil.flipToFlush(buffer,0);
        try
View Full Code Here

                        _unencodedSize+=e.getKey().length()+e.getValue().length();
                       
                    }

                    BufferUtil.clearToFill(buffer);
                    encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2,fields));
                    BufferUtil.flipToFlush(buffer,0);
                    _encodedSize+=buffer.remaining();
                   
                }
            }
View Full Code Here

            fields.add(field[i]);
       
        // encode them
        ByteBuffer buffer = BufferUtil.allocate(4096);
        int pos = BufferUtil.flipToFill(buffer);
        encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2,fields));
        BufferUtil.flipToFlush(buffer,pos);
       
        // something was encoded!
        assertThat(buffer.remaining(),Matchers.greaterThan(0));
       
        // All are in the header table
        Assert.assertEquals(4,encoder.getContext().size());
               
        // encode exact same fields again!
        BufferUtil.clearToFill(buffer);
        encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2,fields));
        BufferUtil.flipToFlush(buffer,0);

        // All are in the header table
        Assert.assertEquals(4,encoder.getContext().size());
       
        // Add 4 more fields
        for (int i=4;i<=7;i++
            fields.add(field[i]);
       
        // encode
        BufferUtil.clearToFill(buffer);
        encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2,fields));
        BufferUtil.flipToFlush(buffer,0);

        // something was encoded!
        assertThat(buffer.remaining(),Matchers.greaterThan(0));

        // max header table size reached
        Assert.assertEquals(5,encoder.getContext().size());
       
       
        // remove some fields
        for (int i=0;i<=7;i+=2
            fields.remove(field[i].getName());

        // encode
        BufferUtil.clearToFill(buffer);
        encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2,fields));
        BufferUtil.flipToFlush(buffer,0);
       
        // something was encoded!
        assertThat(buffer.remaining(),Matchers.greaterThan(0));

        // max header table size reached
        Assert.assertEquals(5,encoder.getContext().size());


        // remove another fields
        fields.remove(field[1].getName());

        // encode
        BufferUtil.clearToFill(buffer);
        encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2,fields));
        BufferUtil.flipToFlush(buffer,0);
       
        // something was encoded!
        assertThat(buffer.remaining(),Matchers.greaterThan(0));

        // max header table size reached
        Assert.assertEquals(5,encoder.getContext().size());

       
        // re add the field

        fields.add(field[1]);

        // encode
        BufferUtil.clearToFill(buffer);
        encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2,fields));
        BufferUtil.flipToFlush(buffer,0);
       
        // something was encoded!
        assertThat(buffer.remaining(),Matchers.greaterThan(0));
View Full Code Here

        HttpFields fields = new HttpFields();
        fields.put("set-cookie","some cookie value");

        // encode
        BufferUtil.clearToFill(buffer);
        encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2,fields));
        BufferUtil.flipToFlush(buffer,0);
       
        // something was encoded!
        assertThat(buffer.remaining(),Matchers.greaterThan(0));
       
        // empty header table
        Assert.assertEquals(0,encoder.getContext().size());
       

        // encode again
        BufferUtil.clearToFill(buffer);
        encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2,fields));
        BufferUtil.flipToFlush(buffer,0);
       
        // something was encoded!
        assertThat(buffer.remaining(),Matchers.greaterThan(0));
       
View Full Code Here

    }

    @Override
    public boolean onHeaders(HeadersFrame frame)
    {
        MetaData metaData = frame.getMetaData();
        if (metaData.isRequest())
        {
            IStream stream = createRemoteStream(frame.getStreamId());
            if (stream != null)
            {
                stream.updateClose(frame.isEndStream(), false);
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.http.MetaData

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.