Java Code Examples for org.springframework.http.RequestEntity.BodyBuilder#header()

The following examples show how to use org.springframework.http.RequestEntity.BodyBuilder#header() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ApiClient.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
/**
 * Add headers to the request that is being built
 * @param headers The headers to add
 * @param requestBuilder The current request
 */
protected void addHeadersToRequest(HttpHeaders headers, BodyBuilder requestBuilder) {
    for (Entry<String, List<String>> entry : headers.entrySet()) {
        List<String> values = entry.getValue();
        for(String value : values) {
            if (value != null) {
                requestBuilder.header(entry.getKey(), value);
            }
        }
    }
}
 
Example 2
Source File: ApiClient.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
/**
 * Add headers to the request that is being built
 * @param headers The headers to add
 * @param requestBuilder The current request
 */
protected void addHeadersToRequest(HttpHeaders headers, BodyBuilder requestBuilder) {
    for (Entry<String, List<String>> entry : headers.entrySet()) {
        List<String> values = entry.getValue();
        for(String value : values) {
            if (value != null) {
                requestBuilder.header(entry.getKey(), value);
            }
        }
    }
}
 
Example 3
Source File: ProxyExchange.java    From spring-cloud-gateway with Apache License 2.0 5 votes vote down vote up
private BodyBuilder headers(BodyBuilder builder) {
	Set<String> sensitive = this.sensitive;
	if (sensitive == null) {
		sensitive = DEFAULT_SENSITIVE;
	}
	proxy();
	for (String name : headers.keySet()) {
		if (sensitive.contains(name.toLowerCase())) {
			continue;
		}
		builder.header(name, headers.get(name).toArray(new String[0]));
	}
	return builder;
}
 
Example 4
Source File: ProxyExchange.java    From spring-cloud-gateway with Apache License 2.0 5 votes vote down vote up
private BodyBuilder headers(BodyBuilder builder) {
	proxy();
	for (String name : filterHeaderKeys(headers)) {
		builder.header(name, headers.get(name).toArray(new String[0]));
	}
	return builder;
}
 
Example 5
Source File: ApiClient.java    From tutorials with MIT License 5 votes vote down vote up
/**
 * Add headers to the request that is being built
 * @param headers The headers to add
 * @param requestBuilder The current request
 */
protected void addHeadersToRequest(HttpHeaders headers, BodyBuilder requestBuilder) {
    for (Entry<String, List<String>> entry : headers.entrySet()) {
        List<String> values = entry.getValue();
        for(String value : values) {
            if (value != null) {
                requestBuilder.header(entry.getKey(), value);
            }
        }
    }
}
 
Example 6
Source File: ApiClient.java    From tutorials with MIT License 5 votes vote down vote up
/**
 * Add headers to the request that is being built
 * @param headers The headers to add
 * @param requestBuilder The current request
 */
protected void addHeadersToRequest(HttpHeaders headers, BodyBuilder requestBuilder) {
    for (Entry<String, List<String>> entry : headers.entrySet()) {
        List<String> values = entry.getValue();
        for(String value : values) {
            if (value != null) {
                requestBuilder.header(entry.getKey(), value);
            }
        }
    }
}
 
Example 7
Source File: ApiClient.java    From openapi-generator with Apache License 2.0 4 votes vote down vote up
/**
 * Add cookies to the request that is being built
 * @param cookies The cookies to add
 * @param requestBuilder The current request
 */
protected void addCookiesToRequest(MultiValueMap<String, String> cookies, BodyBuilder requestBuilder) {
    if (!cookies.isEmpty()) {
        requestBuilder.header("Cookie", buildCookieHeader(cookies));
    }
}
 
Example 8
Source File: ApiClient.java    From openapi-generator with Apache License 2.0 4 votes vote down vote up
/**
 * Add cookies to the request that is being built
 * @param cookies The cookies to add
 * @param requestBuilder The current request
 */
protected void addCookiesToRequest(MultiValueMap<String, String> cookies, BodyBuilder requestBuilder) {
    if (!cookies.isEmpty()) {
        requestBuilder.header("Cookie", buildCookieHeader(cookies));
    }
}
 
Example 9
Source File: ApiClient.java    From tutorials with MIT License 4 votes vote down vote up
/**
 * Add cookies to the request that is being built
 * @param cookies The cookies to add
 * @param requestBuilder The current request
 */
protected void addCookiesToRequest(MultiValueMap<String, String> cookies, BodyBuilder requestBuilder) {
    if (!cookies.isEmpty()) {
        requestBuilder.header("Cookie", buildCookieHeader(cookies));
    }
}