Newer
Older
JerseyExercise / src / main / java / com / example / jerseyexercise / resources / maguroRest.java
kazuki-danno on 18 Nov 2021 524 bytes t-okazaki恮Rest
package com.example.jerseyexercise.resources;

import org.springframework.stereotype.Component;

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

@Component
@Path("/maguro")
public class maguroRest {
    private String message = "Namako!";

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

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