com.twelvemonkeys.servlet.cache.AbstractCacheResponse Maven / Gradle / Ivy
package com.twelvemonkeys.servlet.cache;
import java.util.*;
/**
* AbstractCacheResponse
*
* @author Harald Kuhr
* @author last modified by $Author: haku $
* @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-servlet/src/main/java/com/twelvemonkeys/servlet/cache/AbstractCacheResponse.java#1 $
*/
public abstract class AbstractCacheResponse implements CacheResponse {
private int mStatus;
private final Map> mHeaders = new LinkedHashMap>(); // Insertion order
private final Map> mReadableHeaders = Collections.unmodifiableMap(mHeaders);
public int getStatus() {
return mStatus;
}
public void setStatus(int pStatusCode) {
mStatus = pStatusCode;
}
public void addHeader(String pHeaderName, String pHeaderValue) {
setHeader(pHeaderName, pHeaderValue, true);
}
public void setHeader(String pHeaderName, String pHeaderValue) {
setHeader(pHeaderName, pHeaderValue, false);
}
private void setHeader(String pHeaderName, String pHeaderValue, boolean pAdd) {
List values = pAdd ? mHeaders.get(pHeaderName) : null;
if (values == null) {
values = new ArrayList();
mHeaders.put(pHeaderName, values);
}
values.add(pHeaderValue);
}
public Map> getHeaders() {
return mReadableHeaders;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy