aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-05-18 15:32:19 -0700
committerAnton Tananaev <anton@traccar.org>2023-05-18 15:32:19 -0700
commit1e1e55537a6fcb2d5365ea2cbcb9c182d986e83a (patch)
tree71f7f64cf7bcba92ce6342a5efe35763585bdaf0 /src/main/java/org
parent0e8057c605e38ecae49c6c69941a46075507302a (diff)
downloadtrackermap-server-1e1e55537a6fcb2d5365ea2cbcb9c182d986e83a.tar.gz
trackermap-server-1e1e55537a6fcb2d5365ea2cbcb9c182d986e83a.tar.bz2
trackermap-server-1e1e55537a6fcb2d5365ea2cbcb9c182d986e83a.zip
Fix response wrapper
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/traccar/web/OverrideFilter.java4
-rw-r--r--src/main/java/org/traccar/web/ResponseWrapper.java (renamed from src/main/java/org/traccar/web/CharResponseWrapper.java)4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/web/OverrideFilter.java b/src/main/java/org/traccar/web/OverrideFilter.java
index 708632bc1..e6e02514c 100644
--- a/src/main/java/org/traccar/web/OverrideFilter.java
+++ b/src/main/java/org/traccar/web/OverrideFilter.java
@@ -45,12 +45,12 @@ public class OverrideFilter implements Filter {
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
- CharResponseWrapper wrappedResponse = new CharResponseWrapper((HttpServletResponse) response);
+ ResponseWrapper wrappedResponse = new ResponseWrapper((HttpServletResponse) response);
chain.doFilter(request, wrappedResponse);
byte[] bytes = wrappedResponse.getCapture();
- if (wrappedResponse.getContentType().contains("text/html")
+ if (wrappedResponse.getContentType() != null && wrappedResponse.getContentType().contains("text/html")
|| ((HttpServletRequest) request).getPathInfo().endsWith("manifest.json")) {
Server server;
diff --git a/src/main/java/org/traccar/web/CharResponseWrapper.java b/src/main/java/org/traccar/web/ResponseWrapper.java
index 477fe7928..7c06b67b8 100644
--- a/src/main/java/org/traccar/web/CharResponseWrapper.java
+++ b/src/main/java/org/traccar/web/ResponseWrapper.java
@@ -22,12 +22,12 @@ import javax.servlet.http.HttpServletResponseWrapper;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-public class CharResponseWrapper extends HttpServletResponseWrapper {
+public class ResponseWrapper extends HttpServletResponseWrapper {
private final ByteArrayOutputStream capture;
private ServletOutputStream output;
- public CharResponseWrapper(HttpServletResponse response) {
+ public ResponseWrapper(HttpServletResponse response) {
super(response);
capture = new ByteArrayOutputStream(response.getBufferSize());
}