Examples of WebRequestCycle


Examples of org.apache.wicket.protocol.http.WebRequestCycle

      " which matches the event: " + event;
    notNull(failMessage, ajaxEventBehavior);

    // when the requestcycle is not created via setupRequestAndResponse(true), than create a new
    // one
    WebRequestCycle requestCycle = resolveRequestCycle();
    if (!requestCycle.getWebRequest().isAjax())
    {
      throw new IllegalStateException(
        "The ServletWebRequest was created without wicket-ajax header. Please use tester.setCreateAjaxRequest(true)");
    }
View Full Code Here

Examples of org.apache.wicket.protocol.http.WebRequestCycle

   */
  protected WebRequestCycle resolveRequestCycle()
  {
    // initialize the request only if needed to allow the user to pass
    // request parameters, see WICKET-254
    WebRequestCycle requestCycle;
    if (RequestCycle.get() == null)
    {
      requestCycle = setupRequestAndResponse();
    }
    else
    {
      requestCycle = (WebRequestCycle)RequestCycle.get();

      // If a ajax request is requested but the existing is not, than we still need to create
      // a new one
      if ((requestCycle.getWebRequest().isAjax() == false) && (isCreateAjaxRequest() == true))
      {
        setParametersForNextRequest(requestCycle.getWebRequest().getParameterMap());
        requestCycle = setupRequestAndResponse();
      }
    }
    return requestCycle;
  }
View Full Code Here

Examples of org.apache.wicket.protocol.http.WebRequestCycle

    {
      baseWicketTester.getWicketSession().cleanupFeedbackMessages();

      MockHttpServletRequest servletRequest = baseWicketTester.getServletRequest();

      WebRequestCycle requestCycle = baseWicketTester.createRequestCycle();
      servletRequest.setRequestToComponent(workingForm);

      servletRequest.setUseMultiPartContentType(isMultiPart());
      baseWicketTester.processRequestCycle(requestCycle);
    }
View Full Code Here

Examples of org.apache.wicket.protocol.http.WebRequestCycle

   *            the ajax behavior to execute
   */
  public void executeBehavior(final AbstractAjaxBehavior behavior)
  {
    // setupRequestAndResponse();
    WebRequestCycle cycle = createRequestCycle();
    CharSequence url = behavior.getCallbackUrl(false);
    setupRequestAndResponse();
    cycle = createRequestCycle();
    getServletRequest().setRequestToRedirectString(url.toString());
    processRequestCycle(cycle);
View Full Code Here

Examples of org.apache.wicket.protocol.http.WebRequestCycle

    failMessage = "No AjaxEventBehavior found on component: " + component.getId()
        + " which matches the event: " + event.toString();
    notNull(failMessage, ajaxEventBehavior);

    // initialize the request only if needed to allow the user to pass request parameters, see WICKET-254
    WebRequestCycle requestCycle;
    if (RequestCycle.get() == null)
    {
      requestCycle = setupRequestAndResponse();
    }
    else
View Full Code Here

Examples of org.apache.wicket.protocol.http.WebRequestCycle

  {
    checkClosed();
    try
    {
      MockHttpServletRequest servletRequest = baseWicketTester.getServletRequest();
      WebRequestCycle requestCycle = baseWicketTester.createRequestCycle();
      servletRequest.setRequestToComponent(workingForm);

      if (servletRequest.hasUploadedFiles())
      {
        requestCycle.setRequest(new MultipartServletWebRequest(servletRequest, workingForm
            .getMaxSize()));
      }

      baseWicketTester.processRequestCycle(requestCycle);
    }
View Full Code Here

Examples of org.apache.wicket.protocol.http.WebRequestCycle

     * @see org.apache.wicket.markup.html.IHeaderContributor#renderHead(org.apache.wicket.Response)
     */
    public final void renderHead(final IHeaderResponse headResponse)
    {
      Response response = headResponse.getResponse();
      final WebRequestCycle cycle = (WebRequestCycle)RequestCycle.get();
      final IRequestTarget target = cycle.getRequestTarget();

      IPageMap pageMap = webPage.getPageMap();
      String name = pageMap.getName();
      if (name == null)
      {
        name = "wicket:default";
      }
      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
        {
          url = webPage.urlFor(INewBrowserWindowListener.INTERFACE);
        }
View Full Code Here

Examples of org.apache.wicket.protocol.http.WebRequestCycle

   */
  public void testDetachAttachNormalModel() throws Exception
  {
    StringResourceModel model = new StringResourceModel("simple.text", page, wsModel);
    tester.setupRequestAndResponse();
    RequestCycle cycle = new WebRequestCycle(tester.getApplication(),
        tester.getWicketRequest(), tester.getWicketResponse());
    model.getObject();
    Assert.assertNotNull(model.getLocalizer());
    model.detach();
    Assert.assertNull(model.getLocalizer());
View Full Code Here

Examples of org.apache.wicket.protocol.http.WebRequestCycle


    };
    StringResourceModel model = new StringResourceModel("simple.text", page, wsDetachModel);
    tester.setupRequestAndResponse();
    RequestCycle cycle = new WebRequestCycle(tester.getApplication(),
        tester.getWicketRequest(), tester.getWicketResponse());
    model.getObject();
    Assert.assertNotNull(model.getLocalizer());
    model.detach();
    // Removed this because getObject() will reattach now...
View Full Code Here

Examples of org.apache.wicket.protocol.http.WebRequestCycle

    assertEquals(((MyMockWebApplication)application.getApplication()).getLoginPage(), loginPage
        .getClass());

    // bypass form completely to login but continue to intercept page
    application.setupRequestAndResponse();
    WebRequestCycle requestCycle = application.createRequestCycle();
    assertTrue(((MockLoginPage)application.getLastRenderedPage()).login("admin"));
    application.processRequestCycle(requestCycle);
    assertEquals(application.getApplication().getHomePage(), application.getLastRenderedPage()
        .getClass());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.