-
Bug
-
Resolution: Done
-
Major
-
None
-
2.3.7.Final
-
None
I use curl to send a get request to the REST resource below.
curl -i -k --user xxx:xxx -H "Accept: text/plain" -X GET "http://localhost:8080/veto_ifc/ifcv1/definitions/resource-versions/103" > output.txt
The REST response should be "C3A4" in HEX instead of "E4".
I didn't find a way to achieve this. It works like this in Jersey.
Please see attached files as well.
RRResourceVersion.java
@GET @Produces(MediaType.TEXT_PLAIN) public Response getTextRepresentation(@PathParam("resource-version-id") String resourceVersionId) { Response response = null; try { String content = "ä"; byte[] utf8Arr = content.getBytes("UTF-8"); String hexString = RRResourceVersion.byteArray2Hex(utf8Arr); LOGGER.info("hexString="+hexString); String utf8Content = new String(utf8Arr, "UTF-8"); response = Response.status(Response.Status.OK).entity(utf8Content).type(MediaType.TEXT_PLAIN).encoding("UTF-8").build(); } catch (Throwable t) { LOGGER.error("Throwable caught. ", t); response = RestService.createResponse(MediaType.TEXT_PLAIN_TYPE, Response.Status.INTERNAL_SERVER_ERROR, RestService.throwable2String(t)); } return response; }
HTTP/1.1 200 OK Content-Encoding: UTF-8 Connection: keep-alive X-Powered-By: Undertow 1 Server: Wildfly 8 Content-Type: text/plain Content-Length: 1 Date: Tue, 20 May 2014 09:31:43 GMT ä
- is cloned by
-
RESTEASY-1092 Text responses should default to charset UTF-8
- Closed
-
RESTEASY-1102 Text responses should default to charset UTF-8
- Closed