▼リスト1 JAX-RSによる記述例 import javax.ws.rs.Path; import javax.ws.rs.GET; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; @Path("/employee") public class EmployeeResource { @GET @Path("{id}") @Produces("text/plain") public String getEmployee(@PathParam("id") Integer id) { return "id = " + id; } } ▼リスト2 "Success"のテキストレスポンスにCookieを付加して返す @GET public Response get() { return Response.ok("Success", "text/plain") .cookie(new NewCookie("token", "12345678")).build(); } ▼リスト3 例外をスローして403 Forbiddenエラーを返す @GET public Response get() { ... if (!authorized) { throw new WebApplicationException(Response.Status.FORBIDDEN); } } ▼リスト4 T2のページクラスの記述例 import org.t2framework.t2.annotation.composite.GET; import org.t2framework.t2.annotation.core.ActionPath; import org.t2framework.t2.annotation.core.Page; import org.t2framework.t2.annotation.core.Var; import org.t2framework.t2.navigation.SimpleText; import org.t2framework.t2.spi.Navigation; @Page("/employee") public class EmployeePage { @GET @ActionPath("{id}") public Navigation getEmployee(@Var("id") String id) { return SimpleText.out("id = " + id); } }