@Override public RequestPath modifyContextPath(String contextPath) { return new DefaultRequestPath(this, contextPath); }
private DefaultRequestPath(RequestPath requestPath, String contextPath) { this.fullPath = requestPath; this.contextPath = initContextPath(this.fullPath, contextPath); this.pathWithinApplication = extractPathWithinApplication(this.fullPath, this.contextPath); }
private static PathContainer initContextPath(PathContainer path, @Nullable String contextPath) { if (!StringUtils.hasText(contextPath) || "/".equals(contextPath)) { return PathContainer.parsePath(""); } validateContextPath(path.value(), contextPath); int length = contextPath.length(); int counter = 0; for (int i=0; i < path.elements().size(); i++) { PathContainer.Element element = path.elements().get(i); counter += element.value().length(); if (length == counter) { return path.subPath(0, i + 1); } } // Should not happen.. throw new IllegalStateException("Failed to initialize contextPath '" + contextPath + "'" + " for requestPath '" + path.value() + "'"); }
private static PathContainer initContextPath(PathContainer path, @Nullable String contextPath) { if (!StringUtils.hasText(contextPath) || "/".equals(contextPath)) { return PathContainer.parsePath(""); } validateContextPath(path.value(), contextPath); int length = contextPath.length(); int counter = 0; for (int i=0; i < path.elements().size(); i++) { PathContainer.Element element = path.elements().get(i); counter += element.value().length(); if (length == counter) { return path.subPath(0, i + 1); } } // Should not happen.. throw new IllegalStateException("Failed to initialize contextPath '" + contextPath + "'" + " for requestPath '" + path.value() + "'"); }
private DefaultRequestPath(RequestPath requestPath, String contextPath) { this.fullPath = requestPath; this.contextPath = initContextPath(this.fullPath, contextPath); this.pathWithinApplication = extractPathWithinApplication(this.fullPath, this.contextPath); }
/** * Create a new {@code RequestPath} with the given parameters. */ static RequestPath parse(URI uri, @Nullable String contextPath) { return new DefaultRequestPath(uri, contextPath); }
private static PathContainer initContextPath(PathContainer path, @Nullable String contextPath) { if (!StringUtils.hasText(contextPath) || "/".equals(contextPath)) { return PathContainer.parsePath(""); } validateContextPath(path.value(), contextPath); int length = contextPath.length(); int counter = 0; for (int i=0; i < path.elements().size(); i++) { PathContainer.Element element = path.elements().get(i); counter += element.value().length(); if (length == counter) { return path.subPath(0, i + 1); } } // Should not happen.. throw new IllegalStateException("Failed to initialize contextPath '" + contextPath + "'" + " for requestPath '" + path.value() + "'"); }
DefaultRequestPath(URI uri, @Nullable String contextPath) { this.fullPath = PathContainer.parsePath(uri.getRawPath()); this.contextPath = initContextPath(this.fullPath, contextPath); this.pathWithinApplication = extractPathWithinApplication(this.fullPath, this.contextPath); }
@Override public RequestPath modifyContextPath(String contextPath) { return new DefaultRequestPath(this, contextPath); }
private static PathContainer initContextPath(PathContainer path, @Nullable String contextPath) { if (!StringUtils.hasText(contextPath) || "/".equals(contextPath)) { return PathContainer.parsePath(""); } validateContextPath(path.value(), contextPath); int length = contextPath.length(); int counter = 0; for (int i=0; i < path.elements().size(); i++) { PathContainer.Element element = path.elements().get(i); counter += element.value().length(); if (length == counter) { return path.subPath(0, i + 1); } } // Should not happen.. throw new IllegalStateException("Failed to initialize contextPath '" + contextPath + "'" + " for requestPath '" + path.value() + "'"); }
DefaultRequestPath(URI uri, @Nullable String contextPath) { this.fullPath = PathContainer.parsePath(uri.getRawPath()); this.contextPath = initContextPath(this.fullPath, contextPath); this.pathWithinApplication = extractPathWithinApplication(this.fullPath, this.contextPath); }
/** * Create a new {@code RequestPath} with the given parameters. */ static RequestPath parse(URI uri, @Nullable String contextPath) { return new DefaultRequestPath(uri, contextPath); }
private DefaultRequestPath(RequestPath requestPath, String contextPath) { this.fullPath = requestPath; this.contextPath = initContextPath(this.fullPath, contextPath); this.pathWithinApplication = extractPathWithinApplication(this.fullPath, this.contextPath); }
@Override public RequestPath modifyContextPath(String contextPath) { return new DefaultRequestPath(this, contextPath); }
private DefaultRequestPath(RequestPath requestPath, String contextPath) { this.fullPath = requestPath; this.contextPath = initContextPath(this.fullPath, contextPath); this.pathWithinApplication = extractPathWithinApplication(this.fullPath, this.contextPath); }
@Override public RequestPath modifyContextPath(String contextPath) { return new DefaultRequestPath(this, contextPath); }
DefaultRequestPath(URI uri, @Nullable String contextPath) { this.fullPath = PathContainer.parsePath(uri.getRawPath()); this.contextPath = initContextPath(this.fullPath, contextPath); this.pathWithinApplication = extractPathWithinApplication(this.fullPath, this.contextPath); }
/** * Create a new {@code RequestPath} with the given parameters. */ static RequestPath parse(URI uri, @Nullable String contextPath) { return new DefaultRequestPath(uri, contextPath); }
DefaultRequestPath(URI uri, @Nullable String contextPath) { this.fullPath = PathContainer.parsePath(uri.getRawPath()); this.contextPath = initContextPath(this.fullPath, contextPath); this.pathWithinApplication = extractPathWithinApplication(this.fullPath, this.contextPath); }
/** * Create a new {@code RequestPath} with the given parameters. */ static RequestPath parse(URI uri, @Nullable String contextPath) { return new DefaultRequestPath(uri, contextPath); }