コード例 #1
0
 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;
 }
コード例 #2
0
 @Override
 public String toString() {
   return "[time:"
       + DateFormat.getDateInstance().format(time.getTime())
       + ",requestURI:"
       + request.getUri()
       + "]";
 }
コード例 #3
0
 private Route findRoute(Request request) throws Exception {
   for (Route r : routeProvider.getRoutes()) {
     // TODO getBodyAsStream creates ByteArray each call. That could be a performance issue. Using
     // BufferedInputStream did't work, because stream got closed.
     if ((Boolean)
         newXPath(namespaces)
             .evaluate(
                 r.getxPath(), new InputSource(request.getBodyAsStream()), XPathConstants.BOOLEAN))
       return r;
     log.debug("no match found for xpath {" + r.getxPath() + "}");
   }
   return null;
 }
コード例 #4
0
  public void finishExchange(boolean refresh, String errmsg) {
    errMessage = errmsg;
    if (status != ExchangeState.COMPLETED) {
      status = ExchangeState.FAILED;
      forceToStop = true;
    }

    if (request != null) request.release();
    if (response != null) response.release();

    if (refresh) {
      notifyExchangeFinished();
    }
  }
コード例 #5
0
 private Outcome getOutcome(Request request, Interceptor interceptor, String fileName)
     throws Exception {
   request.setBodyContent(getContent(fileName));
   exc.setRequest(request);
   return interceptor.handleRequest(exc);
 }
コード例 #6
0
 protected int estimateHeapSize() {
   return 2000
       + (originalRequestUri != null ? originalRequestUri.length() : 0)
       + (request != null ? request.estimateHeapSize() : 0)
       + (response != null ? response.estimateHeapSize() : 0);
 }