示例#1
0
  protected void service(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    String action = request.getParameter("action");
    String name = request.getParameter("name");

    String redirect = "/user.jsp?name=" + name;
    Client client = ClientRepository.getInstance().getClient(name);

    if ("kick".equals(action)) {
      logger.info(
          client.getUser().getName()
              + " ("
              + client.getInetAddress()
              + ") has been kicked by "
              + request.getRemoteUser()
              + " ("
              + request.getRemoteHost()
              + ")");
    } else if ("ban".equals(action)) {
      Banlist banlist = Banlist.getInstance();
      banlist.ban(client.getInetAddress().getHostAddress());

      logger.info(
          client.getUser().getName()
              + " ("
              + client.getInetAddress()
              + ") has been banned by "
              + request.getRemoteUser()
              + " ("
              + request.getRemoteHost()
              + ")");

      // save the server configuration
      Server.getInstance().getConfig().save();
    }

    client.disconnect();

    response.sendRedirect("/channel.jsp?name=" + client.getChannel().getConfig().getName());
  }
示例#2
0
  protected static int processGet() throws NimbitsException {
    final List<Entity> points = EntityServiceFactory.getInstance().getIdleEntities();
    log.info("Processing " + points.size() + " potentially idle points");
    for (final Entity p : points) {
      try {
        checkIdle((Point) p);
      } catch (NimbitsException e) {

        LogHelper.logException(IdlePointCron.class, e);
      }
    }
    return points.size();
  }