Search in sources :

Example 1 with ContextRelativeResource

use of org.apache.wicket.request.resource.ContextRelativeResource in project wicket by apache.

the class ContextRelativeResourceCachingTest method mapHandler.

/**
 */
@Test
public void mapHandler() {
    ContextRelativeResource resource = new ContextRelativeResource("/style.css");
    init(resource, "/test/resource");
    Request request = createRequest("test/resource-version-123?bla=4567");
    final IRequestHandler handler = tester.getApplication().getRootRequestMapper().mapRequest(request);
    assertThat(handler, instanceOf(ResourceReferenceRequestHandler.class));
    assertEquals(((ResourceReferenceRequestHandler) handler).getResource(), resource);
}
Also used : ResourceReferenceRequestHandler(org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler) IRequestHandler(org.apache.wicket.request.IRequestHandler) Request(org.apache.wicket.request.Request) ContextRelativeResource(org.apache.wicket.request.resource.ContextRelativeResource) Test(org.junit.Test)

Example 2 with ContextRelativeResource

use of org.apache.wicket.request.resource.ContextRelativeResource in project wicket by apache.

the class ContextRelativeResourceCachingTest method mapRequest.

/**
 */
@Test
public void mapRequest() {
    ContextRelativeResource resource = new ContextRelativeResource("/style.css");
    init(resource, "/test/resource");
    IRequestHandler handler = new ResourceReferenceRequestHandler(new SharedResourceReference(SHARED_NAME));
    Url url = tester.getApplication().getRootRequestMapper().mapHandler(handler);
    assertNotNull(url);
    assertEquals(url, Url.parse("test/resource-version-123"));
}
Also used : ResourceReferenceRequestHandler(org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler) SharedResourceReference(org.apache.wicket.request.resource.SharedResourceReference) IRequestHandler(org.apache.wicket.request.IRequestHandler) ContextRelativeResource(org.apache.wicket.request.resource.ContextRelativeResource) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Aggregations

IRequestHandler (org.apache.wicket.request.IRequestHandler)2 ResourceReferenceRequestHandler (org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler)2 ContextRelativeResource (org.apache.wicket.request.resource.ContextRelativeResource)2 Test (org.junit.Test)2 Request (org.apache.wicket.request.Request)1 Url (org.apache.wicket.request.Url)1 SharedResourceReference (org.apache.wicket.request.resource.SharedResourceReference)1