Java Code Examples for javax.servlet.DispatcherType#FORWARD

The following examples show how to use javax.servlet.DispatcherType#FORWARD . 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 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 3
Source File: ServletHttpAsyncRequest.java    From spring-boot-protocol with Apache License 2.0 4 votes vote down vote up
@Override
public DispatcherType getDispatcherType() {
    return DispatcherType.FORWARD;
}
 
Example 4
Source File: ServletHttpForwardRequest.java    From spring-boot-protocol with Apache License 2.0 4 votes vote down vote up
@Override
public DispatcherType getDispatcherType() {
    return DispatcherType.FORWARD;
}