Search in sources :

Example 71 with QueryStringDecoder

use of io.netty.handler.codec.http.QueryStringDecoder in project flink by apache.

the class RouterHandler method channelRead0.

@Override
protected void channelRead0(ChannelHandlerContext channelHandlerContext, HttpRequest httpRequest) {
    if (HttpHeaders.is100ContinueExpected(httpRequest)) {
        channelHandlerContext.writeAndFlush(new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.CONTINUE));
        return;
    }
    // Route
    HttpMethod method = httpRequest.getMethod();
    QueryStringDecoder qsd = new QueryStringDecoder(httpRequest.uri());
    RouteResult<?> routeResult = router.route(method, qsd.path(), qsd.parameters());
    if (routeResult == null) {
        respondNotFound(channelHandlerContext, httpRequest);
        return;
    }
    routed(channelHandlerContext, routeResult, httpRequest);
}
Also used : QueryStringDecoder(org.apache.flink.shaded.netty4.io.netty.handler.codec.http.QueryStringDecoder) DefaultFullHttpResponse(org.apache.flink.shaded.netty4.io.netty.handler.codec.http.DefaultFullHttpResponse) HttpMethod(org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpMethod)

Example 72 with QueryStringDecoder

use of io.netty.handler.codec.http.QueryStringDecoder in project blade by biezhi.

the class HttpRequest method parameters.

@Override
public Map<String, List<String>> parameters() {
    if (initQueryParam) {
        return this.parameters;
    }
    initQueryParam = true;
    if (!url.contains("?")) {
        return this.parameters;
    }
    var parameters = new QueryStringDecoder(url, CharsetUtil.UTF_8).parameters();
    if (null != parameters) {
        this.parameters.putAll(parameters);
    }
    return this.parameters;
}
Also used : QueryStringDecoder(io.netty.handler.codec.http.QueryStringDecoder) lombok.var(lombok.var)

Example 73 with QueryStringDecoder

use of io.netty.handler.codec.http.QueryStringDecoder in project incubator-servicecomb-java-chassis by apache.

the class CseClientHttpRequest method execute.

@Override
public ClientHttpResponse execute() {
    path = findUriPath(uri);
    requestMeta = createRequestMeta(method.name(), uri);
    QueryStringDecoder queryStringDecoder = new QueryStringDecoder(uri.getRawSchemeSpecificPart());
    queryParams = queryStringDecoder.parameters();
    Map<String, Object> swaggerArguments = this.collectArguments();
    // 异常流程,直接抛异常出去
    return this.invoke(swaggerArguments);
}
Also used : QueryStringDecoder(io.netty.handler.codec.http.QueryStringDecoder)

Aggregations

QueryStringDecoder (io.netty.handler.codec.http.QueryStringDecoder)70 List (java.util.List)29 Test (org.junit.Test)15 FullHttpRequest (io.netty.handler.codec.http.FullHttpRequest)14 Map (java.util.Map)10 HashMap (java.util.HashMap)9 IOException (java.io.IOException)8 URI (java.net.URI)7 ByteBuf (io.netty.buffer.ByteBuf)6 HttpContent (io.netty.handler.codec.http.HttpContent)6 LastHttpContent (io.netty.handler.codec.http.LastHttpContent)6 HttpPostRequestDecoder (io.netty.handler.codec.http.multipart.HttpPostRequestDecoder)6 ArrayList (java.util.ArrayList)6 HttpMethod (io.netty.handler.codec.http.HttpMethod)5 HttpRequest (io.netty.handler.codec.http.HttpRequest)5 DeviceSession (org.traccar.DeviceSession)5 Position (org.traccar.model.Position)5 DefaultHttpResponse (io.netty.handler.codec.http.DefaultHttpResponse)4 Channel (io.netty.channel.Channel)3 HttpHeaders (io.netty.handler.codec.http.HttpHeaders)3