Merge branch 'fix/grafana/translation' into 'master'

Fix grafana translation not working properly

See merge request entgra/carbon-device-mgt!854
temp
Pahansith Gunathilake 3 years ago
commit ac5e8547c0

@ -46,6 +46,7 @@ import javax.ws.rs.core.UriInfo;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URI; import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -138,7 +139,7 @@ public class GrafanaRequestHandlerUtil {
} }
public static void setRequestEntity(HttpPost postRequest, JsonObject body) throws UnsupportedEncodingException { public static void setRequestEntity(HttpPost postRequest, JsonObject body) throws UnsupportedEncodingException {
StringEntity bodyEntity = new StringEntity(body.toString()); StringEntity bodyEntity = new StringEntity(body.toString(), StandardCharsets.UTF_8);
bodyEntity.setContentType(MediaType.APPLICATION_JSON); bodyEntity.setContentType(MediaType.APPLICATION_JSON);
postRequest.setEntity(bodyEntity); postRequest.setEntity(bodyEntity);
} }

@ -48,6 +48,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.URI; import java.net.URI;
import java.nio.charset.StandardCharsets;
@MultipartConfig @MultipartConfig
@WebServlet( @WebServlet(
@ -150,6 +151,7 @@ public class GrafanaHandler extends HttpServlet {
resp.setContentType(contentType); resp.setContentType(contentType);
resp.setStatus(grafanaAPIResponse.getCode()); resp.setStatus(grafanaAPIResponse.getCode());
addXFrameOptionsHeaders(resp); addXFrameOptionsHeaders(resp);
resp.setCharacterEncoding(StandardCharsets.UTF_8.name());
resp.getWriter().print(grafanaAPIResponse.getData()); resp.getWriter().print(grafanaAPIResponse.getData());
} }

Loading…
Cancel
Save