Two important questions should be considered:
- Do you generate the URL inside of a request-response cycle or possibly also inside of a background task?
- If during a request, WOContext.directActionURLForActionNamed works fine, as written by René and Ramsey. This works because the WOContext takes the URL used in the HTTP WORequest.
- Else:
- Is the host, which the app is running on, the one directly accessed by users via HTTP?
- If yes, you might be able to use ERXConfigurationManager.defaultManager().hostName() as suggested by Jesse (it uses InetAddress.getLocalHost().getHostName() internally)
- Else:
- Just define a configuration property containing the base URL (can certainly be specified per environment) as written by Paul.
Best regards, Stefan
The subject line already says all
Thanks
Markus Ruggiero
4051 Basel / Switzerland mobile +41 79 508 4701
|