Examples of addHeader()


Examples of com.facebook.presto.jdbc.internal.netty.handler.codec.http.DefaultHttpRequest.addHeader()

                    expectedChallengeResponseString));
        }

        // Format request
        HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path);
        request.addHeader(Names.UPGRADE, Values.WEBSOCKET.toLowerCase());
        request.addHeader(Names.CONNECTION, Values.UPGRADE);
        request.addHeader(Names.SEC_WEBSOCKET_KEY, key);
        request.addHeader(Names.HOST, wsURL.getHost());

        int wsPort = wsURL.getPort();
View Full Code Here

Examples of com.facebook.presto.jdbc.internal.netty.handler.codec.http.DefaultHttpResponse.addHeader()

        if (logger.isDebugEnabled()) {
            logger.debug(String.format("WS Version 8 Server Handshake key: %s. Response: %s.", key, accept));
        }

        res.setStatus(HttpResponseStatus.SWITCHING_PROTOCOLS);
        res.addHeader(Names.UPGRADE, WEBSOCKET.toLowerCase());
        res.addHeader(Names.CONNECTION, Names.UPGRADE);
        res.addHeader(Names.SEC_WEBSOCKET_ACCEPT, accept);
        String subprotocols = req.getHeader(Names.SEC_WEBSOCKET_PROTOCOL);
        if (subprotocols != null) {
            String selectedSubprotocol = selectSubprotocol(subprotocols);
View Full Code Here

Examples of com.facebook.presto.jdbc.internal.netty.handler.codec.http.HttpMessage.addHeader()

            }

            // Ignore trailers in a truncated HEADERS frame.
            if (!spdyHeadersFrame.isTruncated()) {
                for (Map.Entry<String, String> e : spdyHeadersFrame.getHeaders()) {
                    httpMessage.addHeader(e.getKey(), e.getValue());
                }
            }

            if (spdyHeadersFrame.isLast()) {
                HttpHeaders.setContentLength(httpMessage, httpMessage.getContent().readableBytes());
View Full Code Here

Examples of com.facebook.presto.jdbc.internal.netty.handler.codec.http.HttpRequest.addHeader()

                    expectedChallengeResponseString));
        }

        // Format request
        HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path);
        request.addHeader(Names.UPGRADE, Values.WEBSOCKET.toLowerCase());
        request.addHeader(Names.CONNECTION, Values.UPGRADE);
        request.addHeader(Names.SEC_WEBSOCKET_KEY, key);
        request.addHeader(Names.HOST, wsURL.getHost());

        int wsPort = wsURL.getPort();
View Full Code Here

Examples of com.facebook.presto.jdbc.internal.netty.handler.codec.http.HttpResponse.addHeader()

        if (logger.isDebugEnabled()) {
            logger.debug(String.format("WS Version 8 Server Handshake key: %s. Response: %s.", key, accept));
        }

        res.setStatus(HttpResponseStatus.SWITCHING_PROTOCOLS);
        res.addHeader(Names.UPGRADE, WEBSOCKET.toLowerCase());
        res.addHeader(Names.CONNECTION, Names.UPGRADE);
        res.addHeader(Names.SEC_WEBSOCKET_ACCEPT, accept);
        String subprotocols = req.getHeader(Names.SEC_WEBSOCKET_PROTOCOL);
        if (subprotocols != null) {
            String selectedSubprotocol = selectSubprotocol(subprotocols);
View Full Code Here

Examples of com.github.tomakehurst.wiremock.matching.RequestPattern.addHeader()

    private RequestPattern buildRequestPatternFrom(Request request) {
        RequestPattern requestPattern = new RequestPattern(request.getMethod(), request.getUrl());
        if (!headersToMatch.isEmpty()) {
            for (HttpHeader header: request.getHeaders().all()) {
                if (headersToMatch.contains(header.caseInsensitiveKey())) {
                    requestPattern.addHeader(header.key(), ValuePattern.equalTo(header.firstValue()));
                }
            }
        }

        String body = request.getBodyAsString();
View Full Code Here

Examples of com.google.api.client.testing.http.MockLowLevelHttpResponse.addHeader()

          GenericData responseData;
          if (statusCode == 401 || wwwAuthenticate != null) {
            // return 401 or invalid_token error (with the given status code), and then reset
            // wwwAuthenticate and statusCode - so next request to refresh the token will succeed
            if (wwwAuthenticate != null) {
              response.addHeader("WWW-Authenticate", wwwAuthenticate);
              wwwAuthenticate = null;
            }

            response.setStatusCode(statusCode);
            statusCode = 200;
View Full Code Here

Examples of com.google.api.explorer.client.base.rest.RestApiRequest.addHeader()

    // If the user has declared a body, set it on the request.
    String body = display.getBodyText();
    if (!body.isEmpty()) {
      req.body = body;
      req.addHeader("Content-Type", "application/json");
    }

    Multimap<String, String> paramValues = display.getParameterValues();
    for (Map.Entry<String, String> entry : paramValues.entries()) {
      if (entry.getValue().isEmpty()) {
View Full Code Here

Examples of com.google.appengine.api.urlfetch.HTTPRequest.addHeader()

    URL url = new URL(config.getJsonRpcServer());

    URLFetchService ufs = URLFetchServiceFactory.getURLFetchService();
    HTTPRequest req = new HTTPRequest(url, HTTPMethod.POST);
    req.setPayload(getwork.toString().getBytes());
    req.addHeader(new HTTPHeader("Authorization", config.getAuth()));

    HTTPResponse resp = ufs.fetch(req);
    String content = new String(resp.getContent());
    if (resp.getResponseCode() != 200) {
      throw new IOException( //
View Full Code Here

Examples of com.google.appengine.api.urlfetch.MockHttpResponse.addHeader()

   
    @Test
    public void testReadResponseHeaders() throws Exception {
        GHttpEndpoint endpoint = createEndpoint("ghttp://somewhere.com:9090/path");
        MockHttpResponse response = new MockHttpResponse(200);
        response.addHeader("test", "abc");
        response.addHeader("content-type", "text/plain");
        binding.readResponseHeaders(endpoint, exchange, response);
        assertEquals(200, exchange.getOut().getHeader(Exchange.HTTP_RESPONSE_CODE));
        assertEquals("abc", exchange.getOut().getHeader("test"));
        assertEquals("text/plain", exchange.getOut().getHeader("content-type"));
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.