2121 */
2222package com .influxdb .v3 .netty .rest ;
2323
24+ import java .net .URI ;
25+ import java .net .URISyntaxException ;
26+ import java .nio .charset .StandardCharsets ;
27+ import java .util .HashMap ;
28+ import java .util .List ;
29+ import java .util .Map ;
30+ import java .util .concurrent .ExecutionException ;
31+ import javax .annotation .Nonnull ;
32+ import javax .annotation .Nullable ;
33+ import javax .net .ssl .SSLException ;
34+
2435import com .fasterxml .jackson .core .JsonProcessingException ;
2536import com .fasterxml .jackson .databind .JsonNode ;
2637import com .fasterxml .jackson .databind .ObjectMapper ;
27- import com .influxdb .v3 .client .InfluxDBApiHttpException ;
28- import com .influxdb .v3 .client .config .ClientConfig ;
2938import io .netty .bootstrap .Bootstrap ;
3039import io .netty .buffer .Unpooled ;
3140import io .netty .channel .Channel ;
3443import io .netty .channel .MultiThreadIoEventLoopGroup ;
3544import io .netty .channel .nio .NioIoHandler ;
3645import io .netty .channel .socket .nio .NioSocketChannel ;
37- import io .netty .handler .codec .http .*;
46+ import io .netty .handler .codec .http .DefaultFullHttpRequest ;
47+ import io .netty .handler .codec .http .FullHttpResponse ;
48+ import io .netty .handler .codec .http .HttpMethod ;
49+ import io .netty .handler .codec .http .HttpRequest ;
50+ import io .netty .handler .codec .http .HttpResponseStatus ;
51+ import io .netty .handler .codec .http .HttpVersion ;
52+ import io .netty .handler .codec .http .QueryStringEncoder ;
3853import io .netty .handler .ssl .SslContext ;
3954import io .netty .handler .ssl .SslContextBuilder ;
4055import io .netty .util .CharsetUtil ;
4156import io .netty .util .concurrent .Promise ;
4257import org .slf4j .Logger ;
4358import org .slf4j .LoggerFactory ;
4459
45- import javax .annotation .Nonnull ;
46- import javax .annotation .Nullable ;
47- import javax .net .ssl .SSLException ;
48- import java .net .URI ;
49- import java .net .URISyntaxException ;
50- import java .nio .charset .StandardCharsets ;
51- import java .util .HashMap ;
52- import java .util .List ;
53- import java .util .Map ;
54- import java .util .concurrent .ExecutionException ;
60+ import com .influxdb .v3 .client .InfluxDBApiHttpException ;
61+ import com .influxdb .v3 .client .config .ClientConfig ;
5562
5663public final class RestClient implements AutoCloseable {
5764
@@ -154,7 +161,9 @@ public void write(String lineProtocol) throws InterruptedException, ExecutionExc
154161 this .request (HttpMethod .POST , encoder .toString (), header , lineProtocol );
155162 }
156163
157- public FullHttpResponse request (@ Nonnull HttpMethod method , @ Nonnull String path , @ Nullable Map <String , String > header , @ Nullable String body ) throws InterruptedException , ExecutionException , JsonProcessingException {
164+ public FullHttpResponse request (@ Nonnull HttpMethod method , @ Nonnull String path ,
165+ @ Nullable Map <String , String > header , @ Nullable String body )
166+ throws InterruptedException , ExecutionException , JsonProcessingException {
158167 var content = Unpooled .EMPTY_BUFFER ;
159168 if (body != null ) {
160169 content = Unpooled .copiedBuffer (body , CharsetUtil .UTF_8 );
@@ -172,7 +181,8 @@ public FullHttpResponse request(@Nonnull HttpMethod method, @Nonnull String path
172181 if (authScheme == null ) {
173182 authScheme = "Token" ;
174183 }
175- request .headers ().set ("authorization" , String .format ("%s %s" , authScheme , new String (this .config .getToken ())));
184+ request .headers ()
185+ .set ("authorization" , String .format ("%s %s" , authScheme , new String (this .config .getToken ())));
176186 }
177187 request .headers ().set ("connection" , "closed" );
178188
0 commit comments