Package org.apache.wicket.protocol.http

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


   *
   */
  public void test_2()
  {
    tester.setupRequestAndResponse();
    WebRequestCycle cycle = tester.createRequestCycle();
    cycle.getSession().setLocale(Locale.GERMANY);
    TestPage page = new TestPage()
    {
      private static final long serialVersionUID = 1L;

      public String getVariation()
View Full Code Here


    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

    tester.getApplication().mount(
        new IndexedParamUrlCodingStrategy("/test2", BookmarkableHomePageLinksPage.class,
            "mypagemap"));

    tester.setupRequestAndResponse();
    WebRequestCycle cycle = tester.createRequestCycle();

    PageParameters parameters = new PageParameters();
    parameters.add("0", "Integer0");
    parameters.add("1", "Integer1");
    parameters.add("2", "a:b");

    String url1 = cycle.urlFor(
        new BookmarkablePageRequestTarget(BookmarkableHomePageLinksPage.class, parameters))
        .toString();
    String url2 = cycle.urlFor(
        new BookmarkablePageRequestTarget("mypagemap", BookmarkableHomePageLinksPage.class,
            parameters)).toString();
    assertEquals("test1/Integer0/Integer1/a%3Ab", url1);
    assertEquals("test2/Integer0/Integer1/a%3Ab/wicket:pageMapName/mypagemap", url2);

    tester.setupRequestAndResponse();
    tester.getServletRequest().setURL("/WicketTester$DummyWebApplication/WicketTester$DummyWebApplication/" + url1);
    cycle = tester.createRequestCycle();
    IRequestCodingStrategy encoder = cycle.getProcessor().getRequestCodingStrategy();

    RequestParameters requestParameters = encoder.decode(tester.getWicketRequest());

    IRequestTarget target1 = cycle.getProcessor().resolve(cycle, requestParameters);
    if (target1 instanceof BookmarkablePageRequestTarget)
    {
      assertNull(((BookmarkablePageRequestTarget)target1).getPageMapName());
    }
    else
    {
      fail("url: " + url1 + " wasn't resolved to a bookmarkable target: " + target1);
    }
    PageParameters params = ((BookmarkablePageRequestTarget)target1).getPageParameters();
    assertEquals("Integer0", params.getString("0"));
    assertEquals("Integer1", params.getString("1"));
    assertEquals("a:b", params.getString("2"));

    tester.setupRequestAndResponse();
    tester.getServletRequest().setURL("/WicketTester$DummyWebApplication/WicketTester$DummyWebApplication/" + url2);
    cycle = tester.createRequestCycle();
    encoder = cycle.getProcessor().getRequestCodingStrategy();

    requestParameters = encoder.decode(tester.getWicketRequest());

    IRequestTarget target2 = cycle.getProcessor().resolve(cycle, requestParameters);

    if (target2 instanceof BookmarkablePageRequestTarget)
    {
      assertEquals("mypagemap", ((BookmarkablePageRequestTarget)target2).getPageMapName());
    }
View Full Code Here

   *
   */
  public void test1()
  {
    tester.setupRequestAndResponse();
    WebRequestCycle cycle = tester.createRequestCycle();

    TestPage page = new TestPage();
    Form form = (Form)page.get("form1");
    assertNotNull(form);

View Full Code Here

   */
  public void test2()
  {
    tester.getApplication().getResourceSettings().setThrowExceptionOnMissingResource(false);
    tester.setupRequestAndResponse();
    WebRequestCycle cycle = tester.createRequestCycle();

    String str = tester.getApplication().getResourceSettings().getLocalizer().getString("XXX",
        null);
    assertEquals("[Warning: String resource for 'XXX' not found]", str);
  }
View Full Code Here

   */
  public void test3()
  {
    tester.getApplication().getResourceSettings().setThrowExceptionOnMissingResource(true);
    tester.setupRequestAndResponse();
    WebRequestCycle cycle = tester.createRequestCycle();

    boolean hit = false;
    try
    {
      tester.getApplication().getResourceSettings().getLocalizer().getString("XXX", null);
View Full Code Here

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


    };
    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

       */
      protected void onSubmit()
      {
        ClientPropertiesBean propertiesBean = (ClientPropertiesBean)getModelObject();

        WebRequestCycle requestCycle = (WebRequestCycle)getRequestCycle();
        WebSession session = (WebSession)getSession();
        ClientInfo clientInfo = session.getClientInfo();

        if (clientInfo == null)
        {
View Full Code Here

    {
      throw new IllegalArgumentException("parameter cto must be provided!");
    }
    setContinueTo(to);
    initComps();
    WebRequestCycle requestCycle = (WebRequestCycle)getRequestCycle();
    WebSession session = (WebSession)getSession();
    ClientInfo clientInfo = session.getClientInfo();
    if (clientInfo == null)
    {
      clientInfo = new WebClientInfo(requestCycle);
View Full Code Here

TOP

Related Classes of org.apache.wicket.protocol.http.WebRequestCycle

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.