コード例 #1
0
  @GET
  @Produces(MediaType.APPLICATION_JSON)
  public Response findAllByUser(@Context SecurityContext sc, @Context HttpServletRequest req) {
    User user = userBean.getUserByEmail(sc.getUserPrincipal().getName());
    List<Activity> activityDetails = activityBean.getAllActivityByUser(user);
    GenericEntity<List<Activity>> projectActivities =
        new GenericEntity<List<Activity>>(activityDetails) {};

    return noCacheResponse
        .getNoCacheResponseBuilder(Response.Status.OK)
        .entity(projectActivities)
        .build();
  }
コード例 #2
0
  @GET
  @Path("/query")
  @Produces(MediaType.APPLICATION_JSON)
  public Response findPaginatedByUser(
      @QueryParam("from") int from,
      @QueryParam("to") int to,
      @Context SecurityContext sc,
      @Context HttpServletRequest req) {
    User user = userBean.getUserByEmail(sc.getUserPrincipal().getName());
    List<Activity> activityDetails = activityBean.getPaginatedActivityByUser(from, to, user);
    GenericEntity<List<Activity>> projectActivities =
        new GenericEntity<List<Activity>>(activityDetails) {};

    return noCacheResponse
        .getNoCacheResponseBuilder(Response.Status.OK)
        .entity(projectActivities)
        .build();
  }