Obtaining TeamCity Root Url from Server Side plugin

Hi,

I have a serverside plugin where I need to know the root url for TeamCity.

I used to be able to do myServer.getRootUrl() but as of TC 2.0, this methos does not exist.

I see that one can use WebLinks, but it I am not sure how to instanciate it properly.

Thanks,

Scott

10 comments
Comment actions Permalink

The simplest way is to define WebLinks as argument of the constructor of
your class. In this case it will be provided automatically by Spring.

--
Pavel Sher

"Scott Hebert" <no_reply@jetbrains.com> wrote in message
news:10663083.1177014759455.JavaMail.itn@is.intellij.net...

Hi,

>

I have a serverside plugin where I need to know the root url for TeamCity.

>

I used to be able to do myServer.getRootUrl() but as of TC 2.0, this
methos does not exist.

>

I see that one can use WebLinks, but it I am not sure how to instanciate
it properly.

>

Thanks,

>

Scott



0
Comment actions Permalink

Thank you. This works perfectly!

Scott

0
Comment actions Permalink

I'm using webLinks.getOverviewUrl() in TC 4 and it returns http://localhost/overview.html instead of the actual URL.

The "Server URL" under Administration > Server Configuration is the correct value.

Any idea what may be wrong ?

Thanks
Hussain

0
Comment actions Permalink

Please check what value is set for the rootURL in the main-config.xml file.
<server rootURL="...">

--
Pavel Sher

0
Comment actions Permalink

That value in main-config.xml is correct: <server rootURL="http://servername.companyname.com:8111">

Strange.

0
Comment actions Permalink

What value is returned by method SBuildServer.getRootUrl() ?

--
Pavel Sher

0
Comment actions Permalink

Could you please send your plugin to teamcity-feedback [at] jetbrains.com to reproduce this problem?

--
Pavel Sher

0
Comment actions Permalink

I have the same problem..

  • main-config.xml file, the value of  <server rootURL="..."> contains the ip and the port of the server

any idea?

:(

 

0
Comment actions Permalink

Hello Ayellet,

What server URL do you see in Administration > Global Settings page in TeamCity UI? If it's the same as specified in main-config.xml, but you still get http://localhost using SBuildServer.getRootUrl() then please send your plugin for investigation using the "Submit a report" button on the top.

0

Please sign in to leave a comment.