public interface UrlFormatter
By default, these gerrit URLs are formed by adding suffixes to the web URL. The interface centralizes these conventions, and also allows introducing different, custom URL schemes.
Unfortunately, Gerrit operates in modes for which there is no canonical URL. This can be in standalone utilities that have no HTTP server (eg. index upgrade commands), in servers that run SSH only, or in a HTTP/SSH server that is accessed over SSH without canonical web URL configured.
Modifier and Type | Method and Description |
---|---|
default java.util.Optional<java.lang.String> |
getChangeViewUrl(Project.NameKey project,
Change.Id id)
Returns the URL for viewing a change.
|
default java.util.Optional<java.lang.String> |
getDocUrl(java.lang.String page,
java.lang.String anchor)
Returns a URL pointing to a documentation page, at a given named anchor.
|
default java.util.Optional<java.lang.String> |
getInlineCommentView(Change change,
int patchsetId,
java.lang.String filename,
short side,
int startLine)
Returns the URL for viewing a comment in a file in a given patch set of a change.
|
default java.util.Optional<java.lang.String> |
getPatchFileView(Change change,
int patchsetId,
java.lang.String filename)
Returns the URL for viewing a file in a given patch set of a change.
|
default java.util.Optional<java.lang.String> |
getRestUrl(java.lang.String suffix)
Returns a REST API URL for a given suffix (eg.
|
default java.util.Optional<java.lang.String> |
getSettingsUrl()
Returns a URL pointing to the settings page.
|
default java.util.Optional<java.lang.String> |
getSettingsUrl(java.lang.String section)
Returns a URL pointing to a section of the settings page, or the settings page if
section is null. |
java.util.Optional<java.lang.String> |
getWebUrl()
The canonical base URL where this Gerrit installation can be reached.
|
java.util.Optional<java.lang.String> getWebUrl()
For the default implementations below to work, it must end in "/".
default java.util.Optional<java.lang.String> getChangeViewUrl(Project.NameKey project, Change.Id id)
default java.util.Optional<java.lang.String> getPatchFileView(Change change, int patchsetId, java.lang.String filename)
default java.util.Optional<java.lang.String> getInlineCommentView(Change change, int patchsetId, java.lang.String filename, short side, int startLine)
default java.util.Optional<java.lang.String> getSettingsUrl()
default java.util.Optional<java.lang.String> getSettingsUrl(java.lang.String section)
section
is null.default java.util.Optional<java.lang.String> getDocUrl(java.lang.String page, java.lang.String anchor)
default java.util.Optional<java.lang.String> getRestUrl(java.lang.String suffix)