From 37625d67bb7a0b85166ad96ea3b6aaeb3ebdf709 Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Tue, 29 Mar 2011 21:02:54 -0700 Subject: [PATCH] added a convenience method --- core/src/main/java/hudson/model/Descriptor.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/model/Descriptor.java b/core/src/main/java/hudson/model/Descriptor.java index 5ad77d0862..7bf2a608f0 100644 --- a/core/src/main/java/hudson/model/Descriptor.java +++ b/core/src/main/java/hudson/model/Descriptor.java @@ -292,7 +292,18 @@ public abstract class Descriptor> implements Saveable { return "descriptorByName/"+getId(); } - private String getCurrentDescriptorByNameUrl() { + /** + * Gets the URL that this Descriptor is bound to, relative to the context path. + * @since 1.406 + */ + public final String getDescriptorFullUrl() { + return getCurrentDescriptorByNameUrl()+'/'+getDescriptorUrl(); + } + + /** + * @since 1.402 + */ + public static String getCurrentDescriptorByNameUrl() { StaplerRequest req = Stapler.getCurrentRequest(); Ancestor a = req.findAncestor(DescriptorByNameOwner.class); return a.getUrl();