Dienstag, 18. September 2012

Jersey consume JSON Example & Test with Postman

Jersey consume JSON Example & Test with Postman

Domain Class Example Code

public class Test {

    private String Firstname;

    private String Lastname;

    public Test()

    public Test(String firstname, String lastname)

    public String getFirstname() {
        return Firstname;

    public void setFirstname(String firstname) {
        Firstname = firstname;

    public String getLastname() {
        return Lastname;

    public void setLastname(String lastname) {
        Lastname = lastname;

Ressource Class Method

    public String setTest(Test someName)
        return "Hello "+ someName.getFirstname()+" nice to meet you.";

Hints for using Chrome Plugin "PostMan"

1. Set Content-Type of http header to "application/json" (otherwise Jersey will answer with 415 Unsupported Media Type)

2. Send RAW message body in json format:


1 Kommentar:

  1. What if i want to get this message with get type request? There is no raw option? What will my input like?