added a convenience method

This commit is contained in:
Kohsuke Kawaguchi committed 2011-04-19 16:27:45 -07:00
1 parent f89ff9ac8c
commit 37625d67bb
1 file changed
+12 -1
@@ -292,7 +292,18 @@ public abstract class Descriptor<T extends Describable<T>> 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();