YARN-7909. Add charset to YARN Service REST API. (Contributed by Eric Yang)

This commit is contained in:
Eric Yang 2018-02-09 20:01:25 -05:00
parent 543f3abbee
commit c97d5bceb2
1 changed files with 7 additions and 6 deletions

View File

@ -94,7 +94,7 @@ public class ApiServer {
@GET @GET
@Path(VERSION) @Path(VERSION)
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON + ";charset=utf-8" })
public Response getVersion() { public Response getVersion() {
String version = VersionInfo.getBuildVersion(); String version = VersionInfo.getBuildVersion();
LOG.info(version); LOG.info(version);
@ -104,7 +104,7 @@ public class ApiServer {
@POST @POST
@Path(SERVICE_ROOT_PATH) @Path(SERVICE_ROOT_PATH)
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON + ";charset=utf-8" })
public Response createService(@Context HttpServletRequest request, public Response createService(@Context HttpServletRequest request,
Service service) { Service service) {
ServiceStatus serviceStatus = new ServiceStatus(); ServiceStatus serviceStatus = new ServiceStatus();
@ -167,7 +167,7 @@ public class ApiServer {
@GET @GET
@Path(SERVICE_PATH) @Path(SERVICE_PATH)
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON + ";charset=utf-8" })
public Response getService(@Context HttpServletRequest request, public Response getService(@Context HttpServletRequest request,
@PathParam(SERVICE_NAME) String appName) { @PathParam(SERVICE_NAME) String appName) {
ServiceStatus serviceStatus = new ServiceStatus(); ServiceStatus serviceStatus = new ServiceStatus();
@ -210,7 +210,7 @@ public class ApiServer {
@DELETE @DELETE
@Path(SERVICE_PATH) @Path(SERVICE_PATH)
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON + ";charset=utf-8" })
public Response deleteService(@Context HttpServletRequest request, public Response deleteService(@Context HttpServletRequest request,
@PathParam(SERVICE_NAME) String appName) { @PathParam(SERVICE_NAME) String appName) {
try { try {
@ -273,7 +273,8 @@ public class ApiServer {
@PUT @PUT
@Path(COMPONENT_PATH) @Path(COMPONENT_PATH)
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN }) @Produces({ MediaType.APPLICATION_JSON + ";charset=utf-8",
MediaType.TEXT_PLAIN })
public Response updateComponent(@Context HttpServletRequest request, public Response updateComponent(@Context HttpServletRequest request,
@PathParam(SERVICE_NAME) String appName, @PathParam(SERVICE_NAME) String appName,
@PathParam(COMPONENT_NAME) String componentName, Component component) { @PathParam(COMPONENT_NAME) String componentName, Component component) {
@ -322,7 +323,7 @@ public class ApiServer {
@PUT @PUT
@Path(SERVICE_PATH) @Path(SERVICE_PATH)
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON + ";charset=utf-8" })
public Response updateService(@Context HttpServletRequest request, public Response updateService(@Context HttpServletRequest request,
@PathParam(SERVICE_NAME) String appName, @PathParam(SERVICE_NAME) String appName,
Service updateServiceData) { Service updateServiceData) {