Codota Logo
HttpOperationFailedException
Code IndexAdd Codota to your IDE (free)

How to use
HttpOperationFailedException
in
org.apache.camel.component.http

Best Java code snippets using org.apache.camel.component.http.HttpOperationFailedException (Showing top 3 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
origin: nz.ac.auckland.morc/morc

  @SuppressWarnings("unchecked")
  @Override
  public void process(Exchange exchange) {
    Throwable t = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class);
    if (!(t instanceof HttpOperationFailedException)) return;

    HttpOperationFailedException httpException = (HttpOperationFailedException) t;

    String responseBody = httpException.getResponseBody();
    Map<String, String> responseHeaders = httpException.getResponseHeaders();

    exchange.getIn().setBody(responseBody);
    exchange.getIn().getHeaders().putAll(responseHeaders);
    exchange.getIn().setHeader(Exchange.HTTP_RESPONSE_CODE, httpException.getStatusCode());

    StringBuilder builder = new StringBuilder();
    for (String key : responseHeaders.keySet()) {
      builder.append(key).append(":").append(responseHeaders.get(key)).append(",");
    }

    logger.debug("Received error response from endpoint: {}, body: {}, headers: {}",
        new String[]{(exchange.getFromEndpoint() != null ? exchange.getFromEndpoint().getEndpointUri() :
            "unknown"), responseBody, builder.toString()});
  }
}
origin: net.osgiliath.framework/net.osgiliath.helper.camel

@Override
public void process(Exchange exchange) throws Exception {
 final HttpOperationFailedException exception = exchange.getProperty(
   Exchange.EXCEPTION_CAUGHT, HttpOperationFailedException.class);
 if (null != exception
   && null != exception.getResponseHeaders().get(
     ExceptionMappingConstants.EXCEPTION_BODY_HEADER)) {
  final String body = exception.getResponseHeaders().get(
    ExceptionMappingConstants.EXCEPTION_BODY_HEADER);
  LOG.info("Catched error in route: " + body);
  final SAXBuilder sxb = new SAXBuilder();
  final Document doc = sxb.build(new StringReader(body));
  exchange.getIn().setBody(
    doc.getRootElement()
      .getChild(ExceptionMappingConstants.EXCEPTION_MESSAGE).getText());
 }
}
origin: net.osgiliath.framework/net.osgiliath.helpers.camel

@Override
public void process(Exchange exchange) throws Exception {
 final HttpOperationFailedException exception = exchange.getProperty(
   Exchange.EXCEPTION_CAUGHT, HttpOperationFailedException.class);
 if (null != exception
   && null != exception.getResponseHeaders().get(
     ExceptionMappingConstants.EXCEPTION_BODY_HEADER)) {
  final String body = exception.getResponseHeaders().get(
    ExceptionMappingConstants.EXCEPTION_BODY_HEADER);
  LOG.info("Catched error in route: " + body);
  final SAXBuilder sxb = new SAXBuilder();
  final Document doc = sxb.build(new StringReader(body));
  exchange.getIn().setBody(
    doc.getRootElement()
      .getChild(ExceptionMappingConstants.EXCEPTION_MESSAGE).getText());
 }
}
org.apache.camel.component.httpHttpOperationFailedException

Most used methods

  • getResponseHeaders
  • getResponseBody
  • getStatusCode

Popular in Java

  • Finding current android device location
  • scheduleAtFixedRate (ScheduledExecutorService)
  • orElseThrow (Optional)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Socket (java.net)
    Provides a client-side TCP socket.
  • URLConnection (java.net)
    The abstract class URLConnection is the superclass of all classes that represent a communications li
  • Path (java.nio.file)
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Properties (java.util)
    The Properties class represents a persistent set of properties. The Properties can be saved to a st
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now