protected void populateResponse(Exchange exchange, HttpMethod method, Message in, HeaderFilterStrategy strategy, int responseCode) throws IOException, ClassNotFoundException, URISyntaxException { Object response = extractResponseBody(method, exchange, getEndpoint().isIgnoreResponseBody()); Message answer = exchange.getOut(); if (getEndpoint().getCookieHandler() != null) { getEndpoint().getCookieHandler().storeCookies(exchange, new URI(method.getURI().getEscapedURI()), m); if (getEndpoint().isCopyHeaders()) { MessageHelper.copyHeaders(exchange.getIn(), answer, httpProtocolHeaderFilterStrategy, false);
protected HttpMethod createMethod(Exchange exchange) throws Exception { String url = HttpHelper.createURL(exchange, getEndpoint()); URI uri = HttpHelper.createURI(exchange, url, getEndpoint()); String rewriteUrl = HttpHelper.urlRewrite(exchange, url, getEndpoint(), this); if (rewriteUrl != null) { String methodName = HttpHelper.createMethod(exchange, getEndpoint(), requestEntity != null).name(); HttpMethods methodsToUse = HttpMethods.valueOf(methodName); HttpMethod method = methodsToUse.createMethod(url); + ". If you are forwarding/bridging http endpoints, then enable the bridgeEndpoint option on the endpoint: " + getEndpoint());
if (getEndpoint().isBridgeEndpoint()) { exchange.setProperty(Exchange.SKIP_GZIP_ENCODING, Boolean.TRUE); String queryString = exchange.getIn().getHeader(Exchange.HTTP_QUERY, String.class); HeaderFilterStrategy strategy = getEndpoint().getHeaderFilterStrategy(); if (getEndpoint().getCookieHandler() != null) { Map<String, List<String>> cookieHeaders = getEndpoint().getCookieHandler().loadCookies(exchange, new URI(method.getURI().getEscapedURI())); for (Map.Entry<String, List<String>> entry : cookieHeaders.entrySet()) { String key = entry.getKey(); if (getEndpoint().isConnectionClose()) { method.addRequestHeader("Connection", "close"); boolean ok = HttpHelper.isStatusCodeOk(responseCode, getEndpoint().getOkStatusCodeRange()); if (ok) {
Map<String, String> headers = extractResponseHeaders(method.getResponseHeaders()); if (getEndpoint().getCookieHandler() != null) { Map<String, List<String>> m = new HashMap<>(); for (Entry<String, String> e : headers.entrySet()) { m.put(e.getKey(), Collections.singletonList(e.getValue())); getEndpoint().getCookieHandler().storeCookies(exchange, new URI(method.getURI().getEscapedURI()), m); Object responseBody = extractResponseBody(method, exchange, getEndpoint().isIgnoreResponseBody()); if (transferException && responseBody instanceof Exception) {
if (getEndpoint().getComponent().isAllowJavaSerializedObject() || getEndpoint().isTransferException()) { return HttpHelper.deserializeJavaObjectFromStream(is, exchange.getContext()); } else { if (!getEndpoint().isDisableStreamCache()) {
if (!getEndpoint().getComponent().isAllowJavaSerializedObject()) { throw new CamelExchangeException("Content-type " + HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT + " is not allowed", exchange);