Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Runtime port generation in grails framework

I am using grails framework to develop a web application. I need to generate the runtime server URL as follows: http:hostname:port/application/. In grails configuration we have an option to provide the serverURL using grails.serverURL.

My question is: Can we get the port number of server which the application is running at runtime? Is this possible?

like image 639
Ramana Avatar asked Jul 06 '26 02:07

Ramana


1 Answers

Try this..

System.getProperty("server.port", "8080")

Enjoy...

like image 55
user1791574 Avatar answered Jul 09 '26 06:07

user1791574