@Override
  public void doGet(Request request, Response response) {

    // 检测是否是后台登陆
    Session session = request.getSession(false);
    Integer userId = (Integer) session.getArtribute("userId");
    User user = userDao.getUser(userId);
    if (!user.getName().equals("root")) {
      try {
        response.outPut();
      } catch (IOException e) {
        e.printStackTrace();
      } finally {
        return;
      }
    }

    // 获得所有订单的实体
    List<Order> listOrders = orderDao.getAllOrders();

    // 输出所有订单
    try {
      response.outPut(listOrders);
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
Exemple #2
0
  @Override
  public void doGet(Request request, Response response) {
    try {
      response.setHeader("Content-Type", "text/html; charset=utf-8");
      response.outPut("欢迎光临");

    } catch (IOException e) {
      e.printStackTrace();
    }
  }