Package org.apache.wicket.request.cycle

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


   */
  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

    final RenderPageRequestHandler handler = new RenderPageRequestHandler(new PageProvider(
      pageClass, parameters), RedirectPolicy.NEVER_REDIRECT);

    final PageRenderer pageRenderer = getApplication().getPageRendererProvider().get(handler);

    RequestCycle requestCycle = getRequestCycle();

    final Response oldResponse = requestCycle.getResponse();
    BufferedWebResponse tempResponse = new BufferedWebResponse(null);

    try
    {
      requestCycle.setResponse(tempResponse);
      pageRenderer.respond(requestCycle);
    }
    finally
    {
      requestCycle.setResponse(oldResponse);
    }

    return tempResponse.getText();
  }
View Full Code Here

   *            the panel that should be rendered.
   * @return the html rendered by the panel
   */
  private CharSequence renderPanel(final Panel panel)
  {
    RequestCycle requestCycle = getRequestCycle();

    final Response oldResponse = requestCycle.getResponse();
    BufferedWebResponse tempResponse = new BufferedWebResponse(null);

    try
    {
      requestCycle.setResponse(tempResponse);

      DummyPage page = new DummyPage();
      page.add(panel);

      panel.render();
    }
    finally
    {
      requestCycle.setResponse(oldResponse);
    }

    return tempResponse.getText();
  }
View Full Code Here

            {
                return null;
            }
        };

        RequestCycle requestCycle = mock(RequestCycle.class);
        when(requestCycle.urlFor(any(IRequestHandler.class))).thenReturn(RESOURCE_NAME);

        Request request = mock(Request.class);
        when(request.getCharset()).thenReturn(Charset.defaultCharset());
        when(requestCycle.getRequest()).thenReturn(request);

        UrlRenderer urlRenderer = mock(UrlRenderer.class);
        when(urlRenderer.renderContextRelativeUrl((any(String.class)))).thenReturn(RESOURCE_NAME);
        when(requestCycle.getUrlRenderer()).thenReturn(urlRenderer);

        ThreadContext.setRequestCycle(requestCycle);
    }
View Full Code Here

      @Override
      protected void onSubmit()
      {
        ClientPropertiesBean propertiesBean = getModelObject();

        RequestCycle requestCycle = getRequestCycle();
        WebSession session = getWebSession();
        WebClientInfo clientInfo = session.getClientInfo();

        if (clientInfo == null)
        {
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

  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

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.