如何使用curl使用2个参数进行POST?休息。 Java的

时间:2016-11-27 16:04:40

标签: java json rest curl

我想在方法" createPost"中引入两个字符串参数(类型和内容)。

我正在使用这一行:

curl -i -u pepe:pepe -d 'type=Link&content=www' --header "Content-Type: application/json"  http://localhost:8080/web-0.0.1-SNAPSHOT/api/user/post

但是...该行引入" type = Link& content = www"在第一个参数中,第二个参数为空。

方法是:

@POST
@Path("/post")
@Consumes(MediaType.APPLICATION_JSON)
public Response createPost(@FormParam("type") String type,  @FormParam("content") String content) { 
    postEJB.createPostUserRest(type, content);
    URI userURI = uriInfo.getAbsolutePathBuilder().build();
    return Response.created(userURI).build();
}

我怎样才能进入" Link"在第一个" www"在第二个?

非常感谢所有人,抱歉我的英语不好。

0 个答案:

没有答案