开发者

How to send a photo to a rest service

What is the best approach to be able to send a photo from the iPhone client to a rest service (jax-rs) and save it from there? This is my current server code:

@POST
@Path("/newPhoto/{eventId}") 
@Consumes("application/octet-stream") 
public void newPhoto (@PathParam("eventId") String eventID, 
        开发者_如何学Go              InputStream pict) 
     throws Exception 
{ 
        // save photo
}

Is this ok or do you recommend something else? And how can I test this service on terminal with curl command?


It looks good for me. Usually, I would put the InputStream as first param, but I checked and it's OK.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜