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 String toString() { return "[time:" + DateFormat.getDateInstance().format(time.getTime()) + ",requestURI:" + request.getUri() + "]"; }
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; }
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(); } }
private Outcome getOutcome(Request request, Interceptor interceptor, String fileName) throws Exception { request.setBodyContent(getContent(fileName)); exc.setRequest(request); return interceptor.handleRequest(exc); }
protected int estimateHeapSize() { return 2000 + (originalRequestUri != null ? originalRequestUri.length() : 0) + (request != null ? request.estimateHeapSize() : 0) + (response != null ? response.estimateHeapSize() : 0); }