Exemplo n.º 1
0
    public final String getUrl() {
        // try to stick to the current view if possible
        StaplerRequest req = Stapler.getCurrentRequest();
        if (req != null) {
            String seed = Functions.getNearestAncestorUrl(req,this);
            if(seed!=null) {
                // trim off the context path portion and leading '/', but add trailing '/'
                return seed.substring(req.getContextPath().length()+1)+'/';
            }
        }

        // otherwise compute the path normally
        return getParent().getUrl()+getShortUrl();
    }
Exemplo n.º 2
0
 /**
  * Used to render the side panel "Back to project" link.
  *
  * <p>In a rare situation where a build can be reached from multiple paths, returning different
  * URLs from this method based on situations might be desirable.
  *
  * <p>If you override this method, you'll most likely also want to override {@link
  * #getDisplayName()}.
  */
 public String getUpUrl() {
   return Functions.getNearestAncestorUrl(Stapler.getCurrentRequest(), getParent()) + '/';
 }