blob: 58999a8a970e70b98bf9afa15acb996110a9bddb [file] [log] [blame]
<!--
/***************************************************************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
***************************************************************************************************************************/
-->
Piping Response Output
<p>
The {@link oajrc.RestCall} class provides various convenience <c>pipeTo()</c>
methods to pipe output to output streams and writers.
</p>
<p>
If you want to pipe output without any intermediate buffering, you can use the
{@link oajrc.RestCall#byLines()} method.
This will cause the output to be piped and flushed after every line.
This can be useful if you want to display the results in real-time from a long running process producing
output on a REST call.
</p>
<h5 class='figure'>Example:</h5>
<p class='bpcode w800'>
<jc>// Pipe output from REST call to System.out in real-time.</jc>
restClient.doPost(<jsf>URL</jsf>).byLines().pipeTo(<jk>new</jk> PrintWriter(System.<jk>out</jk>)).run();
</p>