Example usage for org.springframework.http HttpHeaders readOnlyHttpHeaders

List of usage examples for org.springframework.http HttpHeaders readOnlyHttpHeaders

Introduction

In this page you can find the example usage for org.springframework.http HttpHeaders readOnlyHttpHeaders.

Prototype

public static HttpHeaders readOnlyHttpHeaders(HttpHeaders headers) 

Source Link

Document

Return an HttpHeaders object that can only be read, not written to.

Usage

From source file:de.codecentric.boot.admin.services.ApplicationRegistrator.java

private static HttpHeaders createHttpHeaders() {
    HttpHeaders headers = new HttpHeaders();
    headers.setContentType(MediaType.APPLICATION_JSON);
    headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
    return HttpHeaders.readOnlyHttpHeaders(headers);
}

From source file:org.springframework.http.server.reactive.AbstractServerHttpRequest.java

/**
 * Constructor with the URI and headers for the request.
 * @param uri the URI for the request//w  ww.  ja  va 2 s  . co  m
 * @param contextPath the context path for the request
 * @param headers the headers for the request
 */
public AbstractServerHttpRequest(URI uri, @Nullable String contextPath, HttpHeaders headers) {
    this.uri = uri;
    this.path = RequestPath.parse(uri, contextPath);
    this.headers = HttpHeaders.readOnlyHttpHeaders(headers);
}

From source file:org.springframework.http.server.reactive.AbstractServerHttpResponse.java

@Override
public HttpHeaders getHeaders() {
    return (this.state.get() == State.COMMITTED ? HttpHeaders.readOnlyHttpHeaders(this.headers) : this.headers);
}