@Override public HttpResponse invoke(HttpCommand command) { commandsInvoked.add(command); return super.invoke(command); }
boolean chunked = "chunked".equals(request.getFirstHeaderOrNull("Transfer-Encoding")); HttpURLConnection connection = initConnection(request); connection.setConnectTimeout(utils.getConnectionTimeout()); connection.setReadTimeout(utils.getSocketOpenTimeout()); setRequestMethodBypassingJREMethodLimitation(connection, request.getMethod()); configureRequestHeaders(connection, request); writePayloadToConnection(payload, "streaming", connection); } else { Long length = checkNotNull(md.getContentLength(), "payload.getContentLength"); connection.setFixedLengthStreamingMode(length.intValue()); } else { setFixedLengthStreamingMode(connection, length); writePayloadToConnection(payload, length, connection); } else { writeNothing(connection); writeNothing(connection);
writePayloadToConnection(payload, "streaming", connection); } else { Long length = checkNotNull(md.getContentLength(), "payload.getContentLength"); connection.setRequestProperty(CONTENT_LENGTH, length.toString()); connection.setFixedLengthStreamingMode(length.intValue()); writePayloadToConnection(payload, length, connection); } else { writeNothing(connection); writeNothing(connection);
delegateField.setAccessible(true); HttpURLConnection delegateConnection = (HttpURLConnection) delegateField.get(httpURLConnection); setRequestMethodBypassingJREMethodLimitation(delegateConnection, method); } catch (NoSuchFieldException e) {
InputStream in = null; try { in = consumeOnClose(connection.getInputStream()); } catch (IOException e) { in = bufferAndCloseStream(connection.getErrorStream()); } catch (RuntimeException e) { closeQuietly(in);
writePayloadToConnection(payload, "streaming", connection); } else { Long length = checkNotNull(md.getContentLength(), "payload.getContentLength"); connection.setRequestProperty(CONTENT_LENGTH, length.toString()); connection.setFixedLengthStreamingMode(length.intValue()); writePayloadToConnection(payload, length, connection); } else { writeNothing(connection); writeNothing(connection);
delegateField.setAccessible(true); HttpURLConnection delegateConnection = (HttpURLConnection) delegateField.get(httpURLConnection); setRequestMethodBypassingJREMethodLimitation(delegateConnection, method); } catch (NoSuchFieldException e) {
InputStream in = null; try { in = consumeOnClose(connection.getInputStream()); } catch (IOException e) { in = bufferAndCloseStream(connection.getErrorStream()); } catch (RuntimeException e) { closeQuietly(in);
boolean chunked = "chunked".equals(request.getFirstHeaderOrNull("Transfer-Encoding")); HttpURLConnection connection = initConnection(request); connection.setConnectTimeout(utils.getConnectionTimeout()); connection.setReadTimeout(utils.getSocketOpenTimeout()); setRequestMethodBypassingJREMethodLimitation(connection, request.getMethod()); configureRequestHeaders(connection, request); writePayloadToConnection(payload, "streaming", connection); } else { Long length = checkNotNull(md.getContentLength(), "payload.getContentLength"); connection.setFixedLengthStreamingMode(length.intValue()); } else { setFixedLengthStreamingMode(connection, length); writePayloadToConnection(payload, length, connection); } else { writeNothing(connection); writeNothing(connection);
/** * synchronized to prevent multiple callers from overlapping requests on the same session */ @Override protected synchronized HttpResponse invoke(HttpURLConnection connection) throws IOException, InterruptedException { HttpResponse response = super.invoke(connection); if (response.getStatusCode() == 200) { byte[] data = closeClientButKeepContentStream(response); String message = data != null ? new String(data, "UTF-8") : null; if (message != null && !message.startsWith("{\"status\": \"success\"")) { response = response.toBuilder().statusCode(400).build(); } } return response; } }
delegateField.setAccessible(true); HttpURLConnection delegateConnection = (HttpURLConnection) delegateField.get(httpURLConnection); setRequestMethodBypassingJREMethodLimitation(delegateConnection, method); } catch (NoSuchFieldException e) {
InputStream in = null; try { in = consumeOnClose(connection.getInputStream()); } catch (IOException e) { in = bufferAndCloseStream(connection.getErrorStream()); } catch (RuntimeException e) { close(in, true);
boolean chunked = "chunked".equals(request.getFirstHeaderOrNull("Transfer-Encoding")); HttpURLConnection connection = initConnection(request); connection.setConnectTimeout(utils.getConnectionTimeout()); connection.setReadTimeout(utils.getSocketOpenTimeout()); setRequestMethodBypassingJREMethodLimitation(connection, request.getMethod()); configureRequestHeaders(connection, request); writePayloadToConnection(payload, "streaming", connection); } else { Long length = checkNotNull(md.getContentLength(), "payload.getContentLength"); connection.setFixedLengthStreamingMode(length.intValue()); } else { setFixedLengthStreamingMode(connection, length); writePayloadToConnection(payload, length, connection); } else { writeNothing(connection); writeNothing(connection);
@Override protected HttpResponse invoke(HttpURLConnection connection) throws IOException, InterruptedException { HttpResponse response = super.invoke(connection); byte[] data = closeClientButKeepContentStream(response); if (data != null && !new String(data).contains("<responseStatus>SUCCESS</responseStatus>")) { response = response.toBuilder().statusCode(500).build(); } return response; } }
delegateField.setAccessible(true); HttpURLConnection delegateConnection = (HttpURLConnection) delegateField.get(httpURLConnection); setRequestMethodBypassingJREMethodLimitation(delegateConnection, method); } catch (NoSuchFieldException e) {
boolean chunked = "chunked".equals(request.getFirstHeaderOrNull("Transfer-Encoding")); HttpURLConnection connection = initConnection(request); connection.setConnectTimeout(utils.getConnectionTimeout()); connection.setReadTimeout(utils.getSocketOpenTimeout()); setRequestMethodBypassingJREMethodLimitation(connection, request.getMethod()); configureRequestHeaders(connection, request); writePayloadToConnection(payload, "streaming", connection); } else { Long length = checkNotNull(md.getContentLength(), "payload.getContentLength"); connection.setRequestProperty(CONTENT_LENGTH, length.toString()); connection.setFixedLengthStreamingMode(length.intValue()); writePayloadToConnection(payload, length, connection); } else { writeNothing(connection); writeNothing(connection);
@Override protected HttpResponse invoke(HttpURLConnection connection) throws IOException, InterruptedException { HttpResponse response = super.invoke(connection); byte[] data = closeClientButKeepContentStream(response); if (data != null && !new String(data).contains("<responseStatus>SUCCESS</responseStatus>")) { response = response.toBuilder().statusCode(500).build(); } return response; } }
/** * synchronized to prevent multiple callers from overlapping requests on the same session */ @Override protected synchronized HttpResponse invoke(HttpURLConnection connection) throws IOException, InterruptedException { HttpResponse response = super.invoke(connection); if (response.getStatusCode() == 200) { byte[] data = closeClientButKeepContentStream(response); String message = data != null ? new String(data, "UTF-8") : null; if (message != null && !message.startsWith("{\"status\": \"success\"")) { response = response.toBuilder().statusCode(400).build(); } } return response; } }
/** * synchronized to prevent multiple callers from overlapping requests on the same session */ @Override protected synchronized HttpResponse invoke(HttpURLConnection connection) throws IOException, InterruptedException { HttpResponse response = super.invoke(connection); if (response.getStatusCode() == 200) { byte[] data = closeClientButKeepContentStream(response); String message = data != null ? new String(data, Charsets.UTF_8) : null; if (message != null && !message.startsWith("{\"status\": \"success\"")) { response = response.toBuilder().statusCode(400).build(); } } return response; } }
/** * synchronized to prevent multiple callers from overlapping requests on the same session */ @Override protected synchronized HttpResponse invoke(HttpURLConnection connection) throws IOException, InterruptedException { HttpResponse response = super.invoke(connection); if (response.getStatusCode() == 200) { byte[] data = closeClientButKeepContentStream(response); String message = data != null ? new String(data, Charsets.UTF_8) : null; if (message != null && !message.startsWith("{\"status\": \"success\"")) { response = response.toBuilder().statusCode(400).build(); } } return response; } }