Search in sources :

Example 26 with IRequestHandler

use of org.apache.wicket.request.IRequestHandler in project wicket by apache.

the class BasicResourceReferenceMapperTest method decode6.

/**
 */
@Test
public void decode6() {
    Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference3?-style&p1=v1&p2=v2");
    IRequestHandler handler = encoder.mapRequest(getRequest(url));
    assertThat(handler, instanceOf(ResourceReferenceRequestHandler.class));
    ResourceReferenceRequestHandler h = (ResourceReferenceRequestHandler) handler;
    assertEquals(resource3, h.getResource());
    assertEquals(null, h.getLocale());
    assertEquals("style", h.getStyle());
    assertEquals(null, h.getVariation());
    assertEquals(0, h.getPageParameters().getIndexedCount());
    assertEquals("v1", h.getPageParameters().get("p1").toString());
    assertEquals("v2", h.getPageParameters().get("p2").toString());
}
Also used : ResourceReferenceRequestHandler(org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler) IRequestHandler(org.apache.wicket.request.IRequestHandler) ResourceUrl(org.apache.wicket.request.resource.caching.ResourceUrl) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Example 27 with IRequestHandler

use of org.apache.wicket.request.IRequestHandler in project wicket by apache.

the class BasicResourceReferenceMapperTest method decode1.

/**
 */
@Test
public void decode1() {
    Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference1");
    IRequestHandler handler = encoder.mapRequest(getRequest(url));
    assertThat(handler, instanceOf(ResourceReferenceRequestHandler.class));
    ResourceReferenceRequestHandler h = (ResourceReferenceRequestHandler) handler;
    assertEquals(resource1, h.getResource());
    assertEquals(0, h.getPageParameters().getIndexedCount());
    assertEquals(0, h.getPageParameters().getNamedKeys().size());
}
Also used : ResourceReferenceRequestHandler(org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler) IRequestHandler(org.apache.wicket.request.IRequestHandler) ResourceUrl(org.apache.wicket.request.resource.caching.ResourceUrl) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Example 28 with IRequestHandler

use of org.apache.wicket.request.IRequestHandler in project wicket by apache.

the class BasicResourceReferenceMapperTest method decode2.

/**
 */
@Test
public void decode2() {
    Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference1?p1=v1&p2=v2");
    IRequestHandler handler = encoder.mapRequest(getRequest(url));
    assertThat(handler, instanceOf(ResourceReferenceRequestHandler.class));
    ResourceReferenceRequestHandler h = (ResourceReferenceRequestHandler) handler;
    assertEquals(resource1, h.getResource());
    assertEquals(null, h.getLocale());
    assertEquals(null, h.getStyle());
    assertEquals(null, h.getVariation());
    assertEquals(0, h.getPageParameters().getIndexedCount());
    assertEquals("v1", h.getPageParameters().get("p1").toString());
    assertEquals("v2", h.getPageParameters().get("p2").toString());
}
Also used : ResourceReferenceRequestHandler(org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler) IRequestHandler(org.apache.wicket.request.IRequestHandler) ResourceUrl(org.apache.wicket.request.resource.caching.ResourceUrl) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Example 29 with IRequestHandler

use of org.apache.wicket.request.IRequestHandler in project wicket by apache.

the class BasicResourceReferenceMapperTest method wicket3918.

/**
 * Tests <a href="https://issues.apache.org/jira/browse/WICKET-3918">WICKET-3918</a>.
 */
@Test
public void wicket3918() {
    Url url = Url.parse("wicket/resource/org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow/res/");
    IRequestHandler handler = encoder.mapRequest(getRequest(url));
    assertNull(handler);
}
Also used : IRequestHandler(org.apache.wicket.request.IRequestHandler) ResourceUrl(org.apache.wicket.request.resource.caching.ResourceUrl) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Example 30 with IRequestHandler

use of org.apache.wicket.request.IRequestHandler in project wicket by apache.

the class BasicResourceReferenceMapperTest method decode4.

/**
 */
@Test
public void decode4() {
    Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference2/name2?en_EN&p1=v1&p2=v2");
    IRequestHandler handler = encoder.mapRequest(getRequest(url));
    assertThat(handler, instanceOf(ResourceReferenceRequestHandler.class));
    ResourceReferenceRequestHandler h = (ResourceReferenceRequestHandler) handler;
    assertEquals(resource2, h.getResource());
    assertEquals(new Locale("en", "en"), h.getLocale());
    assertEquals(null, h.getStyle());
    assertEquals(null, h.getVariation());
    assertEquals("v1", h.getPageParameters().get("p1").toString());
    assertEquals("v2", h.getPageParameters().get("p2").toString());
}
Also used : Locale(java.util.Locale) ResourceReferenceRequestHandler(org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler) IRequestHandler(org.apache.wicket.request.IRequestHandler) ResourceUrl(org.apache.wicket.request.resource.caching.ResourceUrl) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Aggregations

IRequestHandler (org.apache.wicket.request.IRequestHandler)188 Test (org.junit.Test)159 Url (org.apache.wicket.request.Url)138 RenderPageRequestHandler (org.apache.wicket.core.request.handler.RenderPageRequestHandler)65 IRequestablePage (org.apache.wicket.request.component.IRequestablePage)47 PageProvider (org.apache.wicket.core.request.handler.PageProvider)45 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)36 IPageProvider (org.apache.wicket.core.request.handler.IPageProvider)32 BookmarkableListenerRequestHandler (org.apache.wicket.core.request.handler.BookmarkableListenerRequestHandler)28 ListenerRequestHandler (org.apache.wicket.core.request.handler.ListenerRequestHandler)25 Request (org.apache.wicket.request.Request)25 MockPage (org.apache.wicket.MockPage)23 ResourceReferenceRequestHandler (org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler)20 PageAndComponentProvider (org.apache.wicket.core.request.handler.PageAndComponentProvider)17 ResourceUrl (org.apache.wicket.request.resource.caching.ResourceUrl)17 BookmarkablePageRequestHandler (org.apache.wicket.core.request.handler.BookmarkablePageRequestHandler)16 IPageRequestHandler (org.apache.wicket.core.request.handler.IPageRequestHandler)11 IRequestableComponent (org.apache.wicket.request.component.IRequestableComponent)10 RequestCycle (org.apache.wicket.request.cycle.RequestCycle)8 Page (org.apache.wicket.Page)6