| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
|
| 22 |
|
|
| 23 |
|
|
| 24 |
|
|
| 25 |
|
|
| 26 |
|
|
| 27 |
|
|
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
package net.sourceforge.pebble.web.filter; |
| 33 |
|
|
| 34 |
|
import javax.servlet.ServletOutputStream; |
| 35 |
|
import javax.servlet.http.HttpServletResponse; |
| 36 |
|
import javax.servlet.http.HttpServletResponseWrapper; |
| 37 |
|
import java.io.IOException; |
| 38 |
|
import java.io.OutputStreamWriter; |
| 39 |
|
import java.io.PrintWriter; |
| 40 |
|
|
|
|
|
| 0% |
Uncovered Elements: 43 (43) |
Complexity: 15 |
Complexity Density: 0,68 |
|
| 41 |
|
public class GZIPResponseWrapper extends HttpServletResponseWrapper { |
| 42 |
|
|
| 43 |
|
protected HttpServletResponse wrappedResponse = null; |
| 44 |
|
protected ServletOutputStream stream = null; |
| 45 |
|
protected PrintWriter writer = null; |
| 46 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
| 47 |
0
|
public GZIPResponseWrapper(HttpServletResponse response) {... |
| 48 |
0
|
super(response); |
| 49 |
0
|
wrappedResponse = response; |
| 50 |
|
} |
| 51 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 52 |
0
|
public ServletOutputStream createOutputStream() throws IOException {... |
| 53 |
0
|
return (new GZIPResponseStream(wrappedResponse)); |
| 54 |
|
} |
| 55 |
|
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 4 |
Complexity Density: 0,8 |
|
| 56 |
0
|
public void finishResponse() {... |
| 57 |
0
|
try { |
| 58 |
0
|
if (writer != null) { |
| 59 |
0
|
writer.close(); |
| 60 |
|
} else { |
| 61 |
0
|
if (stream != null) { |
| 62 |
0
|
stream.close(); |
| 63 |
|
} |
| 64 |
|
} |
| 65 |
|
} catch (IOException e) { |
| 66 |
|
} |
| 67 |
|
} |
| 68 |
|
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
| 69 |
0
|
public void flushBuffer() throws IOException {... |
| 70 |
0
|
if (stream != null) { |
| 71 |
0
|
stream.flush(); |
| 72 |
|
} |
| 73 |
|
} |
| 74 |
|
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0,6 |
|
| 75 |
0
|
public ServletOutputStream getOutputStream() throws IOException {... |
| 76 |
0
|
if (writer != null) { |
| 77 |
0
|
throw new IllegalStateException("getWriter() has already been called!"); |
| 78 |
|
} |
| 79 |
|
|
| 80 |
0
|
if (stream == null) |
| 81 |
0
|
stream = createOutputStream(); |
| 82 |
0
|
return (stream); |
| 83 |
|
} |
| 84 |
|
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 3 |
Complexity Density: 0,43 |
|
| 85 |
0
|
public PrintWriter getWriter() throws IOException {... |
| 86 |
0
|
if (writer != null) { |
| 87 |
0
|
return (writer); |
| 88 |
|
} |
| 89 |
|
|
| 90 |
0
|
if (stream != null) { |
| 91 |
0
|
throw new IllegalStateException("getOutputStream() has already been called!"); |
| 92 |
|
} |
| 93 |
|
|
| 94 |
0
|
stream = createOutputStream(); |
| 95 |
0
|
writer = new PrintWriter(new OutputStreamWriter(stream, "UTF-8")); |
| 96 |
0
|
return (writer); |
| 97 |
|
} |
| 98 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 99 |
0
|
public void setContentLength(int length) {... |
| 100 |
|
} |
| 101 |
|
|
| 102 |
|
} |