Package org.apache.wicket.request.cycle

Examples of org.apache.wicket.request.cycle.RequestCycle


    Session session = ThreadContext.getSession();

    if (session == null)
    {
      // no session is available via ThreadContext, so lookup in session store
      RequestCycle requestCycle = RequestCycle.get();
      if (requestCycle != null)
      {
        session = Application.get().getSessionStore().lookup(requestCycle.getRequest());
        if (session != null)
        {
          ThreadContext.setSession(session);
        }
      }
View Full Code Here


   */
  public final String getId()
  {
    if (id == null)
    {
      RequestCycle requestCycle = RequestCycle.get();
      if (requestCycle != null)
      {
        id = getSessionStore().getSessionId(requestCycle.getRequest(), false);
      }
      // we have one?
      if (id != null)
      {
        dirty();
View Full Code Here

   */
  public final Serializable getAttribute(final String name)
  {
    if (!isTemporary())
    {
      RequestCycle cycle = RequestCycle.get();
      if (cycle != null)
      {
        return getSessionStore().getAttribute(cycle.getRequest(), name);
      }
    }
    else
    {
      if (temporarySessionAttributes != null)
View Full Code Here

   */
  public final List<String> getAttributeNames()
  {
    if (!isTemporary())
    {
      RequestCycle cycle = RequestCycle.get();
      if (cycle != null)
      {
        return Collections.unmodifiableList(getSessionStore().getAttributeNames(
          cycle.getRequest()));
      }
    }
    else
    {
      if (temporarySessionAttributes != null)
View Full Code Here

   */
  public final void removeAttribute(String name)
  {
    if (!isTemporary())
    {
      RequestCycle cycle = RequestCycle.get();
      if (cycle != null)
      {
        getSessionStore().removeAttribute(cycle.getRequest(), name);
      }
    }
    else
    {
      if (temporarySessionAttributes != null)
View Full Code Here

   */
  public final void setAttribute(String name, Serializable value)
  {
    if (!isTemporary())
    {
      RequestCycle cycle = RequestCycle.get();
      if (cycle == null)
      {
        throw new IllegalStateException(
          "Cannot set the attribute: no RequestCycle available.  If you get this error when using WicketTester.startPage(Page), make sure to call WicketTester.createRequestCycle() beforehand.");
      }

      ISessionStore store = getSessionStore();
      Request request = cycle.getRequest();

      // extra check on session binding event
      if (value == this)
      {
        Object current = store.getAttribute(request, name);
View Full Code Here

  public final void onRequest()
  {
    WebApplication app = (WebApplication)getComponent().getApplication();
    AjaxRequestTarget target = app.newAjaxRequestTarget(getComponent().getPage());

    RequestCycle requestCycle = RequestCycle.get();
    requestCycle.scheduleRequestHandlerAfterCurrent(target);

    respond(target);
  }
View Full Code Here

      header = new AjaxHtmlHeaderContainer(this);
      final Page parentPage = component.getPage();
      parentPage.addOrReplace(header);
    }

    RequestCycle requestCycle = component.getRequestCycle();

    // save old response, set new
    Response oldResponse = requestCycle.setResponse(encodingHeaderResponse);

    try {
      encodingHeaderResponse.reset();

      // render the head of component and all it's children

      component.renderHead(header);

      if (component instanceof MarkupContainer)
      {
        ((MarkupContainer)component).visitChildren(new IVisitor<Component, Void>()
        {
          @Override
          public void component(final Component component, final IVisit<Void> visit)
          {
            if (component.isVisibleInHierarchy())
            {
              component.renderHead(header);
            }
            else
            {
              visit.dontGoDeeper();
            }
          }
        });
      }
    } finally {
      // revert to old response
      requestCycle.setResponse(oldResponse);
    }

    writeHeaderContribution(response);

    headerRendering = false;
View Full Code Here

  /**
   * @return The request for this component's active request cycle
   */
  public final Request getRequest()
  {
    RequestCycle requestCycle = getRequestCycle();
    if (requestCycle == null)
    {
      // Happens often with WicketTester when one forgets to call
      // createRequestCycle()
      throw new WicketRuntimeException("No RequestCycle is currently set!");
    }
    return requestCycle.getRequest();
  }
View Full Code Here

  {
    super.renderHead(component, response);

    CoreLibrariesContributor.contributeAjax(component.getApplication(), response);

    RequestCycle requestCycle = component.getRequestCycle();
    Url baseUrl = requestCycle.getUrlRenderer().getBaseUrl();
    CharSequence ajaxBaseUrl = Strings.escapeMarkup(baseUrl.toString());
    response.render(JavaScriptHeaderItem.forScript("Wicket.Ajax.baseUrl=\"" + ajaxBaseUrl +
      "\";", "wicket-ajax-base-url"));

    renderExtraHeaderContributors(component, response);
View Full Code Here

TOP

Related Classes of org.apache.wicket.request.cycle.RequestCycle

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.