private static byte[] requestContent(ClientInvocation request) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); request.getDelegatingOutputStream().setDelegate(baos); try { request.writeRequestBody(request.getEntityStream()); baos.close(); return baos.toByteArray(); } catch (IOException e) { throw new RuntimeException(e); } }
request.getDelegatingOutputStream().setDelegate(baos); try
request.getDelegatingOutputStream().setDelegate(baos); try
/** * Creates the request OutputStream, to be sent to the end Service invoked, as a * <a href="http://commons.apache.org/io/api-release/org/apache/commons/io/output/DeferredFileOutputStream.html" * >DeferredFileOutputStream</a>. * * * @param request - * @return - DeferredFileOutputStream with the ClientRequest written out per HTTP specification. * @throws IOException - */ private DeferredFileOutputStream writeRequestBodyToOutputStream(final ClientInvocation request) throws IOException { DeferredFileOutputStream memoryManagedOutStream = new DeferredFileOutputStream( this.fileUploadInMemoryThresholdLimit * getMemoryUnitMultiplier(), getTempfilePrefix(), ".tmp", this.fileUploadTempFileDir); request.getDelegatingOutputStream().setDelegate(memoryManagedOutStream); request.writeRequestBody(request.getEntityStream()); memoryManagedOutStream.close(); return memoryManagedOutStream; }
private static byte[] requestContent(ClientInvocation request) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); request.getDelegatingOutputStream().setDelegate(baos); try { request.writeRequestBody(request.getEntityStream()); baos.close(); return baos.toByteArray(); } catch (IOException e) { throw new RuntimeException(e); } }
private static byte[] requestContent(ClientInvocation request) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); request.getDelegatingOutputStream().setDelegate(baos); try { request.writeRequestBody(request.getEntityStream()); baos.close(); return baos.toByteArray(); } catch (IOException e) { throw new RuntimeException(e); } }
protected void executeRequest(ClientInvocation request, HttpURLConnection connection) { connection.setInstanceFollowRedirects(request.getMethod().equals("GET")); if (request.getEntity() != null) { if (request.getMethod().equals("GET")) { throw new ProcessingException(Messages.MESSAGES.getRequestCannotHaveBody()); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); request.getDelegatingOutputStream().setDelegate(baos); try { request.writeRequestBody(request.getEntityStream()); baos.close(); this.commitHeaders(request, connection); connection.setDoOutput(true); OutputStream e = connection.getOutputStream(); e.write(baos.toByteArray()); e.flush(); e.close(); } catch (IOException ex) { throw new RuntimeException(ex); } } else { this.commitHeaders(request, connection); } }
protected void executeRequest(ClientInvocation request, HttpURLConnection connection) { connection.setInstanceFollowRedirects(request.getMethod().equals("GET")); if (request.getEntity() != null) { if (request.getMethod().equals("GET")) { throw new ProcessingException(Messages.MESSAGES.getRequestCannotHaveBody()); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); request.getDelegatingOutputStream().setDelegate(baos); try { request.writeRequestBody(request.getEntityStream()); baos.close(); this.commitHeaders(request, connection); connection.setDoOutput(true); OutputStream e = connection.getOutputStream(); e.write(baos.toByteArray()); e.flush(); e.close(); } catch (IOException ex) { throw new RuntimeException(ex); } } else { this.commitHeaders(request, connection); } }
request.getDelegatingOutputStream().setDelegate(baos); try
request.getDelegatingOutputStream().setDelegate(baos); try
request.getDelegatingOutputStream().setDelegate(baos); try
request.getDelegatingOutputStream().setDelegate(baos); try
/** * Creates the request OutputStream, to be sent to the end Service invoked, as a * <a href="http://commons.apache.org/io/api-release/org/apache/commons/io/output/DeferredFileOutputStream.html" * >DeferredFileOutputStream</a>. * * * @param request - * @return - DeferredFileOutputStream with the ClientRequest written out per HTTP specification. * @throws IOException - */ private DeferredFileOutputStream writeRequestBodyToOutputStream(final ClientInvocation request) throws IOException { DeferredFileOutputStream memoryManagedOutStream = new DeferredFileOutputStream(this.fileUploadInMemoryThresholdLimit * getMemoryUnitMultiplier(), getTempfilePrefix(), ".tmp", this.fileUploadTempFileDir); request.getDelegatingOutputStream().setDelegate(memoryManagedOutStream); request.writeRequestBody(request.getEntityStream()); memoryManagedOutStream.close(); return memoryManagedOutStream; }
/** * Creates the request OutputStream, to be sent to the end Service invoked, as a * <a href="http://commons.apache.org/io/api-release/org/apache/commons/io/output/DeferredFileOutputStream.html" * >DeferredFileOutputStream</a>. * * * @param request - * @return - DeferredFileOutputStream with the ClientRequest written out per HTTP specification. * @throws IOException - */ private DeferredFileOutputStream writeRequestBodyToOutputStream(final ClientInvocation request) throws IOException { DeferredFileOutputStream memoryManagedOutStream = new DeferredFileOutputStream(this.fileUploadInMemoryThresholdLimit * getMemoryUnitMultiplier(), getTempfilePrefix(), ".tmp", this.fileUploadTempFileDir); request.getDelegatingOutputStream().setDelegate(memoryManagedOutStream); request.writeRequestBody(request.getEntityStream()); memoryManagedOutStream.close(); return memoryManagedOutStream; }