@Override public String matchAndApply(String target, HttpServletRequest request, HttpServletResponse response) throws IOException { if (target.startsWith("/")) return URIUtil.compactPath(target); return target; } }
/** * Check the target. Called by {@link #handle(String, Request, HttpServletRequest, HttpServletResponse)} when a target within a context is determined. If * the target is protected, 404 is returned. */ /* ------------------------------------------------------------ */ public boolean isProtectedTarget(String target) { if (target == null || _protectedTargets == null) return false; while (target.startsWith("//")) target=URIUtil.compactPath(target); boolean isProtected = false; int i=0; while (!isProtected && i<_protectedTargets.length) { isProtected = StringUtil.startsWithIgnoreCase(target, _protectedTargets[i++]); } return isProtected; }
/** * Check the target. Called by {@link #handle(String, Request, HttpServletRequest, HttpServletResponse)} when a target within a context is determined. If * the target is protected, 404 is returned. */ /* ------------------------------------------------------------ */ public boolean isProtectedTarget(String target) { if (target == null || _protectedTargets == null) return false; while (target.startsWith("//")) target=URIUtil.compactPath(target); boolean isProtected = false; int i=0; while (!isProtected && i<_protectedTargets.length) { isProtected = StringUtil.startsWithIgnoreCase(target, _protectedTargets[i++]); } return isProtected; }
/** * Check the target. Called by {@link #handle(String, Request, HttpServletRequest, HttpServletResponse)} when a target within a context is determined. If * the target is protected, 404 is returned. */ /* ------------------------------------------------------------ */ public boolean isProtectedTarget(String target) { if (target == null || _protectedTargets == null) return false; while (target.startsWith("//")) target=URIUtil.compactPath(target); boolean isProtected = false; int i=0; while (!isProtected && i<_protectedTargets.length) { isProtected = StringUtil.startsWithIgnoreCase(target, _protectedTargets[i++]); } return isProtected; }
/** * Check the target. Called by {@link #handle(String, Request, HttpServletRequest, HttpServletResponse)} when a target within a context is determined. If * the target is protected, 404 is returned. */ /* ------------------------------------------------------------ */ public boolean isProtectedTarget(String target) { if (target == null || _protectedTargets == null) return false; while (target.startsWith("//")) target=URIUtil.compactPath(target); boolean isProtected = false; int i=0; while (!isProtected && i<_protectedTargets.length) { isProtected = StringUtil.startsWithIgnoreCase(target, _protectedTargets[i++]); } return isProtected; }
/** * Check the target. Called by {@link #handle(String, Request, HttpServletRequest, HttpServletResponse)} when a target within a context is determined. If * the target is protected, 404 is returned. */ /* ------------------------------------------------------------ */ public boolean isProtectedTarget(String target) { if (target == null || _protectedTargets == null) return false; while (target.startsWith("//")) target=URIUtil.compactPath(target); boolean isProtected = false; int i=0; while (!isProtected && i<_protectedTargets.length) { isProtected = StringUtil.startsWithIgnoreCase(target, _protectedTargets[i++]); } return isProtected; }
/** * Check the target. Called by {@link #handle(String, Request, HttpServletRequest, HttpServletResponse)} when a target within a context is determined. If * the target is protected, 404 is returned. */ /* ------------------------------------------------------------ */ public boolean isProtectedTarget(String target) { if (target == null || _protectedTargets == null) return false; while (target.startsWith("//")) target=URIUtil.compactPath(target); boolean isProtected = false; int i=0; while (!isProtected && i<_protectedTargets.length) { isProtected = StringUtil.startsWithIgnoreCase(target, _protectedTargets[i++]); } return isProtected; }
/** * Check the target. Called by {@link #handle(String, Request, HttpServletRequest, HttpServletResponse)} when a target within a context is determined. If * the target is protected, 404 is returned. */ /* ------------------------------------------------------------ */ public boolean isProtectedTarget(String target) { if (target == null || _protectedTargets == null) return false; while (target.startsWith("//")) target=URIUtil.compactPath(target); boolean isProtected = false; int i=0; while (!isProtected && i<_protectedTargets.length) { isProtected = StringUtil.startsWithIgnoreCase(target, _protectedTargets[i++]); } return isProtected; }
@Override public void applyURI(Request request, String oldURI, String newURI) throws IOException { String uri = request.getRequestURI(); if (uri.startsWith("/")) uri = URIUtil.compactPath(uri); request.setURIPathQuery(uri); }
/** * Check the target. Called by {@link #handle(String, Request, HttpServletRequest, HttpServletResponse)} when a target within a context is determined. If * the target is protected, 404 is returned. */ /* ------------------------------------------------------------ */ public boolean isProtectedTarget(String target) { if (target == null || _protectedTargets == null) return false; while (target.startsWith("//")) target=URIUtil.compactPath(target); for (int i=0; i<_protectedTargets.length; i++) { String t=_protectedTargets[i]; if (StringUtil.startsWithIgnoreCase(target,t)) { if (target.length()==t.length()) return true; // Check that the target prefix really is a path segment, thus // it can end with /, a query, a target or a parameter char c=target.charAt(t.length()); if (c=='/'||c=='?'||c=='#'||c==';') return true; } } return false; }
/** * Check the target. Called by {@link #handle(String, Request, HttpServletRequest, HttpServletResponse)} when a target within a context is determined. If * the target is protected, 404 is returned. * @param target the target to test * @return true if target is a protected target */ public boolean isProtectedTarget(String target) { if (target == null || _protectedTargets == null) return false; while (target.startsWith("//")) target=URIUtil.compactPath(target); for (int i=0; i<_protectedTargets.length; i++) { String t=_protectedTargets[i]; if (StringUtil.startsWithIgnoreCase(target,t)) { if (target.length()==t.length()) return true; // Check that the target prefix really is a path segment, thus // it can end with /, a query, a target or a parameter char c=target.charAt(t.length()); if (c=='/'||c=='?'||c=='#'||c==';') return true; } } return false; }
/** * Check the target. Called by {@link #handle(String, Request, HttpServletRequest, HttpServletResponse)} when a target within a context is determined. If * the target is protected, 404 is returned. * * @param target * the target to test * @return true if target is a protected target */ public boolean isProtectedTarget(String target) { if (target == null || _protectedTargets == null) return false; while (target.startsWith("//")) target = URIUtil.compactPath(target); for (int i = 0; i < _protectedTargets.length; i++) { String t = _protectedTargets[i]; if (StringUtil.startsWithIgnoreCase(target,t)) { if (target.length() == t.length()) return true; // Check that the target prefix really is a path segment, thus // it can end with /, a query, a target or a parameter char c = target.charAt(t.length()); if (c == '/' || c == '?' || c == '#' || c == ';') return true; } } return false; }
public RequestDispatcher getRequestDispatcher(String path) { path = URIUtil.compactPath(path); if (path == null || _context == null) return null; // handle relative path if (!path.startsWith("/")) { String relTo = URIUtil.addPaths(_servletPath,_pathInfo); int slash = relTo.lastIndexOf("/"); if (slash > 1) relTo = relTo.substring(0,slash + 1); else relTo = "/"; path = URIUtil.addPaths(relTo,path); } return _context.getRequestDispatcher(path); }
public RequestDispatcher getRequestDispatcher(String path) { path = URIUtil.compactPath(path); if (path == null || _context == null) return null; // handle relative path if (!path.startsWith("/")) { String relTo = URIUtil.addPaths(_servletPath,_pathInfo); int slash = relTo.lastIndexOf("/"); if (slash > 1) relTo = relTo.substring(0,slash + 1); else relTo = "/"; path = URIUtil.addPaths(relTo,path); } return _context.getRequestDispatcher(path); }
public RequestDispatcher getRequestDispatcher(String path) { path = URIUtil.compactPath(path); if (path == null || _context == null) return null; // handle relative path if (!path.startsWith("/")) { String relTo = URIUtil.addPaths(_servletPath,_pathInfo); int slash = relTo.lastIndexOf("/"); if (slash > 1) relTo = relTo.substring(0,slash + 1); else relTo = "/"; path = URIUtil.addPaths(relTo,path); } return _context.getRequestDispatcher(path); }
public RequestDispatcher getRequestDispatcher(String path) { path = URIUtil.compactPath(path); if (path == null || _context == null) return null; // handle relative path if (!path.startsWith("/")) { String relTo = URIUtil.addPaths(_servletPath,_pathInfo); int slash = relTo.lastIndexOf("/"); if (slash > 1) relTo = relTo.substring(0,slash + 1); else relTo = "/"; path = URIUtil.addPaths(relTo,path); } return _context.getRequestDispatcher(path); }
@Override public RequestDispatcher getRequestDispatcher(String path) { // path is encoded, potentially with query path = URIUtil.compactPath(path); if (path == null || _context == null) return null; // handle relative path if (!path.startsWith("/")) { String relTo = URIUtil.addPaths(_servletPath,_pathInfo); int slash = relTo.lastIndexOf("/"); if (slash > 1) relTo = relTo.substring(0,slash + 1); else relTo = "/"; path = URIUtil.addPaths(relTo,path); } return _context.getRequestDispatcher(path); }
@Override public boolean isProtectedTarget(String target) { // Fixes PAXWEB-196 and PAXWEB-211 //CHECKSTYLE:OFF while (target.startsWith("//")) { target = URIUtil.compactPath(target); } //CHECKSTYLE:ON return StringUtil.startsWithIgnoreCase(target, "/web-inf") || StringUtil.startsWithIgnoreCase(target, "/meta-inf") || StringUtil.startsWithIgnoreCase(target, "/osgi-inf") || StringUtil.startsWithIgnoreCase(target, "/osgi-opt"); }
target = URIUtil.compactPath(target); if (applied!=null) applied = URIUtil.compactPath(applied);
target = URIUtil.compactPath(target); if (!checkContext(target,baseRequest,response)) return;