Package org.apache.wicket

Examples of org.apache.wicket.Session$Counter


   */
  protected ClientInfo newClientInfo()
  {
    if (getApplication().getRequestCycleSettings().getGatherExtendedBrowserInfo())
    {
      Session session = getSession();
      if (session.getMetaData(BROWSER_WAS_POLLED_KEY) == null)
      {
        // we haven't done the redirect yet; record that we will be
        // doing that now and redirect
        session.setMetaData(BROWSER_WAS_POLLED_KEY, Boolean.TRUE);
        throw new RestartResponseAtInterceptPageException(new BrowserInfoPage(getRequest().getRelativePathPrefixToContextRoot() + getRequest().getURL()));
      }
      // if we get here, the redirect already has been done; clear
      // the meta data entry; we don't need it any longer is the client
      // info object will be cached too
      session.setMetaData(BROWSER_WAS_POLLED_KEY, (Boolean)null);
    }
    return new WebClientInfo(this);
  }
View Full Code Here


        if (active > 0)
        {
          rd.setActiveRequest(active--);
        }
      }
      Session session = Session.get();
      String sessionId = session.getId();
      rd.setSessionId(sessionId);

      Object sessionInfo = getSessionInfo(session);
      rd.setSessionInfo(sessionInfo);

      long sizeInBytes = -1;
      if (Application.get().getRequestLoggerSettings().getRecordSessionSize())
      {
        try
        {
          sizeInBytes = session.getSizeInBytes();
        }
        catch (Exception e)
        {
          // log the error and let the request logging continue (this is what happens in the
          // detach phase of the request cycle anyway. This provides better diagnostics).
View Full Code Here

  {
    HttpServletRequest httpServletRequest = ((HttpServletRequest)request);
    HttpSession httpSession = httpServletRequest.getSession(false);
    if (httpSession != null)
    {
      Session session = (Session)httpSession.getAttribute(sessionKey);
      if (session != null)
      {
        // set the session's threadlocal
        Session.set(session);
View Full Code Here

      // if there is a pagemap name specified and multiwindow support is
      // on
      if (getPageMapName() != null)
      {
        // try to find out whether the pagemap already exists
        Session session = Session.get();
        if (session.pageMapForName(getPageMapName(), false) == null)
        {
          deletePageMap = true;
        }
        parameters.setPageMapName(getPageMapName());
      }
View Full Code Here

      // should we cleanup the pagemap?
      if (deletePageMap == true)
      {
        // get the pagemap
        Session session = Session.get();
        IPageMap pageMap = session.pageMapForName(getPageMapName(), false);

        // if there is any remove it
        if (pageMap != null)
        {
          session.removePageMap(pageMap);
          deletePageMap = false;
        }
      }

      if (windowClosedCallback != null)
View Full Code Here

   *
   */
  protected Object load()
  {
    // Initialise information that we need to work successfully
    final Session session = Session.get();
    if (session != null)
    {
      this.localizer = Application.get().getResourceSettings().getLocalizer();
      this.locale = session.getLocale();
    }
    else
    {
      throw new WicketRuntimeException(
          "Cannot attach a string resource model without a Session context because that is required to get a Localizer");
View Full Code Here

      else
      {
        name = name.replace('"', '_');
      }

      Session session = Session.get();

      Session.PageMapAccessMetaData meta = (Session.PageMapAccessMetaData)session
          .getMetaData(Session.PAGEMAP_ACCESS_MDK);
      if (meta == null)
      {
        meta = new Session.PageMapAccessMetaData();
        session.setMetaData(Session.PAGEMAP_ACCESS_MDK, meta);
      }
      boolean firstAccess = meta.add(pageMap);

      if (firstAccess)
      {
        // this is the first access to the pagemap, set window.name
        JavascriptUtils.writeOpenTag(response);
        response
            .write("if (window.name=='' || window.name.indexOf('wicket') > -1) { window.name=\"");
        response.write("wicket-" + name);
        response.write("\"; }");
        JavascriptUtils.writeCloseTag(response);
      }
      else
      {
        // Here is our trickery to detect whether the current request
        // was made in a new window/ tab, in which case it should go in
        // a different page map so that we don't intermangle the history
        // of those windows
        CharSequence url = null;
        if (target instanceof IBookmarkablePageRequestTarget)
        {
          IBookmarkablePageRequestTarget current = (IBookmarkablePageRequestTarget)target;
          BookmarkablePageRequestTarget redirect = new BookmarkablePageRequestTarget(
              session.createAutoPageMapName(), current.getPageClass(), current
                  .getPageParameters());
          url = cycle.urlFor(redirect);
        }
        else
        {
View Full Code Here

    @Override
    public void put(Page page)
    {
      if (!page.isPageStateless())
      {
        Session session = getSession();
        String sessionId = session.getId();
        if (sessionId != null && !session.isSessionInvalidated())
        {
          // the id could have changed from null during request
          this.sessionId = sessionId;
          getStore().storePage(sessionId, page);
          setLastPage(page);
View Full Code Here

        if (requestParameters.isOnlyProcessIfPathActive())
        {
          // this request has indeed been flagged as
          // process-only-if-path-is-active

          Session session = Session.get();
          IPageMap pageMap = session.pageMapForName(requestParameters.getPageMapName(),
            false);
          if (pageMap == null)
          {
            // requested pagemap no longer exists - ignore this
            // request
View Full Code Here

  @SuppressWarnings("unchecked")
  protected IRequestTarget resolveBookmarkablePage(final RequestCycle requestCycle,
    final RequestParameters requestParameters)
  {
    String bookmarkablePageClass = requestParameters.getBookmarkablePageClass();
    Session session = requestCycle.getSession();
    Class<? extends Page> pageClass;
    try
    {
      pageClass = (Class<? extends Page>)session.getClassResolver().resolveClass(
        bookmarkablePageClass);
    }
    catch (ClassNotFoundException e)
    {
      return new WebErrorCodeResponseTarget(HttpServletResponse.SC_NOT_FOUND,
        "Unable to load Bookmarkable Page");
    }

    try
    {
      PageParameters params = new PageParameters(requestParameters.getParameters());
      if (requestParameters.getComponentPath() != null &&
        requestParameters.getInterfaceName() != null)
      {
        final String componentPath = requestParameters.getComponentPath();
        final Page page = session.getPage(requestParameters.getPageMapName(),
          componentPath, requestParameters.getVersionNumber());

        if (page != null && page.getClass() == pageClass)
        {
          return resolveListenerInterfaceTarget(requestCycle, page, componentPath,
View Full Code Here

TOP

Related Classes of org.apache.wicket.Session$Counter

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.