Last active
February 12, 2020 16:53
-
-
Save chongma/60c7f308bf4896fea9155d710ee81d5f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.test; | |
| import java.io.InputStream; | |
| import javax.ws.rs.Consumes; | |
| import javax.ws.rs.PUT; | |
| import javax.ws.rs.Path; | |
| import javax.ws.rs.PathParam; | |
| import javax.ws.rs.core.Response; | |
| import org.apache.johnzon.mapper.Mapper; | |
| import org.apache.johnzon.mapper.MapperBuilder; | |
| @Path("/test") | |
| public class TestService { | |
| @Path("/myObjects/{id}/{type}") | |
| @PUT | |
| @Consumes("application/json") | |
| public Response test(@PathParam("id") Long id, @PathParam("type") String type, | |
| InputStream inputStream) { | |
| System.out.println(type); | |
| final Mapper mapper = new MapperBuilder().build(); | |
| final String otherObject = mapper.readObject(inputStream, String.class); | |
| System.out.println(otherObject); | |
| return Response.ok().build(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.