Package org.zkoss.zk.ui

Examples of org.zkoss.zk.ui.Session


    if (log.debugable()) log.debug("Content to filter:\n"+content);

    final WebManager webman = WebManager.getWebManager(_ctx);
    final WebApp wapp = webman.getWebApp();
    final WebAppCtrl wappc = (WebAppCtrl)wapp;
    final Session sess = webman.getSession(_ctx, request);
    final Object old = I18Ns.setup(sess, request, response, _charset);
    try {
      final String path = Https.getThisServletPath(request);
      final Desktop desktop =
        webman.getDesktop(sess, request, response, path, true);
View Full Code Here


    sb.append(value); //no escape, so use with care
    if (quote) sb.append('\'');
  }

  private static final String outZkIconJS() {
    final Session sess = Sessions.getCurrent();
    if (sess != null) {
      final PI pi = (PI)sess.getAttribute("_zk.pi");
      boolean show = pi == null;
      if (show) sess.setAttribute("_zk.pi", new PI());
      else show = pi.show();

      if (show)
        return "zk.pi=1;";
    }
View Full Code Here

      else
        updateURI = DHtmlLayoutServlet.fixUpdateURI(updateURI, ATTR);
      webman = new WebManager(ctx, updateURI);
    }

    final Session sess = WebManager.getSession(ctx, request);
    final WebApp wapp = sess.getWebApp();
    final WebAppCtrl wappc = (WebAppCtrl)wapp;
    final Object old = I18Ns.setup(sess, request, response,
      wapp.getConfiguration().getResponseCharset());
    Execution exec = null;
    try {
      final Desktop desktop = webman.getDesktop(sess, request, response, path, true);
      if (desktop == null) //forward or redirect
        return;

      final RequestInfo ri = new RequestInfoImpl(
        wapp, sess, desktop, request,
        PageDefinitions.getLocator(wapp, path));
      sess.setAttribute(Attributes.GAE_FIX, new Integer(0));
      ((SessionCtrl)sess).notifyClientRequest(true);

      final UiFactory uf = wappc.getUiFactory();
      final Richlet richlet = new StandaloneRichlet(comp);
View Full Code Here

          }
        }
      }
    }

    final Session sess = getSession(request);
    if (!SessionsCtrl.requestEnter(sess)) {
      handleError(sess, request, response, path, null,
        Messages.get(MZk.TOO_MANY_REQUESTS));
      return;
    }
View Full Code Here

  /** Returns the session. */
  private Session getSession(RenderRequest request)
  throws PortletException {
    final WebApp wapp = getWebManager().getWebApp();
    final PortletSession psess = request.getPortletSession();
    final Session sess = SessionsCtrl.getSession(wapp, psess);
    return sess != null ? sess:
      SessionsCtrl.newSession(wapp, psess, request);
  }
View Full Code Here

    return hsess != null ? getSession(ctx, hsess, request): null;
  }
  private static final Session getSession(ServletContext ctx,
  HttpSession hsess, HttpServletRequest request) {
    final WebApp wapp = getWebManager(ctx).getWebApp();
    final Session sess = SessionsCtrl.getSession(wapp, hsess);
    return sess != null ? sess:
      SessionsCtrl.newSession(wapp, hsess, request);
  }
View Full Code Here

  void sessionDestroyed(HttpSession hsess) {
    //Under JBoss, the servlet might be destroyed before this callback
    final WebManager webman = getWebManagerIfAny(hsess.getServletContext());
    if (webman != null) {
      final WebApp wapp = webman.getWebApp();
      final Session sess = (Session)SessionsCtrl.getSession(wapp, hsess);
      if (sess != null)
        ((WebAppCtrl)wapp).sessionDestroyed(sess);
    }
  }
View Full Code Here

  /** Retrieves the media from {@link DynamicMedia#getMedia}.
   */
  public void service(HttpServletRequest request, HttpServletResponse response, String pi)
  throws ServletException, IOException {
//    if (D.ON && log.debugable()) log.debug("View "+pi);
    final Session sess = Sessions.getCurrent(false);
    if (sess == null) {
      response.sendError(response.SC_GONE, Messages.get(MZk.PAGE_NOT_FOUND, pi));
      return;
    }

    int j = pi.indexOf('/', 1) + 1;
    int k = pi.indexOf('/', j);
    if (j <= 0 || k <= 0)
      throw new ServletException("Wrong path info: "+pi);

    final String dtid = pi.substring(j, k);
    final int l = pi.indexOf('/', ++k);
    final String uuid = l >= 0 ? pi.substring(k, l): pi.substring(k);

    Media media;
    boolean download = false;
    try {
      final WebApp wapp = sess.getWebApp();
      final WebAppCtrl wappc = (WebAppCtrl)wapp;
      final UiEngine uieng = wappc.getUiEngine();
      final Desktop desktop = wappc.getDesktopCache(sess).getDesktop(dtid);
      final DesktopCtrl desktopCtrl = (DesktopCtrl)desktop;

View Full Code Here

        SessionsCtrl.setCurrent(new SessionResolverImpl(_ctx, request));
        //it might be created later
      }

      WebApp wapp;
      Session sess;
      final Object old = hsess != null?
        (wapp = WebManager.getWebAppIfAny(_ctx)) != null &&
        (sess = SessionsCtrl.getSession(wapp, hsess)) != null ?
          I18Ns.setup(sess, request, response, "UTF-8"):
          I18Ns.setup(hsess, request, response, "UTF-8"):
        Charsets.setup(null, request, response, "UTF-8");
      try {
        cwr.service(request, response,
            pi.substring(ClassWebResource.PATH_PREFIX.length()));
      } finally {
        if (hsess != null) I18Ns.cleanup(request, old);
        else {
          Charsets.cleanup(request, old);
          SessionsCtrl.setRawCurrent(oldsess);
        }
      }
      return; //done
    }

    final Session sess = WebManager.getSession(_ctx, request, false);
    if (withpi) {
      final AuExtension aue = getAuExtensionByPath(pi);
      if (aue == null) {
        response.sendError(response.SC_NOT_FOUND);
        log.debug("Unknown path info: "+pi);
View Full Code Here

  /** Processes a file uploaded from the client.
   */
  public void service(
  HttpServletRequest request, HttpServletResponse response, String pathInfo)
  throws ServletException, IOException {
    final Session sess = Sessions.getCurrent(false);
    if (sess == null) {
      response.setIntHeader("ZK-Error", HttpServletResponse.SC_GONE);
      return;
    }

    final Map attrs = new HashMap();
    String alert = null, uuid = null, nextURI = null, sid = null;
    Desktop desktop = null;
    try {
      if (!isMultipartContent(request)) {
        if ("uploadInfo".equals(request.getParameter("cmd"))) {
          uuid = request.getParameter("wid");
          sid = request.getParameter("sid");
          desktop = ((WebAppCtrl)sess.getWebApp()).getDesktopCache(sess).getDesktop(request.getParameter("dtid"));
          Map precent = (Map) desktop.getAttribute(Attributes.UPLOAD_PERCENT);
          Map size = (Map)desktop.getAttribute(Attributes.UPLOAD_SIZE);
          final String key = uuid + '_' + sid;
          Object sinfo = size.get(key);
          if (sinfo instanceof String) {
            response.getWriter().append("error:" + sinfo);
            size.remove(key);
            precent.remove(key);
            return;
          }
          final Integer p = (Integer)precent.get(key);
          final Long cb = (Long)sinfo;
          response.getWriter().append((p != null ? p.intValue(): -1)+ ","
                +(cb != null ? cb.longValue(): -1));
          return;
        } else
          alert = "enctype must be multipart/form-data";
      } else {
        uuid = request.getParameter("uuid");
        sid = request.getParameter("sid");
        if (uuid == null || uuid.length() == 0) {
          alert = "uuid is required!";
        } else {
          attrs.put("uuid", uuid);
          attrs.put("sid", sid);

          final String dtid = request.getParameter("dtid");
          if (dtid == null || dtid.length() == 0) {
            alert = "dtid is required!";
          } else {
            desktop = ((WebAppCtrl)sess.getWebApp())
              .getDesktopCache(sess).getDesktop(dtid);
            final Map params = parseRequest(request, desktop, uuid + '_' + sid);
            nextURI = (String)params.get("nextURI");
           
            // Bug 3054784
View Full Code Here

TOP

Related Classes of org.zkoss.zk.ui.Session

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.