[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jetty-dev] Fwd: Query On jetty Http2Client
|
Hi,
On Thu, Mar 24, 2016 at 6:29 AM, Prakash Nandihal <p.nandihal@xxxxxxxxx> wrote:
>
> Hi Team,
>
> I am stuck in one issue,i am writing stand alone API to send the request
> using Http2 protocol,but i want to send the json string using post method,
> i dont see any API to set the json to string to request object.
I recommend that you use the higher-level HttpClient class, rather
than the low-level HTTP2Client.
SslContextFactory sslContextFactory = ...;
HttpClient client = new HttpClient(new
HttpClientTransportOverHTTP2(new HTTP2Client()), sslContextFactory);
client.start();
String json = ...;
client.newRequest("host", port)
.path("/")
.content(new
StringContentProvider("application/json;charset=UTF-8", json,
StandardCharsets.UTF_8))
.timeout(5, TimeUnit.SECONDS)
.send();
--
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.