Java Code Examples for io.undertow.servlet.handlers.ServletPathMatch#getMatched()

The following examples show how to use io.undertow.servlet.handlers.ServletPathMatch#getMatched() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HttpServletRequestImpl.java    From quarkus-http with Apache License 2.0 5 votes vote down vote up
@Override
public HttpServletMapping getHttpServletMapping() {
    ServletRequestContext src = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY);
    ServletPathMatch match = src.getOriginalServletPathMatch();
    if (getDispatcherType() == DispatcherType.FORWARD) {
        match = src.getServletPathMatch();
    }
    String matchValue;
    switch (match.getMappingMatch()) {
        case EXACT:
            matchValue = match.getMatched();
            if (matchValue.startsWith("/")) {
                matchValue = matchValue.substring(1);
            }
            break;
        case DEFAULT:
        case CONTEXT_ROOT:
            matchValue = "";
            break;
        case PATH:
            matchValue = match.getRemaining();
            if (matchValue.startsWith("/")) {
                matchValue = matchValue.substring(1);
            }
            break;
        case EXTENSION:
            matchValue = match.getMatched().substring(0, match.getMatched().length() - match.getMatchString().length() + 1);
            if (matchValue.startsWith("/")) {
                matchValue = matchValue.substring(1);
            }
            break;
        default:
            matchValue = match.getRemaining();
    }
    return new MappingImpl(matchValue, match.getMatchString(), match.getMappingMatch(), match.getServletChain().getManagedServlet().getServletInfo().getName());
}
 
Example 2
Source File: HttpServletRequestImpl.java    From quarkus-http with Apache License 2.0 5 votes vote down vote up
@Override
public String getServletPath() {
    ServletPathMatch match = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY).getServletPathMatch();
    if (match != null) {
        return match.getMatched();
    }
    return "";
}
 
Example 3
Source File: HttpServletRequestImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public HttpServletMapping getHttpServletMapping() {
    ServletRequestContext src = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY);
    ServletPathMatch match = src.getOriginalServletPathMatch();
    if(getDispatcherType() == DispatcherType.FORWARD) {
        match = src.getServletPathMatch();
    }
    String matchValue;
    switch (match.getMappingMatch()) {
        case EXACT:
            matchValue = match.getMatched();
            if(matchValue.startsWith("/")) {
                matchValue = matchValue.substring(1);
            }
            break;
        case DEFAULT:
        case CONTEXT_ROOT:
            matchValue = "";
            break;
        case PATH:
            matchValue = match.getRemaining();
            if(matchValue.startsWith("/")) {
                matchValue = matchValue.substring(1);
            }
            break;
        case EXTENSION:
            matchValue = match.getMatched().substring(0, match.getMatched().length() - match.getMatchString().length() + 1);
            if(matchValue.startsWith("/")) {
                matchValue = matchValue.substring(1);
            }
            break;
        default:
            matchValue = match.getRemaining();
    }
    return new MappingImpl(matchValue, match.getMatchString(), match.getMappingMatch(), match.getServletChain().getManagedServlet().getServletInfo().getName());
}
 
Example 4
Source File: HttpServletRequestImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String getServletPath() {
    ServletPathMatch match = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY).getServletPathMatch();
    if (match != null) {
        return match.getMatched();
    }
    return "";
}