Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.eventmesh.runtime.admin.handler;

import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.protocol.tcp.UserAgent;
import org.apache.eventmesh.common.utils.JsonUtils;
import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
Expand Down Expand Up @@ -111,8 +112,8 @@ void delete(HttpExchange httpExchange) throws IOException {

Error error = new Error(e.toString(), stackTrace);
String result = JsonUtils.toJSONString(error);
httpExchange.sendResponseHeaders(500, result.getBytes().length);
out.write(result.getBytes());
httpExchange.sendResponseHeaders(500, result.getBytes(Constants.DEFAULT_CHARSET).length);
out.write(result.getBytes(Constants.DEFAULT_CHARSET));
} finally {
if (out != null) {
try {
Expand Down Expand Up @@ -163,8 +164,8 @@ void list(HttpExchange httpExchange) throws IOException {
});

String result = JsonUtils.toJSONString(getClientResponseList);
httpExchange.sendResponseHeaders(200, result.getBytes().length);
out.write(result.getBytes());
httpExchange.sendResponseHeaders(200, result.getBytes(Constants.DEFAULT_CHARSET).length);
out.write(result.getBytes(Constants.DEFAULT_CHARSET));
} catch (Exception e) {
StringWriter writer = new StringWriter();
PrintWriter printWriter = new PrintWriter(writer);
Expand All @@ -174,8 +175,8 @@ void list(HttpExchange httpExchange) throws IOException {

Error error = new Error(e.toString(), stackTrace);
String result = JsonUtils.toJSONString(error);
httpExchange.sendResponseHeaders(500, result.getBytes().length);
out.write(result.getBytes());
httpExchange.sendResponseHeaders(500, result.getBytes(Constants.DEFAULT_CHARSET).length);
out.write(result.getBytes(Constants.DEFAULT_CHARSET));
} finally {
if (out != null) {
try {
Expand Down