Examples of HeadersAdaptor


Examples of io.vertx.core.http.impl.HeadersAdaptor

    public void testHandle_JSON_POST() throws Exception {

        DefaultHttpHeaders headers = new DefaultHttpHeaders();
        headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
        when(request.method()).thenReturn(HttpMethod.POST);
        when(request.headers()).thenReturn(new HeadersAdaptor(headers));

        jerseyHandler.init(options);
        jerseyHandler.handle(request);

        verify(request).handler(dataHandlerCaptor.capture());
View Full Code Here

Examples of io.vertx.core.http.impl.HeadersAdaptor

        DefaultHttpHeaders headers = new DefaultHttpHeaders();
        headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_OCTET_STREAM);

        when(request.method()).thenReturn(HttpMethod.GET).thenReturn(HttpMethod.PUT);
        when(request.headers()).thenReturn(new HeadersAdaptor(headers));

        result = jerseyHandler.shouldReadData(request);
        assertFalse(result);

        result = jerseyHandler.shouldReadData(request);
View Full Code Here

Examples of io.vertx.core.http.impl.HeadersAdaptor

        MultivaluedMap<String, String> headers = new MultivaluedHashMap<>();
        when(cr.getStatusInfo()).thenReturn(mock(Response.StatusType.class));
        when(cr.getStringHeaders()).thenReturn(headers);

        DefaultHttpHeaders httpHeaders = new DefaultHttpHeaders();
        MultiMap vertxHeaders = new HeadersAdaptor(httpHeaders);
        vertxHeaders.add(HttpHeaders.CONTENT_LENGTH, "12");
        when(response.headers()).thenReturn(vertxHeaders);

        OutputStream outputStream = writer.writeResponseStatusAndHeaders(12, cr);

        outputStream.write("callback".getBytes());
View Full Code Here

Examples of io.vertx.core.http.impl.HeadersAdaptor

    server.listen(onSuccess(consumer));
  }

  private static MultiMap getHeaders(int num) {
    Map<String, String> map = genMap(num);
    MultiMap headers = new HeadersAdaptor(new DefaultHttpHeaders());
    for (Map.Entry<String, String> entry : map.entrySet()) {
      headers.add(entry.getKey(), entry.getValue());
    }
    return headers;
  }
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.