Example #1
0
  @GET
  @Path("entrante")
  @Produces(MediaType.APPLICATION_JSON)
  public List<Message> mensajesRecibido(
      @QueryParam("nombreUsuario") String nombreUsuario, @QueryParam("imei") String imei) {

    List<Message> mensajes = null;

    if (autenticar(nombreUsuario, imei)) {
      ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(server);
      MessageService mensajeService =
          (MessageService) ctx.getBean(MessageService.class.getSimpleName());
      System.out.println("ingeso");
      mensajes = mensajeService.findByImei(nombreUsuario, imei);
      mensajeService.setEnviado(mensajes, ctx);
    } else {
      throw new NotAuthorizedException();
    }

    return mensajes;
  }