/** * Connects to the remote resource (if {@code connect()} hasn't already been called) and returns the HTTP response * message body as plain text. * * <p> * The response entity is discarded unless one of the pipe methods have been specified to pipe the output to an * output stream or writer. * * @return The response as a string. * @throws RestCallException If an exception or non-200 response code occurred during the connection attempt. * @throws IOException If an exception occurred while streaming was already occurring. */ public String getResponseAsString() throws IOException { try (Reader r = getReader()) { return read(r).toString(); } catch (IOException e) { isFailed = true; close(); throw e; } }
/** * Connects to the remote resource (if {@code connect()} hasn't already been called) and returns the HTTP response * message body as plain text. * * <p> * The response entity is discarded unless one of the pipe methods have been specified to pipe the output to an * output stream or writer. * * @return The response as a string. * @throws RestCallException If an exception or non-200 response code occurred during the connection attempt. * @throws IOException If an exception occurred while streaming was already occurring. */ public String getResponseAsString() throws IOException { try (Reader r = getReader()) { return read(r).toString(); } catch (IOException e) { isFailed = true; close(); throw e; } }
/** * Connects to the remote resource (if {@code connect()} hasn't already been called) and returns the HTTP response * message body as plain text. * * <p> * The response entity is discarded unless one of the pipe methods have been specified to pipe the output to an * output stream or writer. * * @return The response as a string. * @throws RestCallException If an exception or non-200 response code occurred during the connection attempt. * @throws IOException If an exception occurred while streaming was already occurring. */ public String getResponseAsString() throws IOException { try (Reader r = getReader()) { return read(r).toString(); } catch (IOException e) { isFailed = true; close(); throw e; } }
throw new RestCallException(sc, status.getReasonPhrase(), request.getMethod(), request.getURI(), getResponseAsString()).setHttpResponse(response); if (outputStreams.size() > 0 || writers.size() > 0) getReader(); return sc; } catch (RestCallException e) {
throw new RestCallException(sc, status.getReasonPhrase(), request.getMethod(), request.getURI(), getResponseAsString()).setHttpResponse(response); if (outputStreams.size() > 0 || writers.size() > 0) getReader(); return sc; } catch (RestCallException e) {
throw new RestCallException(sc, status.getReasonPhrase(), request.getMethod(), request.getURI(), getResponseAsString()).setHttpResponse(response); if (outputStreams.size() > 0 || writers.size() > 0) getReader(); return sc; } catch (RestCallException e) {
return (T)getReader(); if (ic.equals(InputStream.class)) return (T)getInputStream(); return (T)ReaderResource.create().headers(headers).mediaType(mediaType).contents(getReader()).build(); return (T)StreamResource.create().headers(headers).mediaType(mediaType).contents(getInputStream()).build(); try (Closeable in = parser.isReaderParser() ? getReader() : getInputStream()) { return type.getReaderTransform().transform(getReader());
return (T)getReader(); if (ic.equals(InputStream.class)) return (T)getInputStream(); return (T)ReaderResource.create().headers(headers).mediaType(mediaType).contents(getReader()).build(); return (T)StreamResource.create().headers(headers).mediaType(mediaType).contents(getInputStream()).build(); try (Closeable in = parser.isReaderParser() ? getReader() : getInputStream()) { return type.getReaderTransform().transform(getReader());
return (T)getReader(); if (ic.equals(InputStream.class)) return (T)getInputStream(); return (T)ReaderResource.create().headers(headers).mediaType(mediaType).contents(getReader()).build(); return (T)StreamResource.create().headers(headers).mediaType(mediaType).contents(getInputStream()).build(); try (Closeable in = parser.isReaderParser() ? getReader() : getInputStream()) { return type.getReaderTransform().transform(getReader());