package com.paipeng.rest;

import java.util.logging.Logger;

import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;

@RequestScoped
@Path("")
public class TestRest {

	@Inject
	protected Logger log;

	@PostConstruct
	public void postConstruct() {
		log.info("postConstruct");
	}
	
	@Path("/echo")
	@Produces("application/json")
	@GET
	@POST
	public Response echo(@QueryParam("echo") String echo) {
		log.info("echo: " + echo);
		return Response.ok(echo).build();
	}
}

@@ -20,16 +20,39 @@
 .rest;%0A%0A
+import java.util.List;%0A
 import j
@@ -76,16 +76,16 @@
 Logger;%0A
-
 %0Aimport 
@@ -360,16 +360,98 @@
 ponse;%0A%0A
+import com.paipeng.jpa.model.Lotto;%0Aimport com.paipeng.jpa.service.LottoService;%0A%0A
 @Request
@@ -523,16 +523,67 @@
 ger log;
+%0A%09%0A%09@Inject%0A%09protected LottoService lottoService;%0A%09
 %0A%0A%09@Post
@@ -839,13 +839,227 @@
 uild();%0A
-
 %09%7D%0A
+%09%0A%09@Path(%22/lottos%22)%0A%09@Produces(%22application/json%22)%0A%09@GET%0A%09@POST%0A%09public Response lottos() %7B%0A%09%09log.info(%22lottos%22);%0A%09%09List%3CLotto%3E lottoList = lottoService.getLottos();%0A%09%09return Response.ok(lottoList).build();%0A%09%7D%0A%09%0A%09%0A
 %7D%0A

add rest api for testing jpa!