[SOLVED] Is it possible to get hostname in Velocity Template Language?

Description
SteffPoint
Posts: 71
Joined: Wed Mar 07, 2018 1:06 pm
Location: Germany

[SOLVED] Is it possible to get hostname in Velocity Template Language?

Postby SteffPoint » Mon Mar 18, 2019 11:42 am

Hello guys,

is it possible to retrieve the hostname (for example: "www.polarionserverone.com") within Velocity script and assign it to a Variable?

As Velocity Code runs serverside I am a bit afraid it is not possible.

Kind Regards,
Steff
Last edited by SteffPoint on Tue Mar 19, 2019 2:58 pm, edited 1 time in total.

Jürgen
Posts: 86
Joined: Tue Sep 12, 2017 1:02 pm

Re: Is it possible to get hostname in Velocity Template Language?

Postby Jürgen » Tue Mar 19, 2019 11:37 am

There is a globally available variable $logredir, which at least contains the URL, maybe this already helps.

The value will not be shown correctly in preview mode of a wiki page.

It could also be possible with java script.

SteffPoint
Posts: 71
Joined: Wed Mar 07, 2018 1:06 pm
Location: Germany

Re: Is it possible to get hostname in Velocity Template Language?

Postby SteffPoint » Tue Mar 19, 2019 1:25 pm

Thank you very much Jürgen, that already helps a lot.

Do you also know about such functionality on LiveReport Pages, just in case I will need this in future?

By now I am good with the Classic Wiki Page. Thanks again!

Jürgen
Posts: 86
Joined: Tue Sep 12, 2017 1:02 pm

Re: Is it possible to get hostname in Velocity Template Language?

Postby Jürgen » Tue Mar 19, 2019 1:45 pm

As far as I know, the Live Report pages can include sections with classic wiki scripting, so there should be no difference. But I have never tried that.

scharph
Posts: 9
Joined: Wed Jul 04, 2018 9:19 am
Location: Austria

Re: [SOLVED] Is it possible to get hostname in Velocity Template Language?

Postby scharph » Wed Mar 20, 2019 7:03 am

$request.getRemoteAddr()
$request.class

$request.getServerName()


http://nexus.xwiki.org/nexus/service/lo ... erverName()

SteffPoint
Posts: 71
Joined: Wed Mar 07, 2018 1:06 pm
Location: Germany

Re: [SOLVED] Is it possible to get hostname in Velocity Template Language?

Postby SteffPoint » Wed Mar 20, 2019 8:49 am

Hello Scharph,

this works perfectly! Thank you very much! :)


Kind Regards,
Steff


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 9 guests