public class

BaseUrlMismatchCondition

extends Object
implements Condition
java.lang.Object
   ↳ com.atlassian.bitbucket.web.conditions.BaseUrlMismatchCondition

Class Overview

Verifies that the configured base URL is the one being used to access the instance.

Summary

Public Methods
void init(Map<StringString> map)
boolean shouldDisplay(Map<StringObject> map)
This condition compares the return values of buildConfigured() and buildAbsolute().
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.plugin.web.Condition

Public Methods

public void init (Map<StringString> map)

Throws
PluginParseException

public boolean shouldDisplay (Map<StringObject> map)

This condition compares the return values of buildConfigured() and 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.