Package org.keycloak.common.util
Class KeycloakUriBuilder
java.lang.Object
org.keycloak.common.util.KeycloakUriBuilder
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbuildAsString(Object... values) buildFromEncodedMap(Map<String, ?> values) buildFromMap(Map<String, ?> values) buildFromMap(Map<String, ?> values, boolean encodeSlashInPath) protected URIbuildFromValues(boolean encodeSlash, boolean encoded, Object... values) protected StringbuildFromValuesAsString(boolean encodeSlash, boolean encoded, Object... values) protected URIbuildUriFromMap(Map<String, ?> paramMap, boolean fromEncodedMap, boolean encodeSlash) clone()static booleanstatic MatchercreateUriParamMatcher(String string) encodedFragment(String fragment) Set fragment, but not encode it.static KeycloakUriBuilderstatic KeycloakUriBuilderfromTemplate(String uriTemplate) You may put path parameters anywhere within the uriTemplate except portstatic KeycloakUriBuilderstatic KeycloakUriBuilderstatic KeycloakUriBuildergetHost()getPath()Return a unique order list of path paramsintgetPort()getQuery()matrixParam(String name, Object... values) protected KeycloakUriBuilderparseHierarchicalUri(String uri, Matcher match, boolean template) protected static Stringport(int port) When this is called, then the port will be preserved in the build URL even if it is default port for the protocol (http, https) For example: - KeycloakUriBuilder.fromUri("https://localhost:443/path").buildAsString() will return "https://localhost/path" (port not preserved) - KeycloakUriBuilder.fromUri("https://localhost:443/path").preserveDefaultPort().buildAsString() will return "https://localhost:443/path" (port is preserved even if default port) - KeycloakUriBuilder.fromUri("https://localhost/path").preserveDefaultPort().buildAsString() will return "https://localhost/path" (port not included even if "preserveDefaultPort" as it was not in the original URL)queryParam(String name, Object... values) static URIrelativize(URI from, URI to) replaceMatrix(String matrix) protected StringBufferreplaceParameter(Map<String, ?> paramMap, boolean fromEncodedMap, boolean isTemplate, String string, StringBuffer buffer, boolean encodeSlash) replacePath(String path) replacePath(String path, boolean template) protected StringBufferreplacePathParameter(String name, String value, boolean isEncoded, String string, StringBuffer buffer, boolean encodeSlash) replaceQuery(String query) replaceQuery(String query, boolean template) replaceQueryParam(String name, Object... values) protected StringBufferreplaceQueryStringParameter(Map<String, ?> paramMap, boolean fromEncodedMap, boolean isTemplate, String string, StringBuffer buffer) resolveTemplate(String name, Object value) resolveTemplate(String name, Object value, boolean encodeSlashInPath) resolveTemplates(Map<String, Object> templateValues) resolveTemplates(Map<String, Object> templateValues, boolean encodeSlashInPath) resolveTemplatesFromEncoded(Map<String, Object> templateValues) schemeSpecificPart(String ssp) substitutePathParam(String name, Object value, boolean isEncoded) Only replace path params in path of URI.uriTemplate(String uriTemplate) You may put path parameters anywhere within the uriTemplate except port
- 
Constructor Details- 
KeycloakUriBuilderpublic KeycloakUriBuilder()
 
- 
- 
Method Details- 
fromUri
- 
fromUri
- 
fromUri
- 
fromPath- Throws:
- IllegalArgumentException
 
- 
clone
- 
compare
- 
relativize
- 
fromTemplateYou may put path parameters anywhere within the uriTemplate except port- Parameters:
- uriTemplate-
- Returns:
 
- 
uriTemplateYou may put path parameters anywhere within the uriTemplate except port- Parameters:
- uriTemplate-
- Returns:
 
- 
parseHierarchicalUri
- 
uri- Throws:
- IllegalArgumentException
 
- 
uri- Throws:
- IllegalArgumentException
 
- 
uri- Throws:
- IllegalArgumentException
 
- 
scheme- Throws:
- IllegalArgumentException
 
- 
schemeSpecificPart- Throws:
- IllegalArgumentException
 
- 
userInfo
- 
host- Throws:
- IllegalArgumentException
 
- 
port- Throws:
- IllegalArgumentException
 
- 
preserveDefaultPortWhen this is called, then the port will be preserved in the build URL even if it is default port for the protocol (http, https) For example: - KeycloakUriBuilder.fromUri("https://localhost:443/path").buildAsString() will return "https://localhost/path" (port not preserved) - KeycloakUriBuilder.fromUri("https://localhost:443/path").preserveDefaultPort().buildAsString() will return "https://localhost:443/path" (port is preserved even if default port) - KeycloakUriBuilder.fromUri("https://localhost/path").preserveDefaultPort().buildAsString() will return "https://localhost/path" (port not included even if "preserveDefaultPort" as it was not in the original URL)
- 
paths
- 
path- Throws:
- IllegalArgumentException
 
- 
replaceMatrix- Throws:
- IllegalArgumentException
 
- 
replaceQuery- Throws:
- IllegalArgumentException
 
- 
replaceQuerypublic KeycloakUriBuilder replaceQuery(String query, boolean template) throws IllegalArgumentException - Throws:
- IllegalArgumentException
 
- 
fragment- Throws:
- IllegalArgumentException
 
- 
fragmentpublic KeycloakUriBuilder fragment(String fragment, boolean template) throws IllegalArgumentException - Throws:
- IllegalArgumentException
 
- 
encodedFragmentSet fragment, but not encode it. It assumes that given fragment was already properly encoded- Parameters:
- fragment-
- Returns:
 
- 
substitutePathParamOnly replace path params in path of URI. This changes state of URIBuilder.- Parameters:
- name-
- value-
- isEncoded-
- Returns:
 
- 
buildFromMap- Throws:
- IllegalArgumentException
 
- 
buildFromEncodedMap- Throws:
- IllegalArgumentException
 
- 
buildFromMappublic URI buildFromMap(Map<String, ?> values, boolean encodeSlashInPath) throws IllegalArgumentException- Throws:
- IllegalArgumentException
 
- 
buildUriFromMapprotected URI buildUriFromMap(Map<String, ?> paramMap, boolean fromEncodedMap, boolean encodeSlash) throws IllegalArgumentException- Throws:
- IllegalArgumentException
 
- 
replacePathParameterprotected StringBuffer replacePathParameter(String name, String value, boolean isEncoded, String string, StringBuffer buffer, boolean encodeSlash) 
- 
createUriParamMatcher
- 
replaceParameterprotected StringBuffer replaceParameter(Map<String, ?> paramMap, boolean fromEncodedMap, boolean isTemplate, String string, StringBuffer buffer, boolean encodeSlash) 
- 
replaceQueryStringParameterprotected StringBuffer replaceQueryStringParameter(Map<String, ?> paramMap, boolean fromEncodedMap, boolean isTemplate, String string, StringBuffer buffer) 
- 
getPathParamNamesInDeclarationOrderReturn a unique order list of path params- Returns:
 
- 
build- Throws:
- IllegalArgumentException
 
- 
buildAsString- Throws:
- IllegalArgumentException
 
- 
buildFromValues
- 
buildFromValuesAsString
- 
matrixParampublic KeycloakUriBuilder matrixParam(String name, Object... values) throws IllegalArgumentException - Throws:
- IllegalArgumentException
 
- 
queryParam- Throws:
- IllegalArgumentException
 
- 
replaceQueryParampublic KeycloakUriBuilder replaceQueryParam(String name, Object... values) throws IllegalArgumentException - Throws:
- IllegalArgumentException
 
- 
getHost
- 
getScheme
- 
getPortpublic int getPort()
- 
getUserInfo
- 
getPath
- 
getQuery
- 
getFragment
- 
segment- Throws:
- IllegalArgumentException
 
- 
replacePath
- 
replacePath
- 
build- Throws:
- IllegalArgumentException
 
- 
toTemplate
- 
resolveTemplatepublic KeycloakUriBuilder resolveTemplate(String name, Object value) throws IllegalArgumentException - Throws:
- IllegalArgumentException
 
- 
resolveTemplatespublic KeycloakUriBuilder resolveTemplates(Map<String, Object> templateValues) throws IllegalArgumentException- Throws:
- IllegalArgumentException
 
- 
resolveTemplatepublic KeycloakUriBuilder resolveTemplate(String name, Object value, boolean encodeSlashInPath) throws IllegalArgumentException - Throws:
- IllegalArgumentException
 
- 
resolveTemplatespublic KeycloakUriBuilder resolveTemplates(Map<String, Object> templateValues, boolean encodeSlashInPath) throws IllegalArgumentException- Throws:
- IllegalArgumentException
 
- 
resolveTemplatesFromEncodedpublic KeycloakUriBuilder resolveTemplatesFromEncoded(Map<String, Object> templateValues) throws IllegalArgumentException- Throws:
- IllegalArgumentException
 
 
-