Interface NavBuilder
- nb.allProjects().startAt(0).withLimit(25).buildAbsolute() => http://localhost:7990/bitbucket/projects?start=0&limit=25
- nb.project("EX").repo("example").settings().buildRelative() => /stash/projects/EX/repos/example/settings
- nb.project("EX").repo("example").browse().resource("foo/bar/baz.xml").buildNoContext() => /projects/EX/repos/example/browse/foo/bar/baz.xml
- nb.project("EX").repo("example").browse().resource("foo/bar/baz.xml").onBranch("stash1.0").buildNoContext() => /projects/EX/repos/example/browse/foo/bar/baz.xml?branchName=stash1.0
- nb.project("EX").repo("example").pullRequest("7636").buildNoContext() => /projects/EX/repos/example/pull-request/7636
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic interfacestatic interfacestatic interfaceThe builder for /adminstatic interfaceThe builder of urls of the form /projects/PROJ/repos/REPO/browse[/...]static interfaceNavBuilder.Builder<B extends NavBuilder.Builder<B>>Base interface for all terminal builders (builders which can produce a url)static interfaceBuilds URLs of the form /projects/PROJ/repos/REPO/commits/IDstatic interfaceBuilds URLs of the form /projects/PROJ/repos/REPO/commits/ID/comment/IDstatic interfaceThe builder of urls of the form /projects/PROJ/repos/REPO/comparestatic interfaceNavBuilder.CompareBuilder<T extends NavBuilder.CompareBuilder<T>>static interfaceThe builder of urls of the form /projects/PROJ?createstatic interfaceThe builder for urls of the form /projects/PROJ/repos/REPO/pull-requests?create...static interfaceThe builder of urls of the form /projects/PROJ/repos?createstatic interfacestatic interfacestatic interfacestatic interfaceThe builder for /users/deletestatic interfaceBuilds 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 urlstatic interfacestatic interfaceThe builder for /reposstatic interfacestatic interfaceThe builder for the JSW Admin page.static interfaceA builder for URLs at/under/admin/keys-and-tokens.static interfacestatic interfaceThe builder of urls of the form /projects/PROJ/repos/REPO/branchesstatic interfaceThe builder of urls of the form /projects/PROJ/repos/REPO/commitsstatic interfaceThe builder of urls of the form /projects/PROJ/repos/REPO/forksstatic interfaceThe builder for /projectsstatic interfacestatic interfaceThe builder for /projects/PROJ/repos/REPO/browse - essentially the same asNavBuilder.Projectbut with support for start and limit params o control the repository liststatic interfaceThe builder of urls of the form /projects/PROJ/repos/REPO/tags[/...]static interfaceBuilds a login URL for the with an option of adding "next" as a query parameter with the current request url or the passed in urlstatic interfaceA builder for URLs at/under/admin/git/mesh.static interfaceNavBuilder.NavigationStep<B extends NavBuilder.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 urlstatic interfaceNavBuilder.PagedBuilder<B extends NavBuilder.PagedBuilder<B>>A builder for urls that represent a collection of things, one page at a time.static interfaceNavBuilder.PathBuilder<B extends NavBuilder.PathBuilder<B>>The builder of urls that have a path to a file resourcestatic interfaceThe builder for the plugin servletsstatic interfacestatic interfaceThe builder for urls hanging off /projects/PROJ.static interfaceThe builder of urls of the form /projects/PROJ/settings/auto-declinestatic interfaceThe builder of urls of the form /projects/PROJ/settings/auto-mergestatic interfaceThe builder of urls of the form /projects/PROJ/settings/default-tasksstatic interfaceThe builder of urls of the form /projects/PROJ/deletestatic interfaceThe builder of urls of the form /projects/PROJ/settings/hooksstatic interfaceThe builder of urls of the form /projects/PROJ/settings/merge-checksstatic interfaceThe builder of urls of the form /projects/PROJ/settings/merge-strategies/<scmId>static interfaceThe builder of urls of the form /projects/PROJ/permissionsstatic interfaceThe builder of urls of the form /projects/PROJ/settings/pull-request-templatesstatic interfaceThe builder of urls of the form /projects/PROJ/settings/reviewer-groupsstatic interfaceThe builder of urls for the form /project/PROJ/settings/secret-scanningstatic interfaceThe builder of urls of the form /projects/PROJ/settingsstatic interfaceThe builder for urls of the form /projects/PROJ/repos/REPO/pull-requests/ID/...static interfaceBuilds URLs of the form /projects/PROJ/repos/REPO/pull-requests/ID/activitiesstatic interfaceBuilds URLs of the form /projects/PROJ/repos/REPO/pull-requests/ID/buildsstatic interfaceBuilds URLs of the form /projects/PROJ/repos/REPO/pull-requests/ID/overview?commentId=IDstatic interfaceBuilds URLs of the form /projects/PROJ/repos/REPO/pull-requests/ID/commits/IDstatic interfaceBuilds URLs of the form /projects/PROJ/repos/REPO/pull-requests/ID/overviewstatic interfaceThe builder of urls of the form /projects/PROJ/repos/REPO/settings/pull-requestsstatic interfaceThe builder of urls hanging off /projects/PROJ/repos/REPO.static interfaceBuilds URLs of the form /rest/api/1.0/projects/PROJ/repos/REPO/archivestatic interfaceThe builder for URLs of the form /projects/PROJ/repos/REPO/attachmentsstatic interfaceThe builder for the URLs of the form /projects/PROJ/repos/REPO/attachments/ID/metadatastatic interfaceThe builder of urls of the form /projects/PROJ/repos/REPO/settings/auto-declinestatic interfaceThe builder of urls of the form /projects/PROJ/repos/REPO/settings/auto-mergestatic interfaceThe builder for urls of the form /projects/PROJ/repos/REPO/buildsstatic interfaceThe builder of urls of the form /projects/PROJ/repos/REPO/settings/default-tasksstatic interfaceThe builder of urls of the form /projects/PROJ/repos/REPO/deletestatic interfaceThe builder for urls of the form /projects/PROJ/repos/REPO?forkstatic interfaceThe builder of urls of the form /projects/PROJ/repos/REPO/hooksstatic interfaceThe builder of urls of the form /projects/PROJ/repos/REPO/merge-checksstatic interfaceThe builder of urls of the form /projects/PROJ/repos/REPO/settings/merge-strategiesstatic interfacestatic interfaceThe builder of urls of the form /projects/PROJ/repos/REPO/settings/pull-request-templatesstatic interfaceThe builder for urls of the form /projects/PROJ/repos/REPO/push-logstatic interfaceThe builder of urls of the form /projects/PROJ/repos/REPO/settings/required-buildsstatic interfaceThe builder of urls of the form /projects/PROJ/repos/REPO/settings/reviewer-groupsstatic interfaceThe builder of urls for the form /project/PROJ/repos/REPO/settings/secret-scanningstatic interfaceThe builder of urls of the form /projects/PROJ/repos/REPO/settingsstatic interfaceThe builder for the REST APIstatic interfaceThe builder for the REST admin APIstatic interfaceThe builder of urls of the form /rest/hooks/KEYstatic interfaceThe builder of urls of the form /rest/hooksstatic interfaceThe builder for /rest/users/slugstatic interfaceThe builder for /rest/usersstatic interfaceThe builder for urls of the form /projects/PROJ/repos/REPO/browse/...?at=REVISIONstatic interfaceThe builder for urls of the form /projects/PROJ/repos/REPO/builds?at=REVISIONstatic interfaceGroup builder for endpoints under /tmp, which are intended to provide access to temporary data stored by the system to facilitate user actions.static interfaceThe builder for /accountstatic interfacestatic interfaceThe builder for /group/viewstatic interfaceThe builder for /users/view -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringA key which is wrapped inTOKEN_PREFIXandTOKEN_SUFFIXto produce a base URL token.static final Stringstatic final StringA prefix which is applied to the beginning of tokens which are emitted in built URLs.static final StringA suffix which is appended to the ending of tokens which are emitted in built URLs.static final StringThe query parameter on the request which indicates the base URL on emitted URLs should be replaced withBASE_URL_TOKENinstead. -
Method Summary
Modifier and TypeMethodDescriptionabout()account()addons()admin()/projectsallRepos()/reposThis method respects theUSE_BASE_URL_TOKENparameter if present on the context request.This method does not respect theUSE_BASE_URL_TOKENparameter.This method is equivalent tobuildAbsolute(), but ignores any context HTTP request and always uses the server'sconfigured base URLfor generating the scheme, host, port etc and webapp context components of the URL.captcha()/captcha/getting-startedlogin()/loginlogout()/login/passwordresetprofile()/profile/projects/PROJ/projects/PROJrepo(Repository repository) /projects/PROJ/repos/REPOrest()/retrievePassword/j_atl_security_checksetup()/setupsignup()/signuptmp()/tmpuser(ApplicationUser user) /users/SLUG or /bots/SLUGuserBySlug(String userSlug, UserType type) /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)
-
Field Details
-
BASE_URL_KEY
A key which is wrapped inTOKEN_PREFIXandTOKEN_SUFFIXto 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:
- I don't care about encoding: Use a regular expression which ignores any number of 25s after the
trailing % and before the closing
TOKEN_SUFFIX - I want to encode by depth: Use the index of
TOKEN_PREFIX+ this key to find the first 25, if any are present, and the location of the firstTOKEN_SUFFIXto find the end. Use the number of 25s present to determine the depth
- See Also:
- I don't care about encoding: Use a regular expression which ignores any number of 25s after the
trailing % and before the closing
-
TOKEN_PREFIX
A prefix which is applied to the beginning of tokens which are emitted in built URLs.- See Also:
-
TOKEN_SUFFIX
A suffix which is appended to the ending of tokens which are emitted in built URLs.- See Also:
-
BASE_URL_TOKEN
- See Also:
-
USE_BASE_URL_TOKEN
The query parameter on the request which indicates the base URL on emitted URLs should be replaced withBASE_URL_TOKENinstead. 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:
- A Jira instance is running with a public address of http://jira.example.com
- A Stash instance is running with a public address of http://stash.example.com
- These two machines, in addition to having public-facing URLs, have a private backplane network which connects them as jira.private.example.com and stash.private.example.com
- The application link from Jira to Stash has an RPC URL of http://stash.private.example.com, so that RPC uses the fast backplane network, and a display URL of http://stash.example.com so that end users get valid links
- When requests come into Stash, if the base URL calculated by
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 - Rather than trying to manually munge the URLs in the client, which is problematic and brittle, the caller can add this parameter to their request and a token suitable for replacement will be emitted in the URLs instead of a fixed base URL
- See Also:
-
-
Method Details
-
buildAbsolute
String buildAbsolute()This method respects theUSE_BASE_URL_TOKENparameter if present on the context request. UsebuildBaseUrl()if you with to avoid this behaviour. Note: if theUSE_BASE_URL_TOKENis present this method may return aStringthat 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 theconfigured base URLfor the server.- Returns:
- the absolute base url (e.g. http://hostname:7990/context), with no trailing slash
- See Also:
-
buildConfigured
String buildConfigured()This method is equivalent tobuildAbsolute(), but ignores any context HTTP request and always uses the server'sconfigured base URLfor generating the scheme, host, port etc and webapp context components of the URL.- Returns:
- the absolute base url
configuredfor this server
-
buildBaseUrl
String buildBaseUrl()This method does not respect theUSE_BASE_URL_TOKENparameter. Unless you have a specific need to avoid the token substitution behaviour for this particular URL, you should usebuildAbsolute().- Returns:
- the absolute base url (e.g. http://hostname:7990/context), with no trailing slash
- See Also:
-
buildRelative
String buildRelative()- Returns:
- the relative base url (e.g. /context), with no trailing slash
- See Also:
-
admin
NavBuilder.Admin admin() -
about
NavBuilder.Builder<?> about() -
pluginServlets
NavBuilder.PluginServlets pluginServlets() -
rest
NavBuilder.Rest rest() -
tmp
NavBuilder.Tmp tmp()/tmpRetrieve a builder for constructing URLs related to temporary data.
- Returns:
- a builder for temporary data URLs
-
addons
NavBuilder.Addons addons()- Returns:
- a builder for UPM created URLs
-
project
/projects/PROJ- Parameters:
key- project key- Returns:
- a builder for urls of the named project
-
project
/projects/PROJ- Parameters:
project- the project- Returns:
- a builder for urls of the named project
-
repo
/projects/PROJ/repos/REPO- Parameters:
repository- the repository- Returns:
- a builder for urls of the named repository
-
login
NavBuilder.Login login()/login- Returns:
- a Login builder for the url to the login page
-
logout
NavBuilder.Builder<?> logout()/login- Returns:
- a builder for the url to the logout page
-
signup
NavBuilder.Builder<?> signup()/signup- Returns:
- a builder for the url to the signup page
-
captcha
NavBuilder.Builder<?> captcha()/captcha- Returns:
- a builder for the url to the captcha image
-
retrievePassword
NavBuilder.Builder<?> retrievePassword()/retrievePassword- Returns:
- a builder for the url to the page to retrieve your password
-
passwordReset
NavBuilder.Builder<?> passwordReset()/passwordreset- Returns:
- a builder for the url to the page to reset your password
-
profile
NavBuilder.Profile profile()/profile- Returns:
- a builder for the url to the profile page of the current user
-
user
/users/SLUG or /bots/SLUG- Parameters:
user- the user- Returns:
- a builder for the url to the profile page of the supplied user
-
userBySlug
/users/SLUG or /bots/SLUG- Parameters:
userSlug- the user slugtype- the user type- Returns:
- a builder for the url to the profile page of the supplied user's slug
-
securityCheck
NavBuilder.Builder<?> securityCheck()/j_atl_security_check- Returns:
- a builder for the url used to check authentication credentials when logging in
-
xsrfNotification
NavBuilder.Builder<?> xsrfNotification()/mvc/xsrfNotification (as this is generated by a forward it doesn't go through the rewrite filter, and so needs the /mvc explicitly)- Returns:
- a builder for the url to use when an invalid xsrf token is detected.
-
setup
NavBuilder.Builder<?> setup()/setup- Returns:
- a builder for the first run wizard
-
allProjects
NavBuilder.ListProjects allProjects()/projects- Returns:
- a builder for the url to list all projects
-
allRepos
NavBuilder.GlobalListRepos allRepos()/repos- Returns:
- a builder for the url to list all repositories
-
createProject
NavBuilder.CreateProject createProject()- Returns:
- a builder for urls of the form /projects?create
-
account
NavBuilder.UserAccount account()- Returns:
- a builder for urls of the form /account[/*]
-
gettingStarted
NavBuilder.GettingStarted gettingStarted()/getting-started- Returns:
- a builder for urls to the Getting Started '/getting-started' page
-
dashboard
NavBuilder.Dashboard dashboard()
-