com.twelvemonkeys.servlet.cache.ServletCacheRequest Maven / Gradle / Ivy
package com.twelvemonkeys.servlet.cache;
import com.twelvemonkeys.servlet.ServletUtil;
import javax.servlet.http.HttpServletRequest;
import java.net.URI;
import java.util.List;
import java.util.Map;
/**
* ServletCacheRequest
*
* @author Harald Kuhr
* @author last modified by $Author: haku $
* @version $Id: ServletCacheRequest.java#1 $
*/
public final class ServletCacheRequest extends AbstractCacheRequest {
private final HttpServletRequest request;
private Map> headers;
private Map> parameters;
protected ServletCacheRequest(final HttpServletRequest pRequest) {
super(URI.create(pRequest.getRequestURI()), pRequest.getMethod());
request = pRequest;
}
public Map> getHeaders() {
if (headers == null) {
headers = ServletUtil.headersAsMap(request);
}
return headers;
}
public Map> getParameters() {
if (parameters == null) {
parameters = ServletUtil.parametersAsMap(request);
}
return parameters;
}
public String getServerName() {
return request.getServerName();
}
public int getServerPort() {
return request.getServerPort();
}
HttpServletRequest getRequest() {
return request;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy