Examples of headers()


Examples of com.github.kevinsawicki.http.HttpRequest.headers()

    when( httpRequest.contentType() ).thenReturn( MediaType.TEXT_PLAIN.toString() );
    HashMap<String, List<String>> headers = new HashMap<String, List<String>>();
    List<String> values = new ArrayList<String>();
    values.add( "test" );
    headers.put( "test", values );
    when( httpRequest.headers() ).thenReturn( headers );
    return httpRequest;
  }
 
  @Test
  public void testResponseCode() {
View Full Code Here

Examples of com.jcabi.http.Response.headers()

        final InputStream content
    ) throws IOException {
        final Response resp = this.origin
            .send(req, home, method, headers, content);
        final int remaining = Integer.parseInt(
            resp.headers().get("X-RateLimit-Remaining").get(0)
        );
        if (remaining < this.threshold) {
            final long reset = Long.parseLong(
                resp.headers().get("X-RateLimit-Reset").get(0)
            );
View Full Code Here

Examples of com.webobjects.appserver.WOResponse.headers()

      NSLog.out.appendln("form values " + request.formValues());
     
      WOResponse response =  super.dispatchRequest(request);
     
        //NSLog.out.appendln("returned response " + response.contentString());
        NSLog.out.appendln("returned response headers " + response.headers());
        NSLog.out.appendln("\n");
        return response;
    }

    return super.dispatchRequest(request);
View Full Code Here

Examples of com.woorea.openstack.base.client.OpenStackResponse.headers()

    @Override
    public ImageDownload execute() {
      // custom parsing here
      OpenStackResponse response = CLIENT.request(this);
      ImageDownload imageDownload = new ImageDownload();
      imageDownload.setImage(parse(response.headers()));
      imageDownload.setInputStream(response.getInputStream());
      return imageDownload;
    }

  }
View Full Code Here

Examples of feign.RequestTemplate.headers()

   */
  @Test public void testAuthentication() {
    RequestTemplate template = new RequestTemplate();
    BasicAuthRequestInterceptor interceptor = new BasicAuthRequestInterceptor("Aladdin", "open sesame");
    interceptor.apply(template);
    Collection<String> actualValue = template.headers().get("Authorization");
    Collection<String> expectedValue = Collections.singletonList("Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
    assertEquals(actualValue, expectedValue);
  }

  /**
 
View Full Code Here

Examples of io.netty.handler.codec.http.DefaultFullHttpRequest.headers()

            }
            if (buffer != null) {
                request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, uri, buffer);
                int len = buffer.readableBytes();
                // set content-length
                request.headers().set(HttpHeaders.Names.CONTENT_LENGTH, len);
                LOG.trace("Content-Length: {}", len);
            } else {
                // we do not support this kind of body
                throw new NoTypeConversionAvailableException(body, ByteBuf.class);
            }
View Full Code Here

Examples of io.netty.handler.codec.http.DefaultFullHttpResponse.headers()

    private void writeResponse(ChannelHandlerContext ctx, HttpRequest request, ByteBuf buf, CharSequence contentType, CharSequence contentLength) {
  // Decide whether to close the connection or not.
  boolean keepAlive = HttpHeaders.isKeepAlive(request);
  // Build the response object.
  FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK, buf, false);
  HttpHeaders headers = response.headers();
  headers.set(CONTENT_TYPE_ENTITY, contentType);
  headers.set(SERVER_ENTITY, SERVER_NAME);
  headers.set(DATE_ENTITY, date);
  headers.set(CONTENT_LENGTH_ENTITY, contentLength);
View Full Code Here

Examples of io.netty.handler.codec.http.DefaultHttpRequest.headers()

               {
                  //get this first incase it removes itself
                  HttpUpgradeHandler httpUpgradeHandler = (HttpUpgradeHandler) ch.pipeline().get("http-upgrade");
                  URI uri = new URI("http", null, host, port, null, null, null);
                  HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, uri.getRawPath());
                  request.headers().set(HttpHeaders.Names.HOST, host);
                  request.headers().set(HttpHeaders.Names.UPGRADE, HORNETQ_REMOTING);
                  request.headers().set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.UPGRADE);

                  final String endpoint = ConfigurationHelper.getStringProperty(TransportConstants.HTTP_UPGRADE_ENDPOINT_PROP_NAME,
                                                                                null,
View Full Code Here

Examples of io.netty.handler.codec.http.DefaultHttpResponse.headers()

        if (consumer.isSuspended()) {
            // are we suspended?
            LOG.debug("Consumer suspended, cannot service request {}", request);
            HttpResponse response = new DefaultHttpResponse(HTTP_1_1, SERVICE_UNAVAILABLE);
            response.headers().set(Exchange.CONTENT_TYPE, "text/plain");
            response.headers().set(Exchange.CONTENT_LENGTH, 0);
            ctx.writeAndFlush(response);
            return;
        }
View Full Code Here

Examples of io.netty.handler.codec.http.DefaultHttpResponse.headers()

        if (consumer.isSuspended()) {
            // are we suspended?
            LOG.debug("Consumer suspended, cannot service request {}", request);
            HttpResponse response = new DefaultHttpResponse(HTTP_1_1, SERVICE_UNAVAILABLE);
            response.headers().set(Exchange.CONTENT_TYPE, "text/plain");
            response.headers().set(Exchange.CONTENT_LENGTH, 0);
            ctx.writeAndFlush(response);
            return;
        }

        // if its an OPTIONS request then return which methods is allowed
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.