Class ServletUtils

    • Constructor Detail

      • ServletUtils

        public ServletUtils()
    • Method Detail

      • getUriQuery

        public static String getUriQuery​(javax.servlet.http.HttpServletRequest request)
      • appendUriQuery

        public static StringBuilder appendUriQuery​(javax.servlet.http.HttpServletRequest request,
                                                   StringBuilder sb)
      • getLoginUrl

        public static StringBuilder getLoginUrl​(javax.servlet.http.HttpServletRequest request)
      • absUrlBase

        public static StringBuilder absUrlBase​(javax.servlet.http.HttpServletRequest request,
                                               String serverName)
      • getRequestUrl

        public static String getRequestUrl​(javax.servlet.http.HttpServletRequest request)
      • getRequestUrl

        public static String getRequestUrl​(javax.servlet.http.HttpServletRequest request,
                                           String pathLang)
      • getClientBuilder

        public static StringBuilder getClientBuilder​(javax.servlet.http.HttpServletRequest request,
                                                     StringBuilder builder)
      • getClientIp

        public static String getClientIp​(javax.servlet.http.HttpServletRequest request)
      • getAppDir

        public static String getAppDir​(javax.servlet.ServletContext sc)
      • isGzipAccepted

        public static boolean isGzipAccepted​(javax.servlet.http.HttpServletRequest request)
      • isAjaxRequest

        public static boolean isAjaxRequest​(javax.servlet.http.HttpServletRequest request)
      • setContentDisposition

        public static void setContentDisposition​(javax.servlet.http.HttpServletResponse response,
                                                 String fileName,
                                                 boolean inline)
      • allowContentType

        public static boolean allowContentType​(String contentType,
                                               String allowType)
      • parseLanguage

        public static String parseLanguage​(javax.servlet.http.HttpServletRequest request,
                                           Collection<String> supportedLanguages)
      • getMutex

        public static Object getMutex​(javax.servlet.http.HttpSession session)
      • getMutex

        public static Object getMutex​(javax.servlet.ServletContext context)
      • getRequestDispatcher

        public static javax.servlet.RequestDispatcher getRequestDispatcher​(javax.servlet.http.HttpServletRequest request,
                                                                           String path)
      • forward

        public static void forward​(javax.servlet.http.HttpServletRequest request,
                                   javax.servlet.http.HttpServletResponse response,
                                   String path)
                            throws javax.servlet.ServletException,
                                   IOException
        Throws:
        javax.servlet.ServletException
        IOException
      • include

        public static void include​(javax.servlet.http.HttpServletRequest request,
                                   javax.servlet.http.HttpServletResponse response,
                                   String path)
                            throws javax.servlet.ServletException,
                                   IOException
        Throws:
        javax.servlet.ServletException
        IOException
      • toWrapperPath

        public static String toWrapperPath​(javax.servlet.http.HttpServletRequest request)
      • toWrapperPath

        public static String toWrapperPath​(javax.servlet.http.HttpServletResponse response)
      • unwrapRequest

        public static <T> T unwrapRequest​(javax.servlet.http.HttpServletRequest request,
                                          Class<T> toImpl)
      • unwrapResponse

        public static <T> T unwrapResponse​(javax.servlet.http.HttpServletResponse response,
                                           Class<T> toImpl)
      • getCookieValue

        public static String getCookieValue​(javax.servlet.http.HttpServletRequest request,
                                            String name)
      • removeCookie

        public static void removeCookie​(javax.servlet.http.HttpServletResponse response,
                                        String name,
                                        String domain,
                                        String path)
      • getCookiePath

        public static String getCookiePath​(javax.servlet.ServletContext sc)
      • getClientZone

        public static ZoneOffset getClientZone​(javax.servlet.http.HttpServletRequest request)
      • toEtag

        public static String toEtag​(byte[] md5)
      • checkNotModified

        public static boolean checkNotModified​(javax.servlet.http.HttpServletRequest request,
                                               javax.servlet.http.HttpServletResponse response,
                                               long lastModifiedMs)
      • checkNotModified

        public static boolean checkNotModified​(javax.servlet.http.HttpServletRequest request,
                                               javax.servlet.http.HttpServletResponse response,
                                               String etag)
      • checkPrecondition

        public static boolean checkPrecondition​(javax.servlet.http.HttpServletRequest request,
                                                javax.servlet.http.HttpServletResponse response,
                                                long lastModifiedMs)
      • checkPrecondition

        public static boolean checkPrecondition​(javax.servlet.http.HttpServletRequest request,
                                                javax.servlet.http.HttpServletResponse response,
                                                String etag)
      • getUserPrincipal

        public static UserPrincipal getUserPrincipal​(javax.servlet.http.HttpServletRequest request)
      • getRequiredPrincipal

        public static UserPrincipal getRequiredPrincipal​(javax.servlet.http.HttpServletRequest request)
      • setWWWAuthenticate

        public static void setWWWAuthenticate​(javax.servlet.http.HttpServletResponse response,
                                              String authType,
                                              String realmName)
      • removeAttribute

        public static Object removeAttribute​(javax.servlet.http.HttpServletRequest request,
                                             String attribute)
      • getInitParam

        public static String getInitParam​(javax.servlet.FilterConfig config,
                                          String paramName,
                                          String defaultValue)
      • getInitParam

        public static String getInitParam​(javax.servlet.ServletConfig config,
                                          String paramName,
                                          String defaultValue)
      • getInitParam

        public static String getInitParam​(javax.servlet.ServletContext sc,
                                          String paramName,
                                          String defaultValue)
      • getRequestContext

        public static RequestContext getRequestContext​(javax.servlet.http.HttpServletRequest request)
      • getModelState

        public static ModelState getModelState​(javax.servlet.http.HttpServletRequest request)
      • getMessages

        public static Messages getMessages​(javax.servlet.http.HttpServletRequest request)
      • getTempData

        public static TempData getTempData​(javax.servlet.http.HttpServletRequest request)
      • getPrefCookie

        public static PrefCookie getPrefCookie​(javax.servlet.http.HttpServletRequest request)
      • getResources

        public static Resources getResources​(javax.servlet.http.HttpServletRequest request)
      • getFormatProvider

        public static com.appslandia.common.base.FormatProvider getFormatProvider​(javax.servlet.http.HttpServletRequest request)
      • addError

        public static void addError​(javax.servlet.http.HttpServletRequest request,
                                    String fieldName,
                                    String msgKey)
      • addError

        public static void addError​(javax.servlet.http.HttpServletRequest request,
                                    String fieldName,
                                    String msgKey,
                                    Map<String,​Object> msgParams)
      • getAppScoped

        public static <T> T getAppScoped​(javax.servlet.http.HttpServletRequest request,
                                         Class<T> beanType)
      • getAppScoped

        public static <T> T getAppScoped​(javax.servlet.ServletContext sc,
                                         Class<T> beanType)
      • loadProps

        public static boolean loadProps​(javax.servlet.ServletContext sc,
                                        String resourcePath,
                                        com.appslandia.common.base.PropertyConfig config)
                                 throws IOException
        Throws:
        IOException