code:     public static String getContextPath(HttpServletRequest request) {
          String contextPath = (String) request.getAttribute(INCLUDE_CONTEXT_PATH_ATTRIBUTE);
          if (contextPath == null) {
              contextPath = request.getContextPath();
          }
          if ("/".equals(contextPath)) {
              // Invalid case, but happens for includes on Jetty: silently adapt it.
              contextPath = "";
          }
          return decodeRequestString(request, contextPath);
      }
  
      /**
       * Find the Shiro {@link WebEnvironment} for this web application, which is typically loaded via the
       * {@link org.apache.shiro.web.env.EnvironmentLoaderListener}.
       * <p/>
       * This implementation rethrows an exception that happened on environment startup to differentiate between a failed
       * environment startup and no environment at all.
       *
       * @param sc ServletContext to find the web application context for
       * @return the root WebApplicationContext for this web app
       * @throws IllegalStateException if the root WebApplicationContext could not be found
       * @see org.apache.shiro.web.env.EnvironmentLoader#ENVIRONMENT_ATTRIBUTE_KEY
       * @since 1.2
       */
  