Package io.netty.handler.codec.http

Examples of io.netty.handler.codec.http.QueryStringDecoder.path()


    private final Map<String, List<String>> parameters;

    public MappedRequest(FullHttpRequest request) {
        this.method = request.getMethod();
        QueryStringDecoder queryStringDecoder = new QueryStringDecoder(request.getUri());
        this.path = URLParser.returnPath(queryStringDecoder.path());
        this.parameters = queryStringDecoder.parameters();
        this.content = (request.content() != null ? request.content().toString(CharsetUtil.UTF_8) : "");
    }

    public boolean matches(HttpMethod method, String path) {
View Full Code Here


    private ByteBuf content;

    public NettyHttpRequest(HttpVersion httpVersion, HttpMethod method, String uri, boolean secure) {
        super(httpVersion, method, uri);
        QueryStringDecoder queryStringDecoder = new QueryStringDecoder(uri);
        this.path = URLParser.returnPath(queryStringDecoder.path());
        this.parameters = queryStringDecoder.parameters();
        this.secure = secure;
    }

    public void content(ByteBuf content) {
View Full Code Here

            FullHttpRequest req = (FullHttpRequest) msg;
            Channel channel = ctx.channel();
            QueryStringDecoder queryDecoder = new QueryStringDecoder(req.getUri());

            if (!configuration.isAllowCustomRequests()
                    && !queryDecoder.path().startsWith(connectPath)) {
                HttpResponse res = new DefaultHttpResponse(HTTP_1_1, HttpResponseStatus.BAD_REQUEST);
                channel.write(res).addListener(ChannelFutureListener.CLOSE);
                req.release();
                log.warn("Blocked wrong request! url: {}, ip: {}", queryDecoder.path(), channel.remoteAddress());
                return;
View Full Code Here

            if (!configuration.isAllowCustomRequests()
                    && !queryDecoder.path().startsWith(connectPath)) {
                HttpResponse res = new DefaultHttpResponse(HTTP_1_1, HttpResponseStatus.BAD_REQUEST);
                channel.write(res).addListener(ChannelFutureListener.CLOSE);
                req.release();
                log.warn("Blocked wrong request! url: {}, ip: {}", queryDecoder.path(), channel.remoteAddress());
                return;
            }

            List<String> sid = queryDecoder.parameters().get("sid");
            if (queryDecoder.path().equals(connectPath)
View Full Code Here

                log.warn("Blocked wrong request! url: {}, ip: {}", queryDecoder.path(), channel.remoteAddress());
                return;
            }

            List<String> sid = queryDecoder.parameters().get("sid");
            if (queryDecoder.path().equals(connectPath)
                    && sid == null) {
                String origin = req.headers().get(HttpHeaders.Names.ORIGIN);
                if (!authorize(ctx, channel, origin, queryDecoder.parameters(), req)) {
                    req.release();
                    return;
View Full Code Here

            ctx.pipeline().fireChannelRead(new PacketsMessage(client, frame.content(), Transport.WEBSOCKET));
            frame.release();
        } else if (msg instanceof FullHttpRequest) {
            FullHttpRequest req = (FullHttpRequest) msg;
            QueryStringDecoder queryDecoder = new QueryStringDecoder(req.getUri());
            String path = queryDecoder.path();
            List<String> transport = queryDecoder.parameters().get("transport");
            List<String> sid = queryDecoder.parameters().get("sid");

            if (transport != null && NAME.equals(transport.get(0))) {
                try {
View Full Code Here

            ctx.pipeline().fireChannelRead(new PacketsMessage(client, frame.content()));
            frame.release();
        } else if (msg instanceof FullHttpRequest) {
            FullHttpRequest req = (FullHttpRequest) msg;
            QueryStringDecoder queryDecoder = new QueryStringDecoder(req.getUri());
            String path = queryDecoder.path();
            if (path.startsWith(this.path)) {
                handshake(ctx, path, req);
                req.release();
            } else {
                ctx.fireChannelRead(msg);
View Full Code Here

    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        if (msg instanceof FullHttpRequest) {
            FullHttpRequest req = (FullHttpRequest) msg;
            QueryStringDecoder queryDecoder = new QueryStringDecoder(req.getUri());

            if (queryDecoder.path().startsWith(path)) {
                handleMessage(req, queryDecoder, ctx);
                req.release();
                return;
            }
        }
View Full Code Here

            try {
                container.logger().warn("Invalid URI: " + uri + ".  Attempting to parse query string.", e);
                QueryStringDecoder decoder = new QueryStringDecoder(uri);

                StringBuilder sb = new StringBuilder(decoder.path() + "?");

                for (Map.Entry<String, List<String>> p : decoder.parameters().entrySet()) {
                    for (String value : p.getValue()) {
                        sb.append(p.getKey()).append("=").append(URLEncoder.encode(value, "UTF-8"));
                    }
View Full Code Here

            try {
                container.logger().warn("Invalid URI: " + uri + ".  Attempting to parse query string.", e);
                QueryStringDecoder decoder = new QueryStringDecoder(uri);

                StringBuilder sb = new StringBuilder(decoder.path() + "?");

                for (Map.Entry<String, List<String>> p : decoder.parameters().entrySet()) {
                    for (String value : p.getValue()) {
                        sb.append(p.getKey()).append("=").append(URLEncoder.encode(value, "UTF-8"));
                    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.