/** * Check If the uri of the resource is protected: it cannot be accessed by accessing the url directly (WEB-INF * folder). * * @param uri * the uri to check. * @return true if the uri is a protected resource. */ public static boolean isProtectedResource(final String uri) { return WroUtil.startsWithIgnoreCase(uri, PROTECTED_PREFIX); }
/** * Check If the uri of the resource is protected: it cannot be accessed by accessing the url directly (WEB-INF * folder). * * @param uri * the uri to check. * @return true if the uri is a protected resource. */ public static boolean isProtectedResource(final String uri) { return WroUtil.startsWithIgnoreCase(uri, PROTECTED_PREFIX); }
/** * Retrieve pathInfo from a given location. * * @param request * @param location * where to search contextPath. * @return pathInfo value. */ public static String getPathInfoFromLocation(final HttpServletRequest request, final String location) { if (StringUtils.isEmpty(location)) { throw new IllegalArgumentException("Location cannot be empty string!"); } final String contextPath = request.getContextPath(); if (contextPath != null) { if (startsWithIgnoreCase(location, contextPath)) { return location.substring(contextPath.length()); } else { return location; } } final String noSlash = location.substring(1); final int nextSlash = noSlash.indexOf('/'); if (nextSlash == -1) { return ""; } final String pathInfo = noSlash.substring(nextSlash); return pathInfo; }
/** * Retrieve pathInfo from a given location. * * @param request * @param location * where to search contextPath. * @return pathInfo value. */ public static String getPathInfoFromLocation(final HttpServletRequest request, final String location) { if (StringUtils.isEmpty(location)) { throw new IllegalArgumentException("Location cannot be empty string!"); } final String contextPath = request.getContextPath(); if (contextPath != null) { if (startsWithIgnoreCase(location, contextPath)) { return location.substring(contextPath.length()); } else { return location; } } final String noSlash = location.substring(1); final int nextSlash = noSlash.indexOf('/'); if (nextSlash == -1) { return ""; } return noSlash.substring(nextSlash); }