Newer
Older
JerseyExercise / src / main / java / com / example / jerseyexercise / resources / HelloWorldRest.java
Naoya Nitta on 7 Dec 2023 540 bytes Initial commit.
package com.example.jerseyexercise.resources;

import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
import org.springframework.stereotype.Component;

@Path("/helloworld")
@Component
public class HelloWorldRest {
    private String message = "Hello World!!";

    @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!!";
    }
}