colesico.framework.weblet.ContentResponse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of colesico-weblet Show documentation
Show all versions of colesico-weblet Show documentation
Colesico framework http requests handling service
package colesico.framework.weblet;
import colesico.framework.http.HttpCookie;
import java.util.*;
abstract public class ContentResponse {
public static final int DEFAULT_STATUS_CODE = 200;
/**
* Http response content type
*/
protected final String contentType;
/**
* Http response status code
*/
protected final int statusCode;
private Map> headers = new HashMap<>();
private Set cookies = new HashSet<>();
public ContentResponse(String contentType, int statusCode) {
this.contentType = contentType;
this.statusCode = statusCode;
}
public void setHeader(String name, String vale) {
List hValues = headers.computeIfAbsent(name, n -> new ArrayList<>());
hValues.add(vale);
}
public void setCookie(HttpCookie cookie) {
cookies.add(cookie);
}
public String getContentType() {
return contentType;
}
public int getStatusCode() {
return statusCode;
}
public Map> getHeaders() {
return headers;
}
public Set getCookies() {
return cookies;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy