public class BaseUrlMismatchCondition extends Object implements com.atlassian.plugin.web.Condition
Modifier and Type | Method and Description |
---|---|
void |
init(Map<String,String> map) |
boolean |
shouldDisplay(Map<String,Object> map)
This condition compares the return values of
NavBuilder.buildConfigured() and
NavBuilder.buildAbsolute() . |
public void init(Map<String,String> map) throws com.atlassian.plugin.PluginParseException
init
in interface com.atlassian.plugin.web.Condition
com.atlassian.plugin.PluginParseException
public boolean shouldDisplay(Map<String,Object> map)
NavBuilder.buildConfigured()
and
NavBuilder.buildAbsolute()
. This works, because buildAbsolute uses the currently active request to
construct a URL, while buildConfigured uses the configured baseUrl.
Should these two not match, we can deduce that the user is accessing the instance from a URL that differs from
the configured baseUrl.
Should there not be an active request, buildAbsolute will fall back to using the configured baseUrl and this
function would evaluate to false
.shouldDisplay
in interface com.atlassian.plugin.web.Condition
Copyright © 2021 Atlassian. All rights reserved.