|
I went to see what I was doing maybe this helps.
ERX class here handles deployment URLs properly so I don’t need to fuss there if I generate my URL from here
ERXRouteUrlUtils.actionUrlForEntity
I have a simple function
public static String cleanedLink(String link) {
That actually uses D2W to contain a dictionary of replacements, to shorten specific URLs that likely match to an apache rule that unpacks it to the full endpoint URL in WO and I might use it for simple static page DA urls
"truanon/wa/about" = "about”;
That’s how I seem to do very short links in production, while not having issue while in development and seems to work fine.
I get the domain from an ERX class
String applicationHost = ERXConfigurationManager.defaultManager().hostName();
Because I run staging and developer machines etc.
"http://" + applicationHost + "/verify?
Produces a shortened URL I can send in email that is expected to run on whichever host sent it.
> On Feb 16, 2021, at 5:44 PM, Paul Hoadley <webobjects-dev@wocommunity.org> wrote:
>
> On 17 Feb 2021, at 01:21, Susanne Schneider <webobjects-dev@wocommunity.org> wrote:
>
>> this is indeed not so trivial as you could think, at least I did not find an easy way. You can ask the application to get the name of itself, ask the WOAdaptor for the adaptor part, but you cannot find out the name of the server, especially if your installation is behind a firewall or proxy and the external server name is different from the internal name.
>>
>> We finally used a custom configuration parameter to get the server name (including the adaptor path) and startet from there on, something like:
>> url = servername + applicationname + ".woa/wa/" + yourActionName
>
> And then if you're using re-writing to shorten the URL, it gets even more complicated to do it in a general way. We pretty much gave up completely, and most apps now have a property like this:
>
> net.logicsquad.example.directActionUrl=https://example.com/app/wa
>
>
> --
> Paul Hoadley
> https://logicsquad.net/
> https://www.linkedin.com/company/logic-squad/
>
>
>
|
|