提交 334c3911 编写于 作者: K kohsuke

supporting the URL that starts with '/'

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17028 71c3de6d-444a-0410-be80-ed276b4c234a
上级 70335eba
......@@ -962,6 +962,8 @@ public class Functions {
if(SCHEME.matcher(urlName).matches())
return urlName; // absolute URL
if(urlName.startsWith("/"))
return Stapler.getCurrentRequest().getContextPath()+urlName+'/';
else
// relative URL name
return Stapler.getCurrentRequest().getContextPath()+'/'+itUrl+urlName+'/';
......
......@@ -91,6 +91,10 @@ public interface Action extends ModelObject {
* The returned string can be an absolute URL, like "http://www.sun.com/",
* which is useful for directly connecting to external systems.
*
* <p>
* If the returned string starts with '/', like '/foo', then it's assumed to be
* relative to the context path of the Hudson webapp.
*
* @return
* null if this action object doesn't need to be bound to web
* (when you do that, be sure to also return null from {@link #getIconFileName()}.
......
......@@ -2025,7 +2025,7 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
public Object getDynamic(String token, StaplerRequest req, StaplerResponse rsp) {
for (Action a : getActions())
if(a.getUrlName().equals(token))
if(a.getUrlName().equals(token) || a.getUrlName().equals('/'+token))
return a;
for (Action a : getManagementLinks())
if(a.getUrlName().equals(token))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册