wicket 6, SSL and development

Currently I am writing a small wicket based application for a telecom provider in the netherlands. As the customer will login to the system SSL needed to be setup. I had already dones this a few times with older versions of wicket but never with Wicket 6.0.0. released just last week. I always use Jetty to run the application from maven during development. I starts fast and is lightweight. I also dont want to be bothered with the SSL certificate during development. Getting a certificate just for development is unnecessary, so I usually have a small piece of code in the startup Application.java that switches of SSL completely if wicket is in development mode. How to switch to SSL mode describes in detail how to do it in wicket 1.4. This is made easier in wicket 6. in your init function just add the following:

setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new HttpsConfig(80, 443)){
    @Override
    protected Scheme getDesiredSchemeFor(Class pageClass) {
        if (getConfigurationType()==RuntimeConfigurationType.DEVELOPMENT) {
            logger.debug("in development mode, returning HTTP");
            return Scheme.HTTP;
        } else {
            logger.debug("not in development mode, letting the mapper decide");
            return super.getDesiredSchemeFor(pageClass);
        }
    }
});
comments powered by Disqus
comments powered by Disqus