Examples of HttpField


Examples of org.eclipse.jetty.http.HttpField

        HttpFields fields = new HttpFields();
       

        HttpField[] field =
        {
           new HttpField("fo0","b0r"),
           new HttpField("fo1","b1r"),
           new HttpField("fo2","b2r"),
           new HttpField("fo3","b3r"),
           new HttpField("fo4","b4r"),
           new HttpField("fo5","b5r"),
           new HttpField("fo6","b6r"),
           new HttpField("fo7","b7r"),
           new HttpField("fo8","b8r"),
           new HttpField("fo9","b9r"),
           new HttpField("foA","bAr"),
        };
       
        // Add 4 entries
        for (int i=0;i<=3;i++
            fields.add(field[i]);
View Full Code Here

Examples of org.eclipse.jetty.http.HttpField

        assertEquals(HttpScheme.HTTP.asString(),request.getURI().getScheme());
        assertEquals("/",request.getURI().getPath());
        assertEquals("www.example.com",request.getURI().getHost());
        Iterator<HttpField> iterator=request.iterator();
        assertTrue(iterator.hasNext());
        assertEquals(new HttpField("cache-control","no-cache"),iterator.next());
        assertFalse(iterator.hasNext());
       

        // Third request
        encoded="828785bf400a637573746f6d2d6b65790c637573746f6d2d76616c7565";
        buffer = ByteBuffer.wrap(TypeUtil.fromHexString(encoded));
       
        request = (MetaData.Request)decoder.decode(buffer);
       
        assertEquals("GET",request.getMethod());
        assertEquals(HttpScheme.HTTPS.asString(),request.getURI().getScheme());
        assertEquals("/index.html",request.getURI().getPath());
        assertEquals("www.example.com",request.getURI().getHost());
        iterator=request.iterator();
        assertTrue(iterator.hasNext());
        assertEquals(new HttpField("custom-key","custom-value"),iterator.next());
        assertFalse(iterator.hasNext());
    }
View Full Code Here

Examples of org.eclipse.jetty.http.HttpField

        assertEquals(HttpScheme.HTTP.asString(),request.getURI().getScheme());
        assertEquals("/",request.getURI().getPath());
        assertEquals("www.example.com",request.getURI().getHost());
        Iterator<HttpField> iterator=request.iterator();
        assertTrue(iterator.hasNext());
        assertEquals(new HttpField("cache-control","no-cache"),iterator.next());
        assertFalse(iterator.hasNext());

    }
View Full Code Here

Examples of org.eclipse.jetty.http.HttpField

   
    @Test
    public void testEmptyAdd()
    {
        HpackContext ctx = new HpackContext(0);
        HttpField field = new HttpField("foo","bar");
        Assert.assertNull(ctx.add(field));
    }
View Full Code Here

Examples of org.eclipse.jetty.http.HttpField

   
    @Test
    public void testTooBigAdd()
    {
        HpackContext ctx = new HpackContext(37);
        HttpField field = new HttpField("foo","bar");
        Assert.assertNull(ctx.add(field));
    }
View Full Code Here

Examples of org.eclipse.jetty.http.HttpField

   
    @Test
    public void testJustRight()
    {
        HpackContext ctx = new HpackContext(38);
        HttpField field = new HttpField("foo","bar");
        Entry entry=ctx.add(field);
        Assert.assertNotNull(entry);
        Assert.assertThat(entry.toString(),Matchers.startsWith("{D,0,foo: bar,"));
    }
View Full Code Here

Examples of org.eclipse.jetty.http.HttpField

   
    @Test
    public void testEvictOne()
    {
        HpackContext ctx = new HpackContext(38);
        HttpField field0 = new HttpField("foo","bar");
       
        assertEquals(field0,ctx.add(field0).getHttpField());
        assertEquals(field0,ctx.get("foo").getHttpField());
       
        HttpField field1 = new HttpField("xxx","yyy");
        assertEquals(field1,ctx.add(field1).getHttpField());

        assertNull(ctx.get(field0));
        assertNull(ctx.get("foo"));
        assertEquals(field1,ctx.get(field1).getHttpField());
View Full Code Here

Examples of org.eclipse.jetty.http.HttpField

    public void testEvictNames()
    {
        HpackContext ctx = new HpackContext(38*2);
        HttpField[] field =
        {
           new HttpField("name","v0"),
           new HttpField("name","v1"),
           new HttpField("name","v2"),
           new HttpField("name","v3"),
           new HttpField("name","v4"),
           new HttpField("name","v5"),
        };
       
        Entry[] entry = new Entry[field.length];
       
        // Add 2 name entries to fill table
        for (int i=0;i<=1;i++)
            entry[i]=ctx.add(field[i]);
       
        // check there is a name reference and it is the most recent added
        assertEquals(entry[1],ctx.get("name"));

        // Add 1 other entry to table and evict 1
        ctx.add(new HttpField("xxx","yyy"));
       
        // check the name reference has been not been evicted
        assertEquals(entry[1],ctx.get("name"));
       
        // Add 1 other entry to table and evict 1
        ctx.add(new HttpField("foo","bar"));
       
        // name is evicted
        assertNull(ctx.get("name"));
    }
View Full Code Here

Examples of org.eclipse.jetty.http.HttpField

    public void testGetAddStatic()
    {
        HpackContext ctx = new HpackContext(4096);

        // Look for the field.  Should find static version.
        HttpField methodGet = new HttpField(":method","GET");
        assertEquals(methodGet,ctx.get(methodGet).getHttpField());
        assertTrue(ctx.get(methodGet).isStatic());
       
        // Add static version to header table
        Entry e0=ctx.add(ctx.get(methodGet).getHttpField());
View Full Code Here

Examples of org.eclipse.jetty.http.HttpField

   
    @Test
    public void testGetAddStaticName()
    {
        HpackContext ctx = new HpackContext(4096);
        HttpField methodOther = new HttpField(":method","OTHER");

        // Look for the field by name.  Should find static version.
        assertEquals(":method",ctx.get(":method").getHttpField().getName());
        assertTrue(ctx.get(":method").isStatic());
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.