use of org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler in project wicket by apache.
the class BasicResourceReferenceMapperTest method decode10.
/**
*/
@Test
public void decode10() {
Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference6?en-style-variation&p1=v1&p2=v2");
IRequestHandler handler = encoder.mapRequest(getRequest(url));
assertThat(handler, instanceOf(ResourceReferenceRequestHandler.class));
ResourceReferenceRequestHandler h = (ResourceReferenceRequestHandler) handler;
assertEquals(resource6, h.getResource());
assertEquals(Locale.ENGLISH, h.getLocale());
assertEquals("style", h.getStyle());
assertEquals("variation", h.getVariation());
assertEquals(0, h.getPageParameters().getIndexedCount());
assertEquals("v1", h.getPageParameters().get("p1").toString());
assertEquals("v2", h.getPageParameters().get("p2").toString());
}
use of org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler in project wicket by apache.
the class BasicResourceReferenceMapperTest method decode3.
/**
*/
@Test
public void decode3() {
Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference2/name2?en_EN");
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(0, h.getPageParameters().getIndexedCount());
assertEquals(0, h.getPageParameters().getNamedKeys().size());
}
use of org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler in project wicket by apache.
the class CryptoMapperTest method urlResourceReference.
/**
* UrlResourceReferences, WICKET-5319
*/
@Test
public void urlResourceReference() {
UrlResourceReference resource = new UrlResourceReference(Url.parse("http://wicket.apache.org/"));
Url url = mapper.mapHandler(new ResourceReferenceRequestHandler(resource));
assertEquals("http://wicket.apache.org/", url.toString(StringMode.FULL));
}
use of org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler in project wicket by apache.
the class CryptoMapperTest method resourceReference.
/**
* Relative ResourceReferences, WICKET-3514
*/
@Test
public void resourceReference() {
PackageResourceReference resource = new PackageResourceReference(getClass(), "crypt/crypt.txt");
Url url = mapper.mapHandler(new ResourceReferenceRequestHandler(resource));
Request request = getRequest(url);
IRequestHandler requestHandler = mapper.mapRequest(request);
assertNotNull(requestHandler);
requestHandler = unwrapRequestHandlerDelegate(requestHandler);
assertThat(requestHandler, instanceOf(ResourceReferenceRequestHandler.class));
ResourceReferenceRequestHandler handler = (ResourceReferenceRequestHandler) requestHandler;
assertEquals(getClass(), handler.getResourceReference().getScope());
assertEquals("crypt/crypt.txt", handler.getResourceReference().getName());
}
use of org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler in project wicket by apache.
the class CryptoMapperTest method resourceReferenceWithLessSegments.
/**
* Relative ResourceReferences, WICKET-3514
*/
@Test
public void resourceReferenceWithLessSegments() {
PackageResourceReference resource = new PackageResourceReference(getClass(), "crypt/crypt.txt");
Url url = mapper.mapHandler(new ResourceReferenceRequestHandler(resource));
url.getSegments().remove(url.getSegments().size() - 1);
url.getSegments().remove(url.getSegments().size() - 1);
url.getSegments().add("less-crypt.txt");
Request request = getRequest(url);
IRequestHandler requestHandler = mapper.mapRequest(request);
assertNotNull(requestHandler);
requestHandler = unwrapRequestHandlerDelegate(requestHandler);
assertThat(requestHandler, instanceOf(ResourceReferenceRequestHandler.class));
ResourceReferenceRequestHandler handler = (ResourceReferenceRequestHandler) requestHandler;
assertEquals(getClass(), handler.getResourceReference().getScope());
assertEquals("less-crypt.txt", handler.getResourceReference().getName());
}
Aggregations