| .. | .. |
|---|
| 3 | 3 | import java.net.URI; |
|---|
| 4 | 4 | import java.util.Date; |
|---|
| 5 | 5 | |
|---|
| 6 | +import javax.inject.Inject; |
|---|
| 7 | +import javax.inject.Singleton; |
|---|
| 6 | 8 | import javax.servlet.http.HttpServletRequest; |
|---|
| 7 | 9 | import javax.servlet.http.HttpSession; |
|---|
| 8 | 10 | import javax.ws.rs.GET; |
|---|
| 9 | 11 | import javax.ws.rs.Path; |
|---|
| 10 | 12 | import javax.ws.rs.Produces; |
|---|
| 13 | +import javax.ws.rs.QueryParam; |
|---|
| 11 | 14 | import javax.ws.rs.core.Context; |
|---|
| 12 | 15 | import javax.ws.rs.core.MediaType; |
|---|
| 13 | 16 | import javax.ws.rs.core.Response; |
|---|
| 14 | 17 | import javax.ws.rs.core.UriBuilder; |
|---|
| 18 | + |
|---|
| 19 | +import net.curisit.securis.dao.UserDao; |
|---|
| 20 | +import net.curisit.securis.db.User; |
|---|
| 15 | 21 | |
|---|
| 16 | 22 | import org.slf4j.Logger; |
|---|
| 17 | 23 | import org.slf4j.LoggerFactory; |
|---|
| .. | .. |
|---|
| 22 | 28 | * @author roberto <roberto.sanchez@curisit.net> |
|---|
| 23 | 29 | */ |
|---|
| 24 | 30 | @Path("/") |
|---|
| 31 | +@Singleton |
|---|
| 25 | 32 | public class BasicServices { |
|---|
| 26 | 33 | |
|---|
| 27 | 34 | private static final Logger log = LoggerFactory.getLogger(BasicServices.class); |
|---|
| 28 | 35 | |
|---|
| 36 | + @Inject |
|---|
| 29 | 37 | public BasicServices() { |
|---|
| 30 | 38 | } |
|---|
| 31 | 39 | |
|---|
| .. | .. |
|---|
| 54 | 62 | return Response.ok().entity("License server running OK. Date: " + new Date()).build(); |
|---|
| 55 | 63 | } |
|---|
| 56 | 64 | |
|---|
| 65 | + @Inject |
|---|
| 66 | + UserDao userDao; |
|---|
| 67 | + |
|---|
| 68 | + @GET |
|---|
| 69 | + @Path("/test") |
|---|
| 70 | + @Produces( |
|---|
| 71 | + { MediaType.TEXT_PLAIN }) |
|---|
| 72 | + public Response test(@QueryParam("u") String username) { |
|---|
| 73 | + User user = userDao.test(username); |
|---|
| 74 | + |
|---|
| 75 | + return Response.ok().entity("User: " + user).build(); |
|---|
| 76 | + } |
|---|
| 77 | + |
|---|
| 57 | 78 | } |
|---|