Skip to content

Instantly share code, notes, and snippets.

@janosgyerik
Last active November 27, 2016 18:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janosgyerik/fbcf354d704ccd01a5934a4edddb77df to your computer and use it in GitHub Desktop.
Save janosgyerik/fbcf354d704ccd01a5934a4edddb77df to your computer and use it in GitHub Desktop.

Java:

@POST
@Path("/post")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
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();
}

Curl:

curl -X POST -d type=Link -d content=www -i -u pepe:pepe http://localhost:8080/web-0.0.1-SNAPSHOT/api/user/post
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment