'How to get org.apache.catalina.connector.Request object inside doFilter method?

Previously I had a tomcat valve where I set, userPrincipal using setUserPrincipal() method of org.apache.catalina.connector.Request object.

Now I disabled the valve but I want to do the same inside a filter. Basically a valve to filter migration. I only have access to ServletRequest and HttpServletRequest inside filter.

How can I receive the request as org.apache.catalina.connector.Request object in order to use setUserPrincipal() method?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source