private Case findRoute(Request request) throws Exception {
   for (Case r : cases) {
     // TODO getBodyAsStream creates ByteArray each call. That could be a performance issue. Using
     // BufferedInputStream did't work, because stream got closed.
     InputSource is = new InputSource(request.getBodyAsStreamDecoded());
     is.setEncoding(request.getCharset());
     if ((Boolean) newXPath(namespaces).evaluate(r.getxPath(), is, XPathConstants.BOOLEAN))
       return r;
     log.debug("no match found for xpath {" + r.getxPath() + "}");
   }
   return null;
 }
  @Override
  public Outcome handleRequest(Exchange exc) throws Exception {
    if (exc.getRequest().isBodyEmpty()) {
      return Outcome.CONTINUE;
    }

    Case r = findRoute(exc.getRequest());
    if (r == null) {
      return Outcome.CONTINUE;
    }
    log.debug("match found for {" + r.getxPath() + "} routing to {" + r.getUrl() + "}");

    updateDestination(exc, r);
    return Outcome.CONTINUE;
  }