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(); }
/** * 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()) + '/'; }