use of org.apache.wicket.protocol.https.HttpsMapper in project wicket by apache.
the class RequestMapperApplication method init.
@Override
public void init() {
super.init();
getRootRequestMapperAsCompound().add(new CustomHomeMapper(getHomePage()));
getRootRequestMapperAsCompound().add(new LocaleFirstMapper(new MountedMapper("/localized", LocalizedPage.class)));
mountPage("secured", HttpsPage.class);
mountPackage("pMount", PackageMountedPage.class);
mountResource("/print/${sheet}/${format}", new MapperDemoResourceReference());
setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new LazyHttpsConfig()));
}
use of org.apache.wicket.protocol.https.HttpsMapper in project wicket by apache.
the class ISecuritySettingsTest method enforceMounts.
/**
* https://issues.apache.org/jira/browse/WICKET-3849
*/
@Test
public void enforceMounts() {
MockPageWithLink pageWithLink = new MockPageWithLink();
pageWithLink.add(new Link<Void>(MockPageWithLink.LINK_ID) {
private static final long serialVersionUID = 1L;
@Override
public void onClick() {
throw new RedirectToUrlException("/wicket/bookmarkable/" + UnknownPage.class.getName());
}
});
tester.startPage(pageWithLink);
tester.assertRenderedPage(MockPageWithLink.class);
tester.clickLink(MockPageWithLink.LINK_ID);
tester.assertRenderedPage(UnknownPage.class);
tester.getApplication().getSecuritySettings().setEnforceMounts(true);
tester.startPage(pageWithLink);
tester.assertRenderedPage(MockPageWithLink.class);
tester.clickLink(MockPageWithLink.LINK_ID);
Assert.assertNull(tester.getLastRenderedPage());
/*
* Test that mounts are enforced when the root compound mapper does not directly contain the mounted mapper.
*/
tester.getApplication().setRootRequestMapper(new HttpsMapper(tester.getApplication().getRootRequestMapper(), new HttpsConfig()));
tester.startPage(pageWithLink);
tester.assertRenderedPage(MockPageWithLink.class);
tester.clickLink(MockPageWithLink.LINK_ID);
Assert.assertNull(tester.getLastRenderedPage());
}
use of org.apache.wicket.protocol.https.HttpsMapper in project wicket by apache.
the class JSR356Application method init.
@Override
public void init() {
super.init();
scheduledExecutorService = Executors.newScheduledThreadPool(1);
setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new HttpsConfig(8080, 8443)));
mountPage("/behavior", WebSocketBehaviorDemoPage.class);
mountPage("/resource", WebSocketResourceDemoPage.class);
getSharedResources().add(ChartWebSocketResource.NAME, new ChartWebSocketResource());
if (System.getenv("OPENSHIFT_APP_NAME") != null) {
// OpenShift uses special proxy for WebSocket connections
// https://blog.openshift.com/paas-websockets/
final WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(this);
webSocketSettings.setPort(8000);
webSocketSettings.setSecurePort(8443);
}
}
Aggregations