Example usage for javax.servlet.http HttpServletRequest getHttpServletMapping

List of usage examples for javax.servlet.http HttpServletRequest getHttpServletMapping

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletRequest getHttpServletMapping.

Prototype


default public HttpServletMapping getHttpServletMapping() 

Source Link

Document

<p>Return the HttpServletMapping by which the HttpServlet for this HttpServletRequest was invoked.

Usage

From source file:org.apache.tomee.security.cdi.TomEESecurityServletAuthenticationMechanismMapper.java

public HttpAuthenticationMechanism getCurrentAuthenticationMechanism(
        final HttpMessageContext httpMessageContext) {
    final HttpServletRequest request = httpMessageContext.getRequest();

    if (request.getRequestURI().endsWith("j_security_check")) {
        return CDI.current().select(FormAuthenticationMechanism.class).get();
    }/* w  w w.ja va 2  s.c  o  m*/

    final String servletName = request.getHttpServletMapping().getServletName();
    return servletAuthenticationMapper.getOrDefault(servletName, defaultAuthenticationMechanism);
}