import javax.servlet.ServletOutputStream;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
+import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpServletResponseWrapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowire;
}
- class AccelerationWrapper extends HttpServletResponseWrapper implements CacheMethodHandle {
+ class AccelerationWrapper implements HttpServletResponse, CacheMethodHandle {
private final HttpServletRequest request;
private final HttpServletResponse response;
AccelerationWrapper(HttpServletRequest request, HttpServletResponse response) throws IOException {
- super(response);
this.request = request;
this.response = response;
public void addDateHeader(String name, long value) {
if (!guessing) {
- super.addDateHeader(name, value);
+ response.addDateHeader(name, value);
return;
}
}
/** Unknown header: pass throug! */
- super.addDateHeader(name, value);
+ response.addDateHeader(name, value);
}
@Override
public void addHeader(String name, String value) {
if (!guessing) {
- super.addHeader(name, value);
+ response.addHeader(name, value);
return;
}
public void addIntHeader(String name, int value) {
if (!guessing) {
- super.addIntHeader(name, value);
+ response.addIntHeader(name, value);
return;
}
public void setDateHeader(String name, long value) {
if (!guessing) {
- super.setDateHeader(name, value);
+ response.setDateHeader(name, value);
return;
}
}
/** Unknown header: pass throug! */
- super.setDateHeader(name, value);
+ response.setDateHeader(name, value);
}
@Override
public void setHeader(String name, String value) {
if (!guessing) {
- super.setHeader(name, value);
+ response.setHeader(name, value);
return;
}
public void setIntHeader(String name, int value) {
if (!guessing) {
- super.setIntHeader(name, value);
+ response.setIntHeader(name, value);
return;
}
/** Pass header through, if no value from intrest was found */
if (overwrite)
- super.setHeader(name, value);
+ response.setHeader(name, value);
else
- super.addHeader(name, value);
+ response.addHeader(name, value);
}
private void calculateCacheSeconds() {
}
}
+ @Override
+ public void addCookie(Cookie cookie) {
+ // TODO: Je nach Vary-Einstellung ETag anpassen?
+ response.addCookie(cookie);
+ }
+
+ @Override
+ public boolean containsHeader(String name) {
+ return response.containsHeader(name);
+ }
+
+ @Override
+ public String encodeURL(String url) {
+ return response.encodeURL(url);
+ }
+
+ @Override
+ public String encodeRedirectURL(String url) {
+ return response.encodeRedirectURL(url);
+ }
+
+ @Override
+ public String encodeUrl(String url) {
+ return response.encodeUrl(url);
+ }
+
+ @Override
+ public String encodeRedirectUrl(String url) {
+ return response.encodeRedirectUrl(url);
+ }
+
+ @Override
+ public void sendError(int sc, String msg) throws IOException {
+ // TODO: Decoration anpassen/anstoßen?!?
+ response.sendError(sc,msg);
+ }
+
+ @Override
+ public void sendError(int sc) throws IOException {
+ // TODO: Decoration anpassen/anstoßen?!?
+ response.sendError(sc);
+ }
+
+ @Override
+ public void sendRedirect(String location) throws IOException {
+ // TODO: Decoration anpassen/anstoßen?!?
+ response.sendRedirect(location);
+ }
+
+ @Override
+ public String getCharacterEncoding() {
+ return response.getCharacterEncoding();
+ }
+
+ @Override
+ public String getContentType() {
+ return response.getContentType();
+ }
+
+ @Override
+ public void setCharacterEncoding(String charset) {
+ // TODO: Je nach Vary-Einstellung ETag anpassen?
+ response.setCharacterEncoding(charset);
+ }
+
+ @Override
+ public void setContentType(String type) {
+ // TODO: Je nach Vary-Einstellung ETag anpassen?
+ response.setContentType(type);
+ }
+
+ @Override
+ public int getBufferSize() {
+ return response.getBufferSize();
+ }
+
+ @Override
+ public boolean isCommitted() {
+ // TODO: Eigene commit-Kontrolle wegen Dekorations-Einstiegspunkt?!?
+ return response.isCommitted();
+ }
+
+ @Override
+ public void setLocale(Locale loc) {
+ // TODO: Je nach Vary-Einstellung ETag anpassen?
+ response.setLocale(loc);
+ }
+
+ @Override
+ public Locale getLocale() {
+ return getLocale();
+ }
+
class CountingServletOutputStream extends ServletOutputStream {