This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.codahale.metrics.annotation.Timed; | |
import io.dropwizard.hibernate.UnitOfWork; | |
import javax.ws.rs.GET; | |
import javax.ws.rs.POST; | |
import javax.ws.rs.Path; | |
import java.util.List; | |
/** | |
* Created by harshvardhan on 12/07/18. | |
*/ | |
@Path("/resource") | |
@Produces(MediaType.APPLICATION_JSON) | |
public class MyResource { | |
private InfoDao infoDao; | |
public MyResource(InfoDao infoDao) { | |
this.infoDao = infoDao; | |
} | |
@GET | |
@Timed | |
@Path("/getName") | |
public String getName() { | |
return "Harsh"; | |
} | |
@POST | |
@Timed | |
@Path("/postName") | |
public String postName(String name) { | |
System.out.println("Name given by : "+name); | |
return "Ok"; | |
} | |
@GET | |
@Timed | |
@UnitOfWork | |
@Path("/findAllEmp") | |
public List<Info> findAllEmp() { | |
System.out.println("All Emp : "+infoDao.findAll()); | |
return infoDao.findAll(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment