All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.yeauty.support.AntPathMatcherWraaper Maven / Gradle / Ivy

There is a newer version: 0.12.0
Show newest version
package org.yeauty.support;

import io.netty.channel.Channel;
import io.netty.handler.codec.http.QueryStringDecoder;
import org.springframework.util.AntPathMatcher;

import java.util.LinkedHashMap;
import java.util.Map;

import static org.yeauty.pojo.PojoEndpointServer.URI_TEMPLATE;

public class AntPathMatcherWraaper extends AntPathMatcher implements WsPathMatcher {

    private String pattern;

    public AntPathMatcherWraaper(String pattern) {
        this.pattern = pattern;
    }

    @Override
    public String getPattern() {
        return this.pattern;
    }

    @Override
    public boolean matchAndExtract(QueryStringDecoder decoder, Channel channel) {
        Map variables = new LinkedHashMap<>();
        boolean result = doMatch(pattern, decoder.path(), true, variables);
        if (result) {
            channel.attr(URI_TEMPLATE).set(variables);
            return true;
        }
        return false;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy