示例#1
0
  /** @param wapp the Web application (or null if not available yet) */
  private void sessionTimeout(
      HttpServletRequest request, HttpServletResponse response, WebApp wapp, String dtid)
      throws ServletException, IOException {
    final String sid = request.getHeader("ZK-SID");
    if (sid != null) response.setHeader("ZK-SID", sid);

    final AuWriter out = AuWriters.newInstance().open(request, response, 0);

    if (!getAuDecoder(wapp).isIgnorable(request, wapp)) {
      final String deviceType = getDeviceType(request);
      URIInfo ui =
          wapp != null ? (URIInfo) wapp.getConfiguration().getTimeoutURI(deviceType) : null;
      String uri = ui != null ? ui.uri : null;
      out.write(new AuConfirmClose(null)); // Bug: B50-3147382
      final AuResponse resp;
      if (uri != null) {
        if (uri.length() != 0) uri = Encodes.encodeURL(getServletContext(), request, response, uri);
        resp = new AuSendRedirect(uri, null);
      } else {
        String msg = wapp.getConfiguration().getTimeoutMessage(deviceType);
        if (msg != null && msg.startsWith("label:")) {
          final String key;
          msg = Labels.getLabel(key = msg.substring(6), new Object[] {dtid});
          if (msg == null) log.warning("Label not found, " + key);
        }
        if (msg == null) msg = Messages.get(MZk.UPDATE_OBSOLETE_PAGE, dtid);
        resp = new AuObsolete(dtid, msg);
      }
      out.write(resp);
    }

    out.close(request, response);
  }
示例#2
0
 /** Generates a response for an error message. */
 private static void responseError(
     HttpServletRequest request, HttpServletResponse response, String errmsg) throws IOException {
   // Don't use sendError because Browser cannot handle UTF-8
   AuWriter out = AuWriters.newInstance().open(request, response, 0);
   out.write(new AuAlert(errmsg));
   out.close(request, response);
 }
示例#3
0
文件: AuRedirect.java 项目: apextw/zk
 public void service(HttpServletRequest request, HttpServletResponse response, String pi)
     throws ServletException, IOException {
   String redirectUrl = request.getParameter(REDIRECT_URL_PARAMETER);
   AuSendRedirect auSendRedirect = new AuSendRedirect(redirectUrl, null);
   AuWriter auWriter = AuWriters.newInstance();
   auWriter.open(request, response);
   auWriter.write(auSendRedirect);
   auWriter.close(request, response);
 }