Package org.apache.wicket

Examples of org.apache.wicket.Session$PageMapAccessMetaData


   * @return the home page as a request target
   */
  protected IRequestTarget resolveHomePageTarget(final RequestCycle requestCycle,
    final RequestParameters requestParameters)
  {
    Session session = requestCycle.getSession();
    Application application = session.getApplication();
    try
    {
      // Get the home page class
      Class<? extends Page> homePageClass = application.getHomePage();

View Full Code Here


   */
  protected IRequestTarget resolveRenderedPage(final RequestCycle requestCycle,
    final RequestParameters requestParameters)
  {
    final String componentPath = requestParameters.getComponentPath();
    final Session session = requestCycle.getSession();
    final Page page = session.getPage(requestParameters.getPageMapName(), componentPath,
      requestParameters.getVersionNumber());

    // Does page exist?
    if (page != null)
    {
View Full Code Here

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

      Session session = Session.get();

      Session.PageMapAccessMetaData meta = 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 intermingle 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
  protected String load()
  {
    // Initialize information that we need to work successfully
    final Session session = Session.get();
    if (session != null)
    {
      localizer = Application.get().getResourceSettings().getLocalizer();
      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

    {
      if (active.get() > 0)
      {
        rd.setActiveRequest(active.decrementAndGet());
      }
      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
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 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);
        String url = "/" + getRequest().getURL();
        throw new RestartResponseException(new BrowserInfoPage(url));
      }
      // 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

      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 intermingle 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

   *
   */
  protected Object load()
  {
    // Initialize information that we need to work successfully
    final Session session = Session.get();
    if (session != null)
    {
      localizer = Application.get().getResourceSettings().getLocalizer();
      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

TOP

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

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.