protected UriComponents expandAndEncode(UriComponentsBuilder builder, Map<String, ?> uriVariables) { if (!isStrictEncoding()) { return builder.buildAndExpand(uriVariables).encode(); } else { Map<String, ?> encodedUriVars = UriUtils.encodeUriVariables(uriVariables); return builder.buildAndExpand(encodedUriVars); } }
/** * Build a {@code UriComponents} instance and replaces URI template variables * with the values from an array. This is a shortcut method which combines * calls to {@link #build()} and then {@link UriComponents#expand(Object...)}. * @param uriVariableValues the URI variable values * @return the URI components with expanded values */ public UriComponents buildAndExpand(Object... uriVariableValues) { return build().expand(uriVariableValues); }
@Override public PrintWriter getWriter() throws IOException { if (this.writer == null) { String characterEncoding = getCharacterEncoding(); this.writer = (characterEncoding != null ? new ResponsePrintWriter(characterEncoding) : new ResponsePrintWriter(WebUtils.DEFAULT_CHARACTER_ENCODING)); } return this.writer; }
public ConnectionManagerSupport(String uriTemplate, Object... uriVariables) { this.uri = UriComponentsBuilder.fromUriString(uriTemplate).buildAndExpand( uriVariables).encode().toUri(); }
@Override public URI getURI() { return UriComponentsBuilder.fromUriString("/").build().toUri(); }
public String build() { return fromMethodInternal(this.baseUrl, this.controllerType, this.method, this.argumentValues) .build().encode().toUriString(); }
@Override public URI build(Object... uriVars) { if (ObjectUtils.isEmpty(uriVars) && !defaultUriVariables.isEmpty()) { return build(Collections.emptyMap()); } if (encodingMode.equals(EncodingMode.VALUES_ONLY)) { uriVars = UriUtils.encodeUriVariables(uriVars); } UriComponents uric = this.uriComponentsBuilder.build().expand(uriVars); return createUri(uric); }
public String buildAndExpand(Object... uriVars) { return fromMethodInternal(this.baseUrl, this.controllerType, this.method, this.argumentValues) .buildAndExpand(uriVars).encode().toString(); } }
@Override public URI build(Object... uriVariables) { return buildInternal(EncodingHint.ENCODE_TEMPLATE).expand(uriVariables).toUri(); }
@Override protected void copyToUriComponentsBuilder(UriComponentsBuilder builder) { if (getScheme() != null) { builder.scheme(getScheme()); } if (getSchemeSpecificPart() != null) { builder.schemeSpecificPart(getSchemeSpecificPart()); } if (getFragment() != null) { builder.fragment(getFragment()); } }
/** * Append the given path to the existing path of this builder. * The given path may contain URI template variables. * @param path the URI path * @return this UriComponentsBuilder */ @Override public UriComponentsBuilder path(String path) { this.pathBuilder.addPath(path); resetSchemeSpecificPart(); return this; }
/** * Append path segments to the existing path. Each path segment may contain * URI template variables and should not contain any slashes. * Use {@code path("/")} subsequently to ensure a trailing slash. * @param pathSegments the URI path segments * @return this UriComponentsBuilder */ @Override public UriComponentsBuilder pathSegment(String... pathSegments) throws IllegalArgumentException { this.pathBuilder.addPathSegments(pathSegments); resetSchemeSpecificPart(); return this; }
@Test public void testAssertHasAncestorOfTypeDoesNotThrowExceptionOnPass() throws Exception { Tag a = new TagA(); Tag b = new TagB(); Tag c = new TagC(); a.setParent(b); b.setParent(c); TagUtils.assertHasAncestorOfType(a, TagC.class, "a", "c"); }
public MockClientHttpRequest(HttpMethod httpMethod, String urlTemplate, Object... vars) { this(httpMethod, UriComponentsBuilder.fromUriString(urlTemplate).buildAndExpand(vars).encode().toUri()); }
/** * Build a {@code UriComponents} instance and replaces URI template variables * with the values from a map. This is a shortcut method which combines * calls to {@link #build()} and then {@link UriComponents#expand(Map)}. * @param uriVariables the map of URI variables * @return the URI components with expanded values */ public UriComponents buildAndExpand(Map<String, ?> uriVariables) { return build().expand(uriVariables); }
@Override public URI build(Map<String, ?> uriVariables) { return buildInternal(EncodingHint.ENCODE_TEMPLATE).expand(uriVariables).toUri(); }
protected UriComponents expandAndEncode(UriComponentsBuilder builder, Object[] uriVariables) { if (!isStrictEncoding()) { return builder.buildAndExpand(uriVariables).encode(); } else { Object[] encodedUriVars = UriUtils.encodeUriVariables(uriVariables); return builder.buildAndExpand(encodedUriVars); } }