Did you set the URL in the global config?

Sent from my Windows Phone
From: Jesse Glick
Sent: 7/15/2012 8:17 AM
To: [email protected]
Subject: Re: Getting Absolute Path of a Job
Slide wrote:
> Jenkins.getInstance().getUrl() + build.getUrl() should work I think.

Jenkins.getInstance().getUrl() is always "", so this does not work.

Yarlee wrote:
> if my http://example.com/job/test/2 is the absolute
> url of my job .. in perform I get access to (AbstractBuild ) build object
> and build.getUrl gives only test/2 how to get full url including the
> hostname

Are you sure you want to do this? Usually it is not a good idea to get
the absolute URL, since that can get broken by server
misconfiguration. Generally you want to
produce relative links.

That said, Run.getAbsoluteUrl() will give it to you if you really
want; read its deprecation message first.

Reply via email to