Class WebUtils


  • public abstract class WebUtils
    extends java.lang.Object
    Web Utilities Class
    Since:
    1.0.0
    Author:
    Mercy
    See Also:
    WebUtils
    • Constructor Summary

      Constructors 
      Constructor Description
      WebUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Map<java.lang.String,​? extends javax.servlet.FilterRegistration> findFilterRegistrations​(javax.servlet.ServletContext servletContext, java.lang.Class<? extends javax.servlet.Filter> filterClass)
      Find the map of FilterRegistration in specified Filter Class
      protected static <R extends javax.servlet.Registration>
      java.util.Map<java.lang.String,​R>
      findRegistrations​(javax.servlet.ServletContext servletContext, java.util.Map<java.lang.String,​R> registrationsMap, java.lang.Class<?> targetClass)
      Find the map of Registration in specified Class
      static java.util.Map<java.lang.String,​? extends javax.servlet.ServletRegistration> findServletRegistrations​(javax.servlet.ServletContext servletContext, java.lang.Class<? extends javax.servlet.Servlet> servletClass)
      Find the map of ServletRegistration in specified Servlet Class
      static javax.servlet.ServletContext getServletContext​(javax.servlet.http.HttpServletRequest request)
      Get ServletContext from HttpServletRequest
      static boolean isRunningBelowServlet3Container()
      Is Running below Servlet 3 Container
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WebUtils

        public WebUtils()
    • Method Detail

      • isRunningBelowServlet3Container

        public static boolean isRunningBelowServlet3Container()
        Is Running below Servlet 3 Container
        Returns:
        If below , true
      • getServletContext

        public static javax.servlet.ServletContext getServletContext​(javax.servlet.http.HttpServletRequest request)
        Get ServletContext from HttpServletRequest
        Parameters:
        request - HttpServletRequest
        Returns:
        non-null
      • findFilterRegistrations

        public static java.util.Map<java.lang.String,​? extends javax.servlet.FilterRegistration> findFilterRegistrations​(javax.servlet.ServletContext servletContext,
                                                                                                                               java.lang.Class<? extends javax.servlet.Filter> filterClass)
        Find the map of FilterRegistration in specified Filter Class
        Parameters:
        servletContext - ServletContext
        filterClass - The of class of Filter
        Returns:
        the map of ServletRegistration
      • findServletRegistrations

        public static java.util.Map<java.lang.String,​? extends javax.servlet.ServletRegistration> findServletRegistrations​(javax.servlet.ServletContext servletContext,
                                                                                                                                 java.lang.Class<? extends javax.servlet.Servlet> servletClass)
        Find the map of ServletRegistration in specified Servlet Class
        Parameters:
        servletContext - ServletContext
        servletClass - The of class of Servlet
        Returns:
        the unmodifiable map of ServletRegistration
      • findRegistrations

        protected static <R extends javax.servlet.Registration> java.util.Map<java.lang.String,​R> findRegistrations​(javax.servlet.ServletContext servletContext,
                                                                                                                          java.util.Map<java.lang.String,​R> registrationsMap,
                                                                                                                          java.lang.Class<?> targetClass)
        Find the map of Registration in specified Class
        Type Parameters:
        R - the subtype of Registration
        Parameters:
        servletContext - ServletContext
        registrationsMap - the map of Registration
        targetClass - the target Class
        Returns:
        the unmodifiable map of Registration i