use of org.apache.wicket.core.request.handler.IPageRequestHandler in project wicket by apache.
the class BookmarkableMapperTest method decode12.
/**
* WICKET-5071
*
* Decodes a request to
* {@link org.apache.wicket.core.request.mapper.IMapperContext#getBookmarkableIdentifier()}
* /com.example.MyPage when the current base url is
* {@link org.apache.wicket.core.request.mapper.IMapperContext#getNamespace()} /
* {@link org.apache.wicket.core.request.mapper.IMapperContext#getPageIdentifier()}
*/
@Test
public void decode12() {
final Url url = Url.parse(context.getBookmarkableIdentifier() + "/" + PAGE_CLASS_NAME);
Request request = new Request() {
@Override
public Url getUrl() {
return url;
}
@Override
public Locale getLocale() {
return null;
}
@Override
public Charset getCharset() {
return Charset.forName("UTF-8");
}
@Override
public Url getClientUrl() {
StringBuilder url = new StringBuilder();
url.append(context.getNamespace()).append('/').append(context.getPageIdentifier()).append("?3");
return Url.parse(url.toString());
}
@Override
public Object getContainerRequest() {
return null;
}
};
IRequestHandler handler = encoder.mapRequest(request);
assertNotNull("A handler should be resolved for relative url to a page instance url!", handler);
IRequestablePage page = ((IPageRequestHandler) handler).getPage();
assertEquals(page.getClass().getName(), PAGE_CLASS_NAME);
}
use of org.apache.wicket.core.request.handler.IPageRequestHandler in project wicket by apache.
the class BookmarkableMapperTest method decode9.
/**
*/
@Test(expected = StalePageException.class)
public void decode9() {
Url url = Url.parse("wicket/bookmarkable/" + PAGE_CLASS_NAME + "/i1/i2?15-5.ILinkListener-foo-bar&a=b&b=c");
context.setNextPageRenderCount(6);
IRequestHandler handler = encoder.mapRequest(getRequest(url));
((IPageRequestHandler) handler).getPage();
}
use of org.apache.wicket.core.request.handler.IPageRequestHandler in project wicket by apache.
the class BookmarkableMapperTest method decode11.
/**
* WICKET-5071
*
* Decodes a request to
* {@link org.apache.wicket.core.request.mapper.IMapperContext#getBookmarkableIdentifier()}
* /com.example.MyPage when the current base url is
* {@link org.apache.wicket.core.request.mapper.IMapperContext#getNamespace()} /
* {@link org.apache.wicket.core.request.mapper.IMapperContext#getBookmarkableIdentifier()}
*/
@Test
public void decode11() {
final Url url = Url.parse(context.getBookmarkableIdentifier() + "/" + PAGE_CLASS_NAME);
Request request = new Request() {
@Override
public Url getUrl() {
return url;
}
@Override
public Locale getLocale() {
return null;
}
@Override
public Charset getCharset() {
return Charset.forName("UTF-8");
}
@Override
public Url getClientUrl() {
StringBuilder url = new StringBuilder();
url.append(context.getNamespace()).append('/').append(context.getBookmarkableIdentifier()).append('/').append("com.example.MyPage");
return Url.parse(url.toString());
}
@Override
public Object getContainerRequest() {
return null;
}
};
IRequestHandler handler = encoder.mapRequest(request);
assertNotNull("A handler should be resolved for relative url to a bookmarkable page!", handler);
IRequestablePage page = ((IPageRequestHandler) handler).getPage();
assertEquals(page.getClass().getName(), PAGE_CLASS_NAME);
}
use of org.apache.wicket.core.request.handler.IPageRequestHandler in project wicket by apache.
the class MountedMapperTest method decode11.
/**
*/
@Test(expected = StalePageException.class)
public void decode11() {
Url url = Url.parse("some/mount/path?15-5.4-foo-bar");
context.setNextPageRenderCount(7);
IRequestHandler handler = encoder.mapRequest(getRequest(url));
((IPageRequestHandler) handler).getPage();
}
use of org.apache.wicket.core.request.handler.IPageRequestHandler in project wicket by apache.
the class PackageMapperTest method decode9.
/**
*/
@Test(expected = StalePageException.class)
public void decode9() {
Url url = Url.parse(MOUNT_PATH + '/' + PAGE_CLASS_NAME + "/i1/i2?15-5.-foo-bar&a=b&b=c");
context.setNextPageRenderCount(6);
IRequestHandler handler = encoder.mapRequest(getRequest(url));
((IPageRequestHandler) handler).getPage();
}
Aggregations