Newer
Older
JerseyExercise / src / main / java / com / example / jerseyexercise / resources / RabbitRest.java
package com.example.jerseyexercise.resources;

import org.springframework.stereotype.Component;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;

@Component
@Path ("/rabbit")
public class RabbitRest {
    private String message = "Rabbit jumps!!";

    @PUT
    @Produces(MediaType.TEXT_PLAIN)
    public String setMessage(@FormParam("message") String m) {
        this.message = m;
        return "Success!!";
    }

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String getMessage() {
        return message;
    }
}