com.atlassian.bitbucket.nav.NavBuilder |
Helps build URLs using a fluent interface. All returned URLs are URL encoded. Example usages:
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
NavBuilder.AddonRequests | |||||||||||
NavBuilder.Addons | |||||||||||
NavBuilder.Admin | The builder for /admin | ||||||||||
NavBuilder.BrowseRepoResource | The builder of urls of the form /projects/PROJ/repos/REPO/browse[/...] | ||||||||||
NavBuilder.Builder<B extends Builder> | Base interface for all terminal builders (builders which can produce a url) | ||||||||||
NavBuilder.Commit | Builds URLs of the form /projects/PROJ/repos/REPO/commits/ID | ||||||||||
NavBuilder.CommitComment | Builds URLs of the form /projects/PROJ/repos/REPO/commits/ID/comment/ID | ||||||||||
NavBuilder.Compare | The builder of urls of the form /projects/PROJ/repos/REPO/compare | ||||||||||
NavBuilder.CompareBuilder<T extends CompareBuilder> | |||||||||||
NavBuilder.CreateProject | The builder of urls of the form /projects/PROJ?create | ||||||||||
NavBuilder.CreatePullRequest | The builder for urls of the form /projects/PROJ/repos/REPO/pull-requets?create... | ||||||||||
NavBuilder.CreateRepo | The builder of urls of the form /projects/PROJ/repos?create | ||||||||||
NavBuilder.Database | |||||||||||
NavBuilder.DeleteGroup | |||||||||||
NavBuilder.DeleteUser | The builder for /users/delete | ||||||||||
NavBuilder.GettingStarted | Builds a URL to the GettingStarted page with an option of adding "next" as a query parameter with the current request url or the passed in url | ||||||||||
NavBuilder.GlobalListRepos | The builder for /repos | ||||||||||
NavBuilder.Groups | |||||||||||
NavBuilder.Licensing | |||||||||||
NavBuilder.ListBranches | The builder of urls of the form /projects/PROJ/repos/REPO/branches | ||||||||||
NavBuilder.ListCommits | The builder of urls of the form /projects/PROJ/repos/REPO/commits | ||||||||||
NavBuilder.ListProjects | The builder for /projects | ||||||||||
NavBuilder.ListPullRequests | |||||||||||
NavBuilder.ListRepos | The builder for /projects/PROJ/repos/REPO/browse - essentially the same as NavBuilder.Project but with support for start and limit params
to control the repository list
|
||||||||||
NavBuilder.ListTags | The builder of urls of the form /projects/PROJ/repos/REPO/tags[/...] | ||||||||||
NavBuilder.Login | Builds a login URL for the with an option of adding "next" as a query parameter with the current request url or the passed in url | ||||||||||
NavBuilder.NavigationStep<B extends NavigationStep<B>> | Builds URL for the with an option of adding "next" as a query parameter with the current request url or the passed in url | ||||||||||
NavBuilder.PagedBuilder<B extends PagedBuilder> | A builder for urls that represent a collection of things, one page at a time. | ||||||||||
NavBuilder.PathBuilder<B extends PathBuilder> | The builder of urls that have a path to a file resource | ||||||||||
NavBuilder.PluginServlets | The builder for the plugin servlets | ||||||||||
NavBuilder.Profile | |||||||||||
NavBuilder.Project | The builder for urls hanging off /projects/PROJ. | ||||||||||
NavBuilder.ProjectDelete | The builder of urls of the form /projects/PROJ/delete | ||||||||||
NavBuilder.ProjectPermissions | The builder of urls of the form /projects/PROJ/permissions | ||||||||||
NavBuilder.ProjectSettings | The builder of urls of the form /projects/PROJ/settings | ||||||||||
NavBuilder.PullRequest | The builder for urls of the form /projects/PROJ/repos/REPO/pull-requets/ID/... | ||||||||||
NavBuilder.PullRequestActivity | Builds URLs of the form /projects/PROJ/repos/REPO/pull-requests/ID/activities | ||||||||||
NavBuilder.PullRequestComment | Builds URLs of the form /projects/PROJ/repos/REPO/pull-requests/ID/overview?commentId=ID | ||||||||||
NavBuilder.PullRequestCommit | Builds URLs of the form /projects/PROJ/repos/REPO/pull-requests/ID/commits/ID | ||||||||||
NavBuilder.PullRequestOverview | Builds URLs of the form /projects/PROJ/repos/REPO/pull-requests/ID/overview | ||||||||||
NavBuilder.PullRequestRepoSettings | The builder of urls of the form /projects/PROJ/repos/REPO/settings/pull-requests | ||||||||||
NavBuilder.Repo | The builder of urls hanging off /projects/PROJ/repos/REPO. | ||||||||||
NavBuilder.RepoAttachments | The builder of urls of the form /projects/PROJ/repos/REPO/attachments | ||||||||||
NavBuilder.RepoDelete | The builder of urls of the form /projects/PROJ/repos/REPO/delete | ||||||||||
NavBuilder.RepoFork | The builder for urls of the form /projects/PROJ/repos/REPO?fork | ||||||||||
NavBuilder.RepoHooks | The builder of urls of the form /projects/PROJ/repos/REPO/hooks | ||||||||||
NavBuilder.RepoPermissions | |||||||||||
NavBuilder.RepoSettings | The builder of urls of the form /projects/PROJ/repos/REPO/settings | ||||||||||
NavBuilder.Rest | The builder for the REST API | ||||||||||
NavBuilder.RestAdmin | The builder for the REST admin API | ||||||||||
NavBuilder.RestHook | The builder of urls of the form /rest/hooks/KEY | ||||||||||
NavBuilder.RestHooks | The builder of urls of the form /rest/hooks | ||||||||||
NavBuilder.RestUser | The builder for /rest/users/slug | ||||||||||
NavBuilder.RestUsers | The builder for /rest/users | ||||||||||
NavBuilder.RevisionBrowse | The builder for urls of the form /projects/PROJ/repos/REPO/browse/...?at=REVISION | ||||||||||
NavBuilder.Tmp | Group builder for endpoints under /tmp, which are intended to provide access to temporary data stored by the system to facilitate user actions. | ||||||||||
NavBuilder.UpgradeOnboarding | Builds a URL to the UpgradeOnboarding page with an option of adding "next" as a query parameter with the current request url or the passed in url | ||||||||||
NavBuilder.UserAccount | The builder for /account | ||||||||||
NavBuilder.Users | |||||||||||
NavBuilder.ViewGroup | The builder for /group/view | ||||||||||
NavBuilder.ViewUser | The builder for /users/view |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | BASE_URL_KEY | A key which is wrapped in TOKEN_PREFIX and TOKEN_SUFFIX to produce a base URL token. |
|||||||||
String | BASE_URL_TOKEN | The fully-computed base URL token, comprised of TOKEN_PREFIX , BASE_URL_KEY and
TOKEN_SUFFIX . |
|||||||||
String | TOKEN_PREFIX | A prefix which is applied to the beginning of tokens which are emitted in built URLs. | |||||||||
String | TOKEN_SUFFIX | A suffix which is appended to the ending of tokens which are emitted in built URLs. | |||||||||
String | USE_BASE_URL_TOKEN | The query parameter on the request which indicates the base URL on emitted URLs should be replaced with
BASE_URL_TOKEN instead. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
/projects
| |||||||||||
/repos
| |||||||||||
This method respects the
USE_BASE_URL_TOKEN parameter if present on the context request. | |||||||||||
This method does not respect the
USE_BASE_URL_TOKEN parameter. | |||||||||||
This method is equivalent to
buildAbsolute() , but ignores any context HTTP request and always uses the
server's configured base URL for
generating the scheme, host, port etc and webapp context components of the URL. | |||||||||||
/captcha
| |||||||||||
/getting-started
| |||||||||||
/login
| |||||||||||
/login
| |||||||||||
/passwordreset
| |||||||||||
/profile
| |||||||||||
/projects/PROJ
| |||||||||||
/projects/PROJ
| |||||||||||
/projects/PROJ/repos/REPO
| |||||||||||
/retrievePassword
| |||||||||||
/j_atl_security_check
| |||||||||||
/setup
| |||||||||||
/signup
| |||||||||||
/tmp
Retrieve a builder for constructing URLs related to temporary data. | |||||||||||
/upgrade-onboarding
| |||||||||||
/users/SLUG or /bots/SLUG
| |||||||||||
/users/SLUG or /bots/SLUG
| |||||||||||
/mvc/xsrfNotification (as this is generated by a forward it doesn't go through the rewrite filter, and so needs the /mvc
explicitly)
|
A key which is wrapped in TOKEN_PREFIX
and TOKEN_SUFFIX
to produce a base URL token.
The key used needs to contain (preferably end with) something which is escaped when URL-encoded. Doing so causes the end token to be different depending on whether the base URL has been encoded and allows callers to encode the value they replace it with. That, in turn, ensures the resulting full URL has correct encoding from beginning to end.
Over and above containing something which requires encoding, the value needs to encode reliably. That means if the token has been encoded 4 times, any caller performing the substitution should be able to detect that count, because they will need to encode the replacement value 4 times over as well.
The current choice is a single trailing %. On first encoding, this produces "%25"; second produces "%2525", third produces "%252525", etc. This allows for two use cases:
TOKEN_SUFFIX
TOKEN_PREFIX
+ this key to find the first
25, if any are present, and the location of the first TOKEN_SUFFIX
to find the end. Use the number
of 25s present to determine the depthThe fully-computed base URL token, comprised of TOKEN_PREFIX
, BASE_URL_KEY
and
TOKEN_SUFFIX
.
A prefix which is applied to the beginning of tokens which are emitted in built URLs.
A suffix which is appended to the ending of tokens which are emitted in built URLs.
The query parameter on the request which indicates the base URL on emitted URLs should be replaced with
BASE_URL_TOKEN
instead. Using this token allows callers to format in their own base URL for
producing links which are correct based on their context.
For example, to better explain the need for this, consider the following:
buildAbsolute()
uses the HTTP
request (which is the default behaviour), links are emitted pointing to http://stash.private.example.com.
From an end user's browser, however, such links will not work/projects
/repos
This method respects the USE_BASE_URL_TOKEN
parameter if present on the context request. Use
buildBaseUrl()
if you with to avoid this behaviour. Note: if the USE_BASE_URL_TOKEN
is present
this method may return a String
that is not a syntactically valid URI. The base URL (the scheme, host,
port etc and webapp context) will be taken from the context HTTP request, if one is present, or otherwise fall
back to the configured base URL
for
the server.
This method does not respect the USE_BASE_URL_TOKEN
parameter. Unless you have a specific need to avoid
the token substitution behaviour for this particular URL, you should use buildAbsolute()
.
This method is equivalent to buildAbsolute()
, but ignores any context HTTP request and always uses the
server's configured base URL
for
generating the scheme, host, port etc and webapp context components of the URL.
configured
for this server
/getting-started
/passwordreset
/profile
/projects/PROJ
/projects/PROJ
/projects/PROJ/repos/REPO
/retrievePassword
/j_atl_security_check
/tmp
Retrieve a builder for constructing URLs related to temporary data.
/upgrade-onboarding
/users/SLUG or /bots/SLUG
/users/SLUG or /bots/SLUG
/mvc/xsrfNotification (as this is generated by a forward it doesn't go through the rewrite filter, and so needs the /mvc explicitly)