简体   繁体   中英

Java Rest sending data

Can you please help me with sending data (mp3, wav etc.) using Rest service? I dont know what mime type should I use in my service method declaration.

I have something like this:


>

@Path("/echo") public class MyService{ @GET @Produces("text/html") public String get(@Context UriInfo ui) { MultivaluedMap queryParams=ui.getQueryParameters(); return "tyleczek"; } @POST @Consumes("application/x-www-form-urlencoded") @Produces("text/html") public String post(MultivaluedMap queryParams) { return showQueryParams(queryParams); } }

I triend sending it as byte code but it didnt work. Can you please help me? Thank you in advance.

Usually binary content is transferred after being encoded in Base64. Check commons-codec Base64 for a ready-to-use implementation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM