projects
/
percentcodec
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3f48406
)
Ausgabe des Contents bei 304 unterdrückt
author
Kai Moritz
<kai@coolibri.de>
Thu, 31 May 2012 21:19:08 +0000
(23:19 +0200)
committer
Kai Moritz
<kai@coolibri.de>
Thu, 2 Aug 2012 07:03:26 +0000
(09:03 +0200)
cachecontrol-example-jsp/src/main/webapp/page-with-forward.jsp
patch
|
blob
|
history
cachecontrol-example-jsp/src/main/webapp/page-with-include.jsp
patch
|
blob
|
history
cachecontrol-example-jsp/src/main/webapp/simple-page.jsp
patch
|
blob
|
history
cachecontrol/src/main/java/de/halbekunst/juplo/cachecontrol/AcceleratorFilter.java
patch
|
blob
|
history
diff --git
a/cachecontrol-example-jsp/src/main/webapp/page-with-forward.jsp
b/cachecontrol-example-jsp/src/main/webapp/page-with-forward.jsp
index
786deda
..
35e4905
100644
(file)
--- a/
cachecontrol-example-jsp/src/main/webapp/page-with-forward.jsp
+++ b/
cachecontrol-example-jsp/src/main/webapp/page-with-forward.jsp
@@
-1,4
+1,4
@@
-<%@page contentType="text/html" pageEncoding="UTF-8" session="false"%>
+<%@page contentType="text/html" pageEncoding="UTF-8" session="false"
buffer="1kb"
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
diff --git
a/cachecontrol-example-jsp/src/main/webapp/page-with-include.jsp
b/cachecontrol-example-jsp/src/main/webapp/page-with-include.jsp
index
5c3af3e
..
3347af7
100644
(file)
--- a/
cachecontrol-example-jsp/src/main/webapp/page-with-include.jsp
+++ b/
cachecontrol-example-jsp/src/main/webapp/page-with-include.jsp
@@
-1,4
+1,4
@@
-<%@page contentType="text/html" pageEncoding="UTF-8" session="false"%>
+<%@page contentType="text/html" pageEncoding="UTF-8" session="false"
buffer="1kb"
%>
<%@taglib uri="/WEB-INF/c.tld" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="/WEB-INF/c.tld" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
diff --git
a/cachecontrol-example-jsp/src/main/webapp/simple-page.jsp
b/cachecontrol-example-jsp/src/main/webapp/simple-page.jsp
index
9010d20
..
23e5779
100644
(file)
--- a/
cachecontrol-example-jsp/src/main/webapp/simple-page.jsp
+++ b/
cachecontrol-example-jsp/src/main/webapp/simple-page.jsp
@@
-1,4
+1,4
@@
-<%@page contentType="text/html" pageEncoding="UTF-8" session="false"%>
+<%@page contentType="text/html" pageEncoding="UTF-8" session="false"
buffer="1kb"
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
diff --git
a/cachecontrol/src/main/java/de/halbekunst/juplo/cachecontrol/AcceleratorFilter.java
b/cachecontrol/src/main/java/de/halbekunst/juplo/cachecontrol/AcceleratorFilter.java
index
63edfb5
..
f17ec8d
100644
(file)
--- a/
cachecontrol/src/main/java/de/halbekunst/juplo/cachecontrol/AcceleratorFilter.java
+++ b/
cachecontrol/src/main/java/de/halbekunst/juplo/cachecontrol/AcceleratorFilter.java
@@
-67,8
+67,13
@@
public class AcceleratorFilter implements Filter {
AccelerationWrapper wrapper = new AccelerationWrapper(httpRequest, httpResponse);
httpRequest.setAttribute(RESPONSE_WRAPPER, wrapper);
cacheControl.init(wrapper);
AccelerationWrapper wrapper = new AccelerationWrapper(httpRequest, httpResponse);
httpRequest.setAttribute(RESPONSE_WRAPPER, wrapper);
cacheControl.init(wrapper);
- chain.doFilter(request, wrapper);
- wrapper.finish();
+ try {
+ chain.doFilter(request, wrapper);
+ wrapper.finish();
+ }
+ catch (NotModifiedException nm) {
+ log.trace("Not modified: {}", httpRequest.getRequestURI());
+ }
}
@Override
}
@Override
@@
-644,8
+649,14
@@
public class AcceleratorFilter implements Filter {
out().write(buffer);
committed = true;
/** Dekoration nur beim ersten Schreib-Schub anstoßen */
out().write(buffer);
committed = true;
/** Dekoration nur beim ersten Schreib-Schub anstoßen */
- if (pos == size)
- cacheControl.decorate(request, response);
+ if (pos == size) {
+ if (!cacheControl.decorate(request, response)) {
+ zipped = false;
+ os = null;
+ pos = 0;
+ throw new NotModifiedException();
+ }
+ }
pos = 0;
}
buffer[pos++] = (byte) i;
pos = 0;
}
buffer[pos++] = (byte) i;
@@
-659,8
+670,14
@@
public class AcceleratorFilter implements Filter {
committed = true;
/** Dekoration nur beim ersten Schreib-Schub anstoßen */
committed = true;
/** Dekoration nur beim ersten Schreib-Schub anstoßen */
- if (pos == size)
- cacheControl.decorate(request, response);
+ if (pos == size) {
+ if (!cacheControl.decorate(request, response)) {
+ zipped = false;
+ os = null;
+ pos = 0;
+ throw new NotModifiedException();
+ }
+ }
out().write(buffer, 0, pos);
out().flush();
pos = 0;
out().write(buffer, 0, pos);
out().flush();
pos = 0;
@@
-671,7
+688,8
@@
public class AcceleratorFilter implements Filter {
if (size == 0) {
committed = true;
zipped = false;
if (size == 0) {
committed = true;
zipped = false;
- cacheControl.decorate(request, response);
+ if (!cacheControl.decorate(request, response))
+ throw new NotModifiedException();
sos.close();
}
else {
sos.close();
}
else {
@@
-682,3
+700,5
@@
public class AcceleratorFilter implements Filter {
}
}
}
}
}
}
+
+class NotModifiedException extends IOException {}
\ No newline at end of file