Search in sources :

Example 1 with NettyHttpParameters

use of io.micronaut.http.netty.NettyHttpParameters in project micronaut-core by micronaut-projects.

the class NettyClientHttpRequest method decodeParameters.

private NettyHttpParameters decodeParameters(URI uri) {
    QueryStringDecoder queryStringDecoder = createDecoder(uri);
    return new NettyHttpParameters(queryStringDecoder.parameters(), ConversionService.SHARED, (name, value) -> {
        UriBuilder newUri = UriBuilder.of(getUri());
        newUri.replaceQueryParam(name.toString(), value.toArray());
        this.uri(newUri.build());
    });
}
Also used : QueryStringDecoder(io.netty.handler.codec.http.QueryStringDecoder) NettyHttpParameters(io.micronaut.http.netty.NettyHttpParameters) UriBuilder(io.micronaut.http.uri.UriBuilder)

Example 2 with NettyHttpParameters

use of io.micronaut.http.netty.NettyHttpParameters in project micronaut-core by micronaut-projects.

the class NettyClientHttpRequest method getParameters.

@Override
public MutableHttpParameters getParameters() {
    NettyHttpParameters httpParameters = this.httpParameters;
    if (httpParameters == null) {
        synchronized (this) {
            // double check
            httpParameters = this.httpParameters;
            if (httpParameters == null) {
                httpParameters = decodeParameters(getUri());
                this.httpParameters = httpParameters;
            }
        }
    }
    return httpParameters;
}
Also used : NettyHttpParameters(io.micronaut.http.netty.NettyHttpParameters)

Aggregations

NettyHttpParameters (io.micronaut.http.netty.NettyHttpParameters)2 UriBuilder (io.micronaut.http.uri.UriBuilder)1 QueryStringDecoder (io.netty.handler.codec.http.QueryStringDecoder)1