From 262271981a6001d2afaca69d7559b848d88bc5ef Mon Sep 17 00:00:00 2001 From: Vijitha Ekanayake Date: Tue, 2 Feb 2016 10:02:54 +0530 Subject: [PATCH 1/2] Fixing issue of cleaning expired connections --- .../filters/route/SimpleHostRoutingFilter.groovy | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/zuul-simple-webapp/src/main/groovy/filters/route/SimpleHostRoutingFilter.groovy b/zuul-simple-webapp/src/main/groovy/filters/route/SimpleHostRoutingFilter.groovy index 68b4a4eae3..c5aff2b18a 100644 --- a/zuul-simple-webapp/src/main/groovy/filters/route/SimpleHostRoutingFilter.groovy +++ b/zuul-simple-webapp/src/main/groovy/filters/route/SimpleHostRoutingFilter.groovy @@ -80,13 +80,9 @@ class SimpleHostRoutingFilter extends ZuulFilter { @Override void run() { try { - final CloseableHttpClient hc = CLIENT.get(); - - if (hc == null) { - return; - } - - hc.close(); + final HttpClient hc = CLIENT.get(); + if (hc == null) return; + hc.getConnectionManager().closeExpiredConnections(); } catch (Throwable t) { LOG.error("error closing expired connections", t); } From 1a24fc6d25b15400b378bb636fb723576aa025b6 Mon Sep 17 00:00:00 2001 From: Vijitha Ekanayake Date: Mon, 15 Feb 2016 10:19:04 +0530 Subject: [PATCH 2/2] Fixing Zuul-Simple-Webapp to route POST request to RouteHost --- .../groovy/filters/route/SimpleHostRoutingFilter.groovy | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/zuul-simple-webapp/src/main/groovy/filters/route/SimpleHostRoutingFilter.groovy b/zuul-simple-webapp/src/main/groovy/filters/route/SimpleHostRoutingFilter.groovy index c5aff2b18a..9a34a051b6 100644 --- a/zuul-simple-webapp/src/main/groovy/filters/route/SimpleHostRoutingFilter.groovy +++ b/zuul-simple-webapp/src/main/groovy/filters/route/SimpleHostRoutingFilter.groovy @@ -90,7 +90,9 @@ class SimpleHostRoutingFilter extends ZuulFilter { }, 30000, 5000) } - public SimpleHostRoutingFilter() {} + public SimpleHostRoutingFilter() { + super(); + } private static final HttpClientConnectionManager newConnectionManager() { SSLContext sslContext = SSLContexts.createSystemDefault(); @@ -161,7 +163,7 @@ class SimpleHostRoutingFilter extends ZuulFilter { HttpServletRequest request = RequestContext.getCurrentContext().getRequest(); Header[] headers = buildZuulRequestHeaders(request) String verb = getVerb(request); - InputStream requestEntity = getRequestBody(request) + InputStream requestEntity = request.getInputStream(); CloseableHttpClient httpclient = CLIENT.get() String uri = request.getRequestURI() @@ -222,7 +224,7 @@ class SimpleHostRoutingFilter extends ZuulFilter { switch (verb) { case 'POST': httpRequest = new HttpPost(uri + getQueryString()) - InputStreamEntity entity = new InputStreamEntity(requestEntity, request.getContentLength()) + InputStreamEntity entity = new InputStreamEntity(requestEntity) httpRequest.setEntity(entity) break case 'PUT':