mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-25 02:27:43 +01:00
parent
df50b8bb76
commit
a35da3dad2
@ -6,6 +6,7 @@ import com.sun.net.httpserver.HttpExchange;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Objects;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
@ -87,10 +88,12 @@ public abstract class Response {
|
||||
responseHeaders.set("Content-Encoding", "gzip");
|
||||
exchange.sendResponseHeaders(getCode(), 0);
|
||||
|
||||
String content = this instanceof JavaScriptResponse ? getContent() : locale.replaceMatchingLanguage(getContent());
|
||||
String content = this instanceof JavaScriptResponse
|
||||
? getContent()
|
||||
: locale.replaceMatchingLanguage(getContent());
|
||||
|
||||
try (GZIPOutputStream out = new GZIPOutputStream(exchange.getResponseBody());
|
||||
ByteArrayInputStream bis = new ByteArrayInputStream(content.getBytes())) {
|
||||
ByteArrayInputStream bis = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8))) {
|
||||
byte[] buffer = new byte[2048];
|
||||
int count;
|
||||
while ((count = bis.read(buffer)) != -1) {
|
||||
|
@ -10,7 +10,7 @@ package com.djrapitops.plan.system.webserver.response;
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public enum ResponseType {
|
||||
HTML("text/html;charset=utf-8"),
|
||||
HTML("text/html; charset=utf-8"),
|
||||
CSS("text/css"),
|
||||
JSON("application/json"),
|
||||
JAVASCRIPT("application/javascript");
|
||||
|
Loading…
Reference in New Issue
Block a user