} finally { if (responseAware != null && !rateLimitsUpdated) { Map<String, List<String>> responseHeaders = responseAware.getResponseHeaders(); rateLimit = Integer.valueOf(responseHeaders.get("X-RateLimit-Limit").get(0)); rateLimitRemaining = Integer.valueOf(responseHeaders.get("X-RateLimit-Remaining").get(0));
private boolean makeAware(Object result, HttpURLConnection connection, RestInvocation invocation) { boolean madeAware = false; if (result instanceof InvocationAware) { try { ((InvocationAware) result).setInvocation(invocation); madeAware = true; } catch (Exception ex) { log.warn("Failed to set invocation on the InvocationAware", ex); } } if (result instanceof HttpResponseAware && connection != null) { try { ((HttpResponseAware) result).setResponseHeaders(connection.getHeaderFields()); madeAware = true; } catch (Exception ex) { log.warn("Failed to set response headers on the HttpResponseAware", ex); } } return madeAware; }
private boolean makeAware(Object result, HttpURLConnection connection, RestInvocation invocation) { boolean madeAware = false; if (result instanceof InvocationAware) { try { ((InvocationAware) result).setInvocation(invocation); madeAware = true; } catch (Exception ex) { log.warn("Failed to set invocation on the InvocationAware", ex); } } if (result instanceof HttpResponseAware && connection != null) { try { ((HttpResponseAware) result).setResponseHeaders(connection.getHeaderFields()); madeAware = true; } catch (Exception ex) { log.warn("Failed to set response headers on the HttpResponseAware", ex); } } return madeAware; }
} finally { if (responseAware != null && !rateLimitsUpdated) { Map<String, List<String>> responseHeaders = responseAware.getResponseHeaders(); rateLimit = Integer.valueOf(responseHeaders.get("X-RateLimit-Limit").get(0)); rateLimitRemaining = Integer.valueOf(responseHeaders.get("X-RateLimit-Remaining").get(0));