Search in sources :

Example 1 with HeadersMultiMap

use of io.vertx.core.http.impl.headers.HeadersMultiMap in project vert.x by eclipse.

the class VertxHttpResponseEncoder method encodeHeaders.

@Override
protected void encodeHeaders(HttpHeaders headers, ByteBuf buf) {
    if (headers instanceof HeadersMultiMap) {
        HeadersMultiMap vertxHeaders = (HeadersMultiMap) headers;
        vertxHeaders.encode(buf);
    } else {
        super.encodeHeaders(headers, buf);
    }
}
Also used : HeadersMultiMap(io.vertx.core.http.impl.headers.HeadersMultiMap)

Example 2 with HeadersMultiMap

use of io.vertx.core.http.impl.headers.HeadersMultiMap in project vert.x by eclipse.

the class Http1xServerResponse method trailers.

@Override
public MultiMap trailers() {
    if (trailers == null) {
        HeadersMultiMap v = HeadersMultiMap.httpHeaders();
        trailers = v;
        trailingHeaders = v;
    }
    return trailers;
}
Also used : HeadersMultiMap(io.vertx.core.http.impl.headers.HeadersMultiMap)

Example 3 with HeadersMultiMap

use of io.vertx.core.http.impl.headers.HeadersMultiMap in project vert.x by eclipse.

the class VertxHttpHeadersTest method testNonCharSequenceValue.

@Test
public void testNonCharSequenceValue() {
    HeadersMultiMap mmap = newMultiMap();
    mmap.set("key1", 0);
    assertEquals("0", mmap.get("key1"));
    mmap.set((CharSequence) "key2", 1);
    assertEquals("1", mmap.get("key2"));
    mmap.set("key3", Arrays.asList(2, 3));
    assertEquals("2", mmap.get("key3"));
    mmap.set((CharSequence) "key4", Arrays.asList(4, 5));
    assertEquals("4", mmap.get("key4"));
    mmap.add("key5", 6);
    assertEquals("6", mmap.get("key5"));
    mmap.add((CharSequence) "key6", 7);
    assertEquals("7", mmap.get("key6"));
    mmap.add("key8", Arrays.asList(2, 3));
    assertEquals("2", mmap.get("key8"));
    mmap.add((CharSequence) "key9", Arrays.asList(4, 5));
    assertEquals("4", mmap.get("key9"));
}
Also used : HeadersMultiMap(io.vertx.core.http.impl.headers.HeadersMultiMap) Test(org.junit.Test)

Example 4 with HeadersMultiMap

use of io.vertx.core.http.impl.headers.HeadersMultiMap in project vert.x by eclipse.

the class VertxHttpHeadersTest method testContainsValue1.

@Test
public void testContainsValue1() {
    HeadersMultiMap mmap = newMultiMap();
    mmap.add("foo", "val1,val2,val3");
    assertTrue(mmap.containsValue("foo", "val1", true));
    assertTrue(mmap.containsValue("foo", "val2", true));
    assertTrue(mmap.containsValue("foo", "val3", true));
    assertTrue(mmap.containsValue("foo", "VAL1", true));
    assertTrue(mmap.containsValue("foo", "VAL2", true));
    assertTrue(mmap.containsValue("foo", "VAL3", true));
    assertFalse(mmap.containsValue("foo", "val4", true));
    assertFalse(mmap.containsValue("foo", "helloworld", true));
}
Also used : HeadersMultiMap(io.vertx.core.http.impl.headers.HeadersMultiMap) Test(org.junit.Test)

Example 5 with HeadersMultiMap

use of io.vertx.core.http.impl.headers.HeadersMultiMap in project vert.x by eclipse.

the class VertxHttpHeadersTest method testContainsValue2.

@Test
public void testContainsValue2() {
    HeadersMultiMap mmap = newMultiMap();
    mmap.add("foo", "val1 , val2 , val3");
    assertTrue(mmap.containsValue("foo", "val1", true));
    assertTrue(mmap.containsValue("foo", "val2", true));
    assertTrue(mmap.containsValue("foo", "val3", true));
    assertFalse(mmap.containsValue("foo", "val4", true));
    assertFalse(mmap.containsValue("foo", "helloworld", true));
}
Also used : HeadersMultiMap(io.vertx.core.http.impl.headers.HeadersMultiMap) Test(org.junit.Test)

Aggregations

HeadersMultiMap (io.vertx.core.http.impl.headers.HeadersMultiMap)16 Test (org.junit.Test)13 ByteBuf (io.netty.buffer.ByteBuf)1 ByteBufAllocator (io.netty.buffer.ByteBufAllocator)1 CompositeByteBuf (io.netty.buffer.CompositeByteBuf)1 Unpooled (io.netty.buffer.Unpooled)1 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)1 SimpleChannelInboundHandler (io.netty.channel.SimpleChannelInboundHandler)1 EmbeddedChannel (io.netty.channel.embedded.EmbeddedChannel)1 DefaultFullHttpResponse (io.netty.handler.codec.http.DefaultFullHttpResponse)1 FullHttpResponse (io.netty.handler.codec.http.FullHttpResponse)1 HttpHeaderNames (io.netty.handler.codec.http.HttpHeaderNames)1 HttpHeaders (io.netty.handler.codec.http.HttpHeaders)1 HttpRequest (io.netty.handler.codec.http.HttpRequest)1 HttpRequestDecoder (io.netty.handler.codec.http.HttpRequestDecoder)1 HttpResponseEncoder (io.netty.handler.codec.http.HttpResponseEncoder)1 HttpResponseStatus (io.netty.handler.codec.http.HttpResponseStatus)1 HttpVersion (io.netty.handler.codec.http.HttpVersion)1 AsciiString (io.netty.util.AsciiString)1 CharsetUtil (io.netty.util.CharsetUtil)1