1 package com.atlassian.plugin.webresource;
2
3 /**
4 * A formatting mode for URLs. Used to specify to {@code WebResourceManager} methods whether to use absolute URLs,
5 * relative URLs, or allow the concrete implementation to decide
6 *
7 * @since 2.3.0
8 */
9 public enum UrlMode
10 {
11 /**
12 * Absolute URL format, with URL scheme, hostname, port (if non-standard for the scheme), and context path.
13 */
14 ABSOLUTE,
15 /**
16 * Relative URL format, containing just the context path.
17 */
18 RELATIVE,
19 /**
20 * Unspecified URL format, indicating that either absolute or relative URLs are acceptable. Implementations are
21 * free to determine which mode to use based on any criteria of their choosing. For example, an implementation may
22 * choose to return a relative URL if it detects that it is running in the context of an HTTP request, and an
23 * absolute URL if it detects that it is not. Or it may choose to always return an absolute URL, or always return a
24 * relative URL. Callers should only use {@code WebResourceManager.UrlMode#AUTO} when they are sure that either an
25 * absolute or a relative URL will be appropriate, and should not rely on any particular observed behavior regarding
26 * how this value is interpreted, which may vary across different implementations.
27 */
28 AUTO
29 }