use of org.apache.wicket.request.Request in project wicket by apache.
the class CryptoMapperTest method bookmarkablePageDecryptMultipleCryptoMapper.
/**
* Tests that encrypted URLs for bookmarkable pages are decrypted and passed to the wrapped mapper when there is more than
* one cryptomapper installed.
*/
@Test
public void bookmarkablePageDecryptMultipleCryptoMapper() {
Request request = getRequest(Url.parse(ENCRYPTED_BOOKMARKABLE_URL));
IRequestHandler requestHandler = new CryptoMapper(mapper, tester.getApplication()).mapRequest(request);
assertNotNull(requestHandler);
requestHandler = unwrapRequestHandlerDelegate(requestHandler);
assertThat(requestHandler, instanceOf(RenderPageRequestHandler.class));
RenderPageRequestHandler handler = (RenderPageRequestHandler) requestHandler;
assertEquals(Page2.class, handler.getPageClass());
}
use of org.apache.wicket.request.Request in project wicket by apache.
the class CryptoMapperTest method bookmarkablePageDecrypt.
/**
* Tests that encrypted URLs for bookmarkable pages are decrypted and passed to the wrapped mapper.
*/
@Test
public void bookmarkablePageDecrypt() {
Request request = getRequest(Url.parse(ENCRYPTED_BOOKMARKABLE_URL));
IRequestHandler requestHandler = mapper.mapRequest(request);
assertNotNull(requestHandler);
requestHandler = unwrapRequestHandlerDelegate(requestHandler);
assertThat(requestHandler, instanceOf(RenderPageRequestHandler.class));
RenderPageRequestHandler handler = (RenderPageRequestHandler) requestHandler;
assertEquals(Page2.class, handler.getPageClass());
}
use of org.apache.wicket.request.Request 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.Request in project wicket by apache.
the class CryptoMapperTest method decryptFailed.
/**
* Test a failed decrypt, WICKET-4139
*/
@Test
public void decryptFailed() {
String encrypted = "style.css";
Request request = getRequest(Url.parse(encrypted));
assertNull(mapper.mapRequest(request));
}
use of org.apache.wicket.request.Request 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