Example usage for org.apache.wicket.request Url prependLeadingSegments

List of usage examples for org.apache.wicket.request Url prependLeadingSegments

Introduction

In this page you can find the example usage for org.apache.wicket.request Url prependLeadingSegments.

Prototype

public void prependLeadingSegments(final List<String> newSegments) 

Source Link

Document

Convenience method that prepends segments to the segments collection

Usage

From source file:org.artifactory.webapp.wicket.application.ArtifactoryRequestCycleListener.java

License:Open Source License

private void fixSimpleRepoBrowsingUrl(Request request, Url url) {
    RepoPath repoPath = RequestUtils.getRepoPath((HttpServletRequest) request.getContainerRequest());
    if (repoPath != null) {
        /*ArrayList<String> prefix = new ArrayList<String>();
        String path = repoPath.getPath();
        if (StringUtils.isNotEmpty(path)) {
        int nesting = new StringTokenizer(path, "/").countTokens() + 1;
        while (nesting > 0) {//from ww w .  jav a  2s.c o  m
            prefix.add("..");
            nesting--;
        }
        } else {
        prefix.add("..");
        }
        */
        List<String> prefix = Lists.newArrayList("..");
        String filterPath = request.getFilterPath();
        if (StringUtils.isNotEmpty(filterPath) && filterPath.startsWith("/")) {
            prefix.add(filterPath.substring(1));
        }

        url.prependLeadingSegments(prefix);
    }
}