@Override public MultiValueMap<String, String> queryParams() { return CollectionUtils.unmodifiableMultiValueMap(this.queryParams); }
@Override public MultiValueMap<String, ResponseCookie> getCookies() { return (this.state.get() == State.COMMITTED ? CollectionUtils.unmodifiableMultiValueMap(this.cookies) : this.cookies); }
private static <K, V> MultiValueMap<K, V> unmodifiableCopy(MultiValueMap<K, V> original) { return CollectionUtils.unmodifiableMultiValueMap(new LinkedMultiValueMap<>(original)); }
private static <K, V> MultiValueMap<K, V> unmodifiableCopy(MultiValueMap<K, V> map) { return CollectionUtils.unmodifiableMultiValueMap(new LinkedMultiValueMap<>(map)); }
public DefaultPathSegment(String value, String valueToMatch, MultiValueMap<String, String> params) { Assert.isTrue(!value.contains("/"), () -> "Invalid path segment value: " + value); this.value = value; this.valueToMatch = valueToMatch; this.valueToMatchAsChars = valueToMatch.toCharArray(); this.parameters = CollectionUtils.unmodifiableMultiValueMap(params); }
@Override public MultiValueMap<String, HttpCookie> getCookies() { if (State.COMMITTED.equals(this.state.get())) { return CollectionUtils.unmodifiableMultiValueMap(this.cookies); } return this.cookies; }
public BuiltClientHttpResponse(HttpStatus statusCode, HttpHeaders headers, MultiValueMap<String, ResponseCookie> cookies, Flux<DataBuffer> body) { this.statusCode = statusCode; this.headers = HttpHeaders.readOnlyHttpHeaders(headers); this.cookies = CollectionUtils.unmodifiableMultiValueMap(cookies); this.body = body; }
protected AbstractServerResponse( int statusCode, HttpHeaders headers, MultiValueMap<String, ResponseCookie> cookies) { this.statusCode = statusCode; this.headers = HttpHeaders.readOnlyHttpHeaders(headers); this.cookies = CollectionUtils.unmodifiableMultiValueMap(new LinkedMultiValueMap<>(cookies)); }
@Override public MultiValueMap<String, String> queryParams() { return CollectionUtils.unmodifiableMultiValueMap(this.queryParams); }
@Override public MultiValueMap<String, String> getQueryParams() { if (this.queryParams == null) { this.queryParams = CollectionUtils.unmodifiableMultiValueMap(initQueryParams()); } return this.queryParams; }
@Override public MultiValueMap<String, HttpCookie> getCookies() { if (this.cookies == null) { this.cookies = CollectionUtils.unmodifiableMultiValueMap(initCookies()); } return this.cookies; }
public void set(String key, String value, MultiValueMap<String,String> parameters) { if (this.extractedUriVariables == null) { this.extractedUriVariables = new HashMap<>(); } this.extractedUriVariables.put(key, value); if (!parameters.isEmpty()) { if (this.extractedMatrixVariables == null) { this.extractedMatrixVariables = new HashMap<>(); } this.extractedMatrixVariables.put(key, CollectionUtils.unmodifiableMultiValueMap(parameters)); } }
public BodyInserterRequest(HttpMethod method, URI url, HttpHeaders headers, MultiValueMap<String, String> cookies, BodyInserter<?, ? super ClientHttpRequest> body, Map<String, Object> attributes) { this.method = method; this.url = url; this.headers = HttpHeaders.readOnlyHttpHeaders(headers); this.cookies = CollectionUtils.unmodifiableMultiValueMap(cookies); this.body = body; this.attributes = Collections.unmodifiableMap(attributes); Object id = attributes.computeIfAbsent(LOG_ID_ATTRIBUTE, name -> ObjectUtils.getIdentityHexString(this)); this.logPrefix = "[" + id + "] "; }
private MultiValueMap<String, String> encodeQueryParams(BiFunction<String, Type, String> encoder) { int size = this.queryParams.size(); MultiValueMap<String, String> result = new LinkedMultiValueMap<>(size); this.queryParams.forEach((key, values) -> { String name = encoder.apply(key, Type.QUERY_PARAM); List<String> encodedValues = new ArrayList<>(values.size()); for (String value : values) { encodedValues.add(value != null ? encoder.apply(value, Type.QUERY_PARAM) : null); } result.put(name, encodedValues); }); return CollectionUtils.unmodifiableMultiValueMap(result); }
/** * Package-private constructor. All arguments are optional, and can be {@code null}. * @param scheme the scheme * @param userInfo the user info * @param host the host * @param port the port * @param path the path * @param query the query parameters * @param fragment the fragment * @param encoded whether the components are already encoded */ HierarchicalUriComponents(@Nullable String scheme, @Nullable String fragment, @Nullable String userInfo, @Nullable String host, @Nullable String port, @Nullable PathComponent path, @Nullable MultiValueMap<String, String> query, boolean encoded) { super(scheme, fragment); this.userInfo = userInfo; this.host = host; this.port = port; this.path = path != null ? path : NULL_PATH_COMPONENT; this.queryParams = query != null ? CollectionUtils.unmodifiableMultiValueMap(query) : EMPTY_QUERY_PARAMS; this.encodeState = encoded ? EncodeState.FULLY_ENCODED : EncodeState.RAW; // Check for illegal characters.. if (encoded) { verify(); } }
@Override public MultiValueMap<String, String> getQueryParams() { if (this.queryParams == null) { this.queryParams = CollectionUtils.unmodifiableMultiValueMap(initQueryParams()); } return this.queryParams; }
@Override public MultiValueMap<String, HttpCookie> getCookies() { if (State.COMMITTED.equals(this.state.get())) { return CollectionUtils.unmodifiableMultiValueMap(this.cookies); } return this.cookies; }
private MultiValueMap<String, String> expandQueryParams(UriTemplateVariables variables) { int size = this.queryParams.size(); MultiValueMap<String, String> result = new LinkedMultiValueMap<>(size); UriTemplateVariables queryVariables = new QueryUriTemplateVariables(variables); this.queryParams.forEach((key, values) -> { String name = expandUriComponent(key, queryVariables, this.variableEncoder); List<String> expandedValues = new ArrayList<>(values.size()); for (String value : values) { expandedValues.add(expandUriComponent(value, queryVariables, this.variableEncoder)); } result.put(name, expandedValues); }); return CollectionUtils.unmodifiableMultiValueMap(result); }
@Override public MultiValueMap<String, ResponseCookie> getCookies() { MultiValueMap<String, ResponseCookie> result = new LinkedMultiValueMap<>(); this.response.cookies().values().stream().flatMap(Collection::stream) .forEach(cookie -> result.add(cookie.name(), ResponseCookie.from(cookie.name(), cookie.value()) .domain(cookie.domain()) .path(cookie.path()) .maxAge(cookie.maxAge()) .secure(cookie.isSecure()) .httpOnly(cookie.isHttpOnly()) .build())); return CollectionUtils.unmodifiableMultiValueMap(result); }
@Override public MultiValueMap<String, ResponseCookie> getCookies() { MultiValueMap<String, ResponseCookie> result = new LinkedMultiValueMap<>(); List<String> cookieHeader = getHeaders().get(HttpHeaders.SET_COOKIE); if (cookieHeader != null) { cookieHeader.forEach(header -> { HttpCookie.parse(header) .forEach(cookie -> result.add(cookie.getName(), ResponseCookie.from(cookie.getName(), cookie.getValue()) .domain(cookie.getDomain()) .path(cookie.getPath()) .maxAge(cookie.getMaxAge()) .secure(cookie.getSecure()) .httpOnly(cookie.isHttpOnly()) .build())); }); } return CollectionUtils.unmodifiableMultiValueMap(result); }