コード例 #1
0
  public ModelAndView send(HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    String broadcast = ServletRequestUtils.getStringParameter(request, "broadcast", "Y");
    String username = ServletRequestUtils.getStringParameter(request, "username");
    String title = ServletRequestUtils.getStringParameter(request, "title");
    String message = ServletRequestUtils.getStringParameter(request, "message");
    String uri = ServletRequestUtils.getStringParameter(request, "uri");

    String apiKey = Config.getString("apiKey", "");
    logger.debug("apiKey=" + apiKey);

    if (broadcast.equalsIgnoreCase("Y")) {
      notificationManager.sendBroadcast(apiKey, title, message, uri);
    } else {
      notificationManager.sendNotifcationToUser(apiKey, username, title, message, uri);
    }

    ModelAndView mav = new ModelAndView();
    mav.setViewName("redirect:notification.do");
    return mav;
  }
コード例 #2
0
  public void send(HttpServletRequest request, HttpServletResponse response) throws Exception {
    System.out.println("-------------------------------------");
    System.out.println("in api send");
    String broadcast = ServletRequestUtils.getStringParameter(request, "broadcast", "Y");
    String clientId = ServletRequestUtils.getStringParameter(request, "clientId");
    String title = ServletRequestUtils.getStringParameter(request, "title");
    String message = ServletRequestUtils.getStringParameter(request, "message");

    if (broadcast.equalsIgnoreCase("Y")) {
      //
      notificationManager.sendBroadcast(title, message, "0", "AllUsers", "System");
    } else {
      //
      notificationManager.sendNotifcationToUser(
          clientId, title, message, "0", "AllUsers", "System");
    }

    response.getWriter().print("{\"result\":\"0\",\"description\":\"success\"}");
    //		ModelAndView mav = new ModelAndView();
    //		mav.setViewName("redirect:notification.do");
    //		return mav;
  }