Return a copy of this request header with the given accepted response protocols set.

@param acceptedResponseProtocols The accepted response protocols to set.
@return A copy of this request header.
178984
public RequestHeader withAcceptedResponseProtocols(PSequence<MessageProtocol> acceptedResponseProtocols) {
        return new RequestHeader(method, uri, protocol, acceptedResponseProtocols, principal, headers, lowercaseHeaders);
    }
794045
public static Collection<String> getSupportedProtocols() {
        List<String> protocols = new ArrayList<>();
        protocols.add(DataPacketExtension.NAMESPACE);
        if (!IBB_ONLY) {
            protocols.add(Bytestream.NAMESPACE);
        }
        return Collections.unmodifiableList(protocols);
    }
100347
private Response response(final String home, final URI dest,
        final com.jcabi.http.Response rsp) {
        final Collection<String> hdrs = new LinkedList<>();
        hdrs.add(
            String.format(
                "X-Takes-TkProxy: from %s to %s by %s",
                home, dest, this.label
            )
        );
        for (final Map.Entry<String, List<String>> entry
            : rsp.headers().entrySet()) {
            for (final String value : entry.getValue()) {
                final String val;
                if (TkProxy.isHost(entry.getKey())) {
                    val = this.target.toString();
                } else {
                    val = value;
                }
                hdrs.add(String.format("%s: %s", entry.getKey(), val));
            }
        }
        return new RsWithStatus(
            new RsWithBody(
                new RsWithHeaders(hdrs),
                rsp.binary()
            ),
            rsp.status(),
            rsp.reason()
        );
    }
858839
public HttpHeaders preflightResponseHeaders() {
        if (preflightHeaders.isEmpty()) {
            return EmptyHttpHeaders.INSTANCE;
        }
        final HttpHeaders preflightHeaders = new DefaultHttpHeaders();
        for (Entry<CharSequence, Callable<?>> entry : this.preflightHeaders.entrySet()) {
            final Object value = getValue(entry.getValue());
            if (value instanceof Iterable) {
                preflightHeaders.add(entry.getKey(), (Iterable<?>) value);
            } else {
                preflightHeaders.add(entry.getKey(), value);
            }
        }
        return preflightHeaders;
    }
1045675
@Override
  public String getProtocol(HttpServletRequest request) {
    String proto = request.getHeader(X_FORWARED_PROTO);
    if( proto != null ) return proto;
    return super.getProtocol(request);
  }
961673
public HttpClientBuilder sslEnabledProtocols(String[] protocols) {
        if (protocols == null) {
            sslEnabledProtocols = null;
        } else {
            sslEnabledProtocols = new String[protocols.length];
            System.arraycopy(protocols, 0, sslEnabledProtocols, 0, protocols.length);
        }
        return this;
    }
1111207
SubjectIdentity getSubjectIdentity(final String protocol, final String forHost) {
        KeytabService selectedService = null;

        final String hostName = forHost == null ? null : forHost.toLowerCase(Locale.ENGLISH);
        String name = protocol + "/" + hostName;
        selectedService = hostServiceMap.get(name);
        if (selectedService == null) {
            SECURITY_LOGGER.tracef("No mapping for name '%s' to KeytabService, attempting to use host only match.", name);
            selectedService = hostServiceMap.get(hostName);
            if (selectedService == null) {
                SECURITY_LOGGER.tracef("No mapping for host '%s' to KeytabService, attempting to use default.", forHost);
                selectedService = defaultService;
            }
        }

        if (selectedService != null) {
            if (SECURITY_LOGGER.isTraceEnabled()) {
                SECURITY_LOGGER.tracef("Selected KeytabService with principal '%s' for host '%s'",
                        selectedService.getPrincipal(), forHost);
            }
            try {
                return selectedService.createSubjectIdentity(false);
            } catch (LoginException e) {
                SECURITY_LOGGER.keytabLoginFailed(selectedService.getPrincipal(), forHost, e);
                /*
                 * Allow to continue and return null, i.e. we have an error preventing Kerberos authentication so log that but
                 * other mechanisms may be available leaving the server still accessible.
                 */
            }
        } else {
            SECURITY_LOGGER.tracef("No KeytabService available for host '%s' unable to return SubjectIdentity.", forHost);
        }

        return null;
    }
241705
protected <T> ServiceResponse<T> makeBackwardCompatibleHttpPostRequestAndCreateServiceResponse(String uri, Object body, Class<T> resultType, Map<String, String> headers) {
        logger.debug("About to send POST request to '{}' with payload '{}'", uri, body);
        KieServerHttpRequest request = newRequest( uri ).headers(headers).body(serialize( body )).post();
        KieServerHttpResponse response = request.response();

        owner.setConversationId(response.header(KieServerConstants.KIE_CONVERSATION_ID_TYPE_HEADER));

        if ( response.code() == Response.Status.OK.getStatusCode() ) {
            ServiceResponse serviceResponse = deserialize( response.body(), ServiceResponse.class );
            // serialize it back to string to make it backward compatible
            serviceResponse.setResult(serialize(serviceResponse.getResult()));
            checkResultType(serviceResponse, resultType);
            return serviceResponse;
        } else {
            throw createExceptionForUnexpectedResponseCode( request, response );
        }
    }
316950
public static ProtocolSerializer getProtocolSerializer(ProtocolHeader header, Protocol protocol) throws JsonGenerationException, JsonMappingException, IOException{
        final String s = serializeProtocol(header, protocol);
        return new ProtocolSerializer(){

            @Override
            public String serializerAsString() {
                return s;
            }

        };
    }
947008
public com.google.protobuf.ByteString
      getProtocolBytes() {
    java.lang.Object ref = protocol_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      protocol_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }
358254
public RequestHeader clearPrincipal() {
        return new RequestHeader(method, uri, protocol, acceptedResponseProtocols, Optional.empty(), headers, lowercaseHeaders);
    }
579815
private void copyHeadersFromClient(HttpServletRequest pRequest, HttpURLConnection pRemoteConnection) {
        Enumeration headerNames = pRequest.getHeaderNames();
        while (headerNames.hasMoreElements()) {
            String headerName = (String) headerNames.nextElement();
            Enumeration headerValues = pRequest.getHeaders(headerName);

            // Skip the "host" header, as we want something else
            if (HTTP_REQUEST_HEADER_HOST.equalsIgnoreCase(headerName)) {
                // Skip this header
                headerName = null;
            }

            // Set the the header to the remoteConnection
            if (headerName != null) {
                // Convert from multiple line to single line, comma separated, as
                // there seems to be a shortcoming in the URLConneciton API...
                StringBuilder headerValue = new StringBuilder();
                while (headerValues.hasMoreElements()) {
                    String value = (String) headerValues.nextElement();
                    headerValue.append(value);
                    if (headerValues.hasMoreElements()) {
                        headerValue.append(", ");
                    }
                }

                //System.out.println("client -->>> remote: " + headerName + ": " + headerValue);
                pRemoteConnection.setRequestProperty(headerName, headerValue.toString());
            }
        }
    }
836039
public static <T extends VersionedProtocol> ProtocolProxy<T> getProtocolProxy(
      Class<T> protocol,
      long clientVersion, InetSocketAddress addr, Configuration conf)
      throws IOException {

    return getProtocolProxy(protocol, clientVersion, addr, conf, NetUtils
        .getDefaultSocketFactory(conf));
  }
617958
private Node getNodeToBeReplaced(Node parametersNode) {
        Node toBeReplaced = null;
        int responseCount = 0;
        NodeList childNodes = parametersNode.getChildNodes();
        if (childNodes != null) {
            for (int j = 0; j < childNodes.getLength(); j++) {
                Node childNode = childNodes.item(j);
                String name=childNode.getLocalName();
                if ("simpleResponse".equals(name) || "response".equals(name)) {
                    responseCount++;
                    if("response".equals(name)){
                        //This is the node that will need to be replaced with a copy with a localName of "simpleResponse"
                        toBeReplaced=childNode;
                    }
                }
                //If responseCount>1 This implies that both a simpleResponse and response have
                //been defined - this is allowed by the xsd, but makes no sense
                if (responseCount > 1) {
                    throw new IllegalArgumentException("Only one of either simpleResponse or response should define the response type");
                }
            }
        }
        return toBeReplaced;
    }
574100
public static ProtocolDeserializer getProtocolDeserializer(String jsonStr) throws JsonParseException, JsonMappingException, IOException{
        final ProtocolPair p = mapper.readValue(jsonStr, ProtocolPair.class);
        Protocol pp = null;
        if(p.getType() != null){
            pp = (Protocol) mapper.readValue(p.getProtocol(), p.getType());
        }
        final Protocol resp = pp;

        return new ProtocolDeserializer(){

            @Override
            public ProtocolHeader deserializerProtocolHeader() {
                return p.getProtocolHeader();
            }

            @Override
            public Protocol deserializerProtocol() {
                return resp;
            }

        };
    }
527081
public static ProtocolSignature getProtocolSignature(
      int clientMethodsHashCode,
      long serverVersion,
      Class<? extends VersionedProtocol> protocol) {
    // try to get the finger print & signature from the cache
    ProtocolSigFingerprint sig = getSigFingerprint(protocol, serverVersion);
    
    // check if the client side protocol matches the one on the server side
    if (clientMethodsHashCode == sig.fingerprint) {
      return new ProtocolSignature(serverVersion, null);  // null indicates a match
    } 
    
    return sig.signature;
  }
602518
public final HttpClient httpResponseDecoder(Function<HttpResponseDecoderSpec, HttpResponseDecoderSpec> responseDecoderOptions) {
		return tcpConfiguration(
				responseDecoderOptions.apply(new HttpResponseDecoderSpec())
				                      .build());
	}