Java Code Examples for org.springframework.http.HttpHeaders#EMPTY

The following examples show how to use org.springframework.http.HttpHeaders#EMPTY . 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: WebClientResponseException.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Constructor with a prepared message.
 * @since 5.1.4
 */
public WebClientResponseException(String message, int statusCode, String statusText,
		@Nullable HttpHeaders headers, @Nullable byte[] responseBody, @Nullable Charset charset,
		@Nullable HttpRequest request) {

	super(message);

	this.statusCode = statusCode;
	this.statusText = statusText;
	this.headers = (headers != null ? headers : HttpHeaders.EMPTY);
	this.responseBody = (responseBody != null ? responseBody : new byte[0]);
	this.responseCharset = (charset != null ? charset : StandardCharsets.ISO_8859_1);
	this.request = request;
}
 
Example 2
Source File: CloudFoundryHttpHeaderProvider.java    From Moss with Apache License 2.0 5 votes vote down vote up
@Override
public HttpHeaders getHeaders(Instance instance) {
    String applicationId = instance.getRegistration().getMetadata().get("applicationId");
    String instanceId = instance.getRegistration().getMetadata().get("instanceId");

    if (StringUtils.hasText(applicationId) && StringUtils.hasText(instanceId)) {
        HttpHeaders headers = new HttpHeaders();
        headers.set("X-CF-APP-INSTANCE", applicationId + ":" + instanceId);
        return headers;
    }

    return HttpHeaders.EMPTY;
}
 
Example 3
Source File: WebClientResponseException.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Constructor with a prepared message.
 * @since 5.1.4
 */
public WebClientResponseException(String message, int statusCode, String statusText,
		@Nullable HttpHeaders headers, @Nullable byte[] responseBody, @Nullable Charset charset,
		@Nullable HttpRequest request) {

	super(message);

	this.statusCode = statusCode;
	this.statusText = statusText;
	this.headers = (headers != null ? headers : HttpHeaders.EMPTY);
	this.responseBody = (responseBody != null ? responseBody : new byte[0]);
	this.responseCharset = (charset != null ? charset : StandardCharsets.ISO_8859_1);
	this.request = request;
}
 
Example 4
Source File: XmlNamespaceIgnoringHttpMessageConverterTest.java    From multiapps-controller with Apache License 2.0 5 votes vote down vote up
private HttpInputMessage createHttpInputMessage(String resource) {
    return new HttpInputMessage() {

        @Override
        public HttpHeaders getHeaders() {
            return HttpHeaders.EMPTY;
        }

        @Override
        public InputStream getBody() {
            return getClass().getResourceAsStream(resource);
        }

    };
}
 
Example 5
Source File: CloudFoundryHttpHeaderProvider.java    From spring-boot-admin with Apache License 2.0 5 votes vote down vote up
@Override
public HttpHeaders getHeaders(Instance instance) {
	String applicationId = instance.getRegistration().getMetadata().get("applicationId");
	String instanceId = instance.getRegistration().getMetadata().get("instanceId");

	if (StringUtils.hasText(applicationId) && StringUtils.hasText(instanceId)) {
		HttpHeaders headers = new HttpHeaders();
		headers.set("X-CF-APP-INSTANCE", applicationId + ":" + instanceId);
		return headers;
	}

	return HttpHeaders.EMPTY;
}