My baseUrl is http://localhost:8080/whatever
. On other machines, it's http://localhost/whatever
.
Is there a smart way to get this information without using
<%
String baseUrl = "http://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath()
%>
I'm trying to dynamically create some links to path parameterized rest URLS, i.e:
http://localhost:8080/a/b/${param1}/c/${param2}
If there's a better way to do this, let me know.
In case you forget, isn't that was answered in the question here. Just set the grails.serverURL
and grails.app.context
in the configuration file of your deployed machine. Then use createLink
to make the URL. Or I missed something?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With