Beispiel #1
0
  /**
   * 获取异步请求结果
   *
   * @param req
   * @param res
   */
  public static void asyncResult(HttpServletRequest req, HttpServletResponse res) {
    IAsyncMgntInt iAsyncMgntInt = new IAsyncMgntInt();
    SSysOperatorsListHolder holder = new SSysOperatorsListHolder();
    CBSErrorMsg errMsg = new CBSErrorMsg();
    iAsyncMgntInt.setAsyncCall(true);

    try {
      String mseq = req.getParameter("mseq");

      MessageSequence ms = new MessageSequence(mseq);

      iAsyncMgntInt.setMseq(ms);
      int result = iAsyncMgntInt.select_sysOperators_response(holder, errMsg);
      res.getWriter().println("<a href=\"./index.html\">返回首页</a></script>");
      SSysOperatorsList list = holder.value;
      int size = list.size();
      res.getWriter().println("<pre>");
      for (int i = 0; i < size; i++) {
        SSysOperators opers = (SSysOperators) list.get(i);
        res.getWriter().println(i + ":" + opers.get_loginName());
      }
      res.getWriter().println("<a href=\"./index.html\">返回首页</a></script>");
    } catch (Exception e) {
      // TODO Auto-generated catch block
      try {
        e.printStackTrace(res.getWriter());
      } catch (IOException e1) {
        e1.printStackTrace();
      }
    }
  }
Beispiel #2
0
  /**
   * 超时测试
   *
   * @param req
   * @param res
   */
  public static void asyncTimeout(HttpServletRequest req, HttpServletResponse res) {
    IAsyncMgntInt iAsyncMgntInt = new IAsyncMgntInt();
    iAsyncMgntInt.setAsyncCall(true); // 标志异步调用
    iAsyncMgntInt.setTimeout(10000);
    SSysOperatorsListHolder holder = new SSysOperatorsListHolder();
    CBSErrorMsg errMsg = new CBSErrorMsg();
    try {

      int result = iAsyncMgntInt.select_sysOperators_timeout(holder, errMsg); // 获取响应结果

      SSysOperatorsList list = holder.value;
      int size = list.size();
      res.getWriter().println("<a href=\"./index.html\">返回首页</a><br>");
      res.getWriter().println("<pre>");
      for (int i = 0; i < size; i++) {
        SSysOperators opers = (SSysOperators) list.get(i);
        res.getWriter().println(i + ":" + opers.get_loginName());
      }
      res.getWriter().println("<a href=\"./index.html\">返回首页</a><br>");
    } catch (Exception e) {
      try {
        res.getWriter().println("<pre>");
        e.printStackTrace(res.getWriter());
      } catch (IOException e1) {
        e1.printStackTrace();
      }
    }
  }
Beispiel #3
0
 /**
  * 发起同步请求,获取后台信息,直接显示在页面上
  *
  * @param req
  * @param res
  */
 public static void sync(HttpServletRequest req, HttpServletResponse res) {
   System.setProperty("0", "aaaaaaaa");
   //		h.put(i+"","aaaaaaaaaaaaaaaaaaaaaaaa");
   //		i++;
   //		System.out.println("*************************system prop is " +
   // System.getProperties());
   IAsyncMgntInt iAsyncMgntInt = new IAsyncMgntInt();
   SSysOperatorsListHolder holder = new SSysOperatorsListHolder();
   CBSErrorMsg errMsg = new CBSErrorMsg();
   try {
     res.getWriter().println("<a href=\"./index.html\">返回首页</a></script>");
     int result = iAsyncMgntInt.select_sysOperators(holder, errMsg);
     System.out.println("*****result is " + result);
     if (result != 0) {
       res.getWriter().println(errMsg.get_errorMsg() + ":" + errMsg.get_errorCode());
     }
     SSysOperatorsList list = holder.value;
     int size = list.size();
     res.getWriter().println("<pre>");
     for (int i = 0; i < size; i++) {
       SSysOperators opers = (SSysOperators) list.get(i);
       res.getWriter().println(i + ":" + opers.get_loginName());
     }
     res.getWriter().println("<a href=\"./index.html\">返回首页</a></script>");
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Beispiel #4
0
  public static void asyncSubscribeResult(HttpServletRequest req, HttpServletResponse res) {

    try {
      String mseq = req.getParameter("mseq");
      HttpSession session = req.getSession(false);
      SSysOperatorsList list = (SSysOperatorsList) req.getSession(false).getAttribute(mseq);
      int size = list.size();
      res.getWriter().println("<a href=\"./index.html\">返回首页</a><br>");
      res.getWriter().println("<pre>");
      for (int i = 0; i < size; i++) {
        SSysOperators opers = (SSysOperators) list.get(i);
        res.getWriter().println(i + ":" + opers.get_loginName());
      }
      res.getWriter().println("<a href=\"./index.html\">返回首页</a><br>");
    } catch (Exception e) {
      try {
        res.getWriter().println("<pre>");
        e.printStackTrace(res.getWriter());
      } catch (IOException e1) {
        e1.printStackTrace();
      }
    }
  }