List of usage examples for org.apache.wicket.protocol.https HttpsMapper HttpsMapper
public HttpsMapper(IRequestMapper delegate, HttpsConfig config)
From source file:almira.sample.web.MainApplication.java
License:Apache License
@Override protected final void init() { super.init(); // Template method for overriding in a unit test initSpringInjector();/*from w w w . j a va 2s. com*/ // Cut page sizes in half for large HTML pages getMarkupSettings().setCompressWhitespace(true); getMarkupSettings().setStripComments(true); // https://cwiki.apache.org/WICKET/request-mapping.html mountPage("/admin", AdminPage.class); // Cargo expects index.html in <pingURL> mountPage("/index.html", IndexPage.class); if (httpPort == 0 || httpsPort == 0) { LOG.warning("HTTPS redirect not configured: ${rt.server.port.http}=" + httpPort + " ${rt.server.port.https}=" + httpsPort); } else { setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new HttpsConfig(httpPort, httpsPort))); LOG.info("HTTP port configured for MainApplication: " + httpPort); LOG.info("HTTPS port configured for MainApplication: " + httpsPort); } }
From source file:com.example.justaddwater.web.app.WicketApplication.java
License:Apache License
@Override public void init() { super.init(); BeanManager manager = (BeanManager) getServletContext().getAttribute(Listener.BEAN_MANAGER_ATTRIBUTE_NAME); new CdiConfiguration(manager).configure(this); // for Google App Engine getResourceSettings().setResourcePollFrequency(null); mountPage("/signup", SignupPage.class); mountPage("/forgot", ForgotPasswordPage.class); mountPage("/login", LoginPage.class); mountPage("/loginhandler", LoginFormHandlerPage.class); mountPage("/contact", ContactPage.class); mountPage("/about", AboutPage.class); mountPage("/change", ChangePasswordPage.class); mountPage("/404", Error404Page.class); mountPage("/500", Error500Page.class); mountPage("/account", AccountPage.class); mountPage("/fbauth", FacebookOAuthPage.class); final DeployConfiguration dConf = DeployConfiguration.valueOf(getInitParameter("deployconfiguration")); log.info("DeployConfiguration: " + dConf); switch (dConf) { case localhost: setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new HttpsConfig(HTTP_PORT, HTTPS_PORT))); break;// ww w .j av a2 s. co m case appspot: setRootRequestMapper( new HttpsMapper(getRootRequestMapper(), new HttpsConfig(HTTP_PORT_GAE, HTTPS_PORT_GAE))); break; default: break; } getSecuritySettings().setAuthorizationStrategy(new AuthorizationStrategy()); IApplicationSettings settings = getApplicationSettings(); settings.setInternalErrorPage(Error500Page.class); // https://cwiki.apache.org/WICKET/error-pages-and-feedback-messages.html getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE); // Enable Guice for field injection on Wicket pages. Unfortunately, // constructor injection into // pages is not supported. Supplying ServletModule is optional; it // enables usage of @RequestScoped and // @SessionScoped, which may not be useful for Wicket applications // because the WebPage instances are // already stored in session, with their dependencies injected once per // session. getComponentInstantiationListeners().add(new GuiceComponentInjector(this, guiceModule)); // addComponentInstantiationListener(new GuiceComponentInjector(this, // new ServletModule(), new GuiceModule())); ISerializer serializer = new GaeObjectSerializer(getApplicationKey()); getFrameworkSettings().setSerializer(serializer); // disable file cleaning because it starts a new thread getResourceSettings().setFileCleaner(null); setPageManagerProvider(new DefaultPageManagerProvider(WicketApplication.this) { protected IDataStore newDataStore() { //return new HttpSessionDataStore(getPageManagerContext(), new PageNumberEvictionStrategy(20)); IDataStore store = new BigTableGAEPageStore(getApplicationKey()); Guice.createInjector(guiceModule).injectMembers(store); return store; } }); }
From source file:de.alpharogroup.wicket.base.util.application.ApplicationExtensions.java
License:Apache License
/** * Sets the root request mapper for the given application from the given httpPort and httpsPort. * * @param application//from ww w. j a v a 2 s . com * the application * @param httpPort * the http port * @param httpsPort * the https port * @return the i request mapper */ public static IRequestMapper setRootRequestMapper(final Application application, final int httpPort, final int httpsPort) { final IRequestMapper httpsMapper = new HttpsMapper(application.getRootRequestMapper(), new HttpsConfig(httpPort, httpsPort)); application.setRootRequestMapper(httpsMapper); return httpsMapper; }
From source file:de.alpharogroup.wicket.base.util.application.ApplicationExtensions.java
License:Apache License
/** * Sets the RootRequestMapper for the given application from the given httpPort and httpsPort. * Note: if the configuration type is RuntimeConfigurationType.DEVELOPMENT then only HTTP scheme * will be returned./*w w w. ja va 2s .com*/ * * @param application * the application * @param httpPort * the http port * @param httpsPort * the https port */ public static void setRootRequestMapperForDevelopment(final Application application, final int httpPort, final int httpsPort) { application.setRootRequestMapper( new HttpsMapper(application.getRootRequestMapper(), new HttpsConfig(httpPort, httpsPort)) { @Override protected Scheme getDesiredSchemeFor(final Class<? extends IRequestablePage> pageClass) { if (application.getConfigurationType().equals(RuntimeConfigurationType.DEVELOPMENT)) { // is in development mode, returning Scheme.HTTP... return Scheme.HTTP; } else { // not in development mode, letting the mapper decide return super.getDesiredSchemeFor(pageClass); } } }); }
From source file:it.av.youeat.web.YoueatApplication.java
License:Apache License
@Override protected void init() { super.init(); getMarkupSettings().setCompressWhitespace(true); getMarkupSettings().setStripWicketTags(true); // TODO following line disabled to prevent strip of the adSense code, add differently the adsense and an restore the line below //getMarkupSettings().setStripComments(inDeployment()); // THIS LINE IS IMPORTANT - IT INSTALLS THE COMPONENT INJECTOR THAT WILL // INJECT NEWLY CREATED COMPONENTS WITH THEIR SPRING DEPENDENCIES if (getSpringContext() != null) { getComponentInstantiationListeners().add(new SpringComponentInjector(this, getSpringContext(), true)); }//from w ww. jav a 2 s . c o m mountPage("/info", AboutPage.class); mountPage("/InfoForRestaurateur", InfoForRestaurateurPage.class); mountPage("/signIn", SignIn.class); mountPage("/signOut", SignOut.class); mountPage("/userProfile", UserProfilePage.class); mountPage("/userPage", UserManagerPage.class); mountPage("/newRistorante", RistoranteAddNewPage.class); mountPage("/editRistorante" + "/${" + YoueatHttpParams.RISTORANTE_ID + "}/", RistoranteEditDataPage.class); mountPage("/editAddressRistorante" + "/${" + YoueatHttpParams.RISTORANTE_ID + "}/", RistoranteEditAddressPage.class); mountPage("/editPicturesRistorante" + "/${" + YoueatHttpParams.RISTORANTE_ID + "}/", RistoranteEditPicturePage.class); mountPage(YouEatPagePaths.VIEW_RISTORANTE + "/${" + YoueatHttpParams.RISTORANTE_NAME_AND_CITY + "}/", RistoranteViewPage.class); mountPage("/searchFriends", SearchFriendPage.class); mountPage("/friends", FriendsPage.class); mountPage("/signUp", SignUpPage.class); mountPage("/userHomePage", UserHomePage.class); mountPage(YouEatPagePaths.VIEW_EATER + "/${" + YoueatHttpParams.YOUEAT_ID + "}/", EaterViewPage.class); mountPage("/account" + "/${" + YoueatHttpParams.YOUEAT_ID + "}/", EaterAccountPage.class); mountPage("/passwordRecover", PasswordRecoverPage.class); mountPage("/messages", MessageListPage.class); mountPage("/message" + "/${" + YoueatHttpParams.DIALOG_ID + "}/", MessagePage.class); mountPage("/picture", ImageViewPage.class); mountPage("/index", IndexRistoPage.class); mountPage("/xd_receiver.htm", XdReceiver.class); mountPage("/privacy", PrivacyPage.class); mountPage("/sitemap.xml", SitemapPage.class); mountPage("/feed", FeedPage.class); mountPage("/ristoManager", RistoranteManagerPage.class); mountPage("/activitiesManager", ActivitiesManagerPage.class); mountPage("/commentsManager", CommentsManagerPage.class); // mount(new IndexedParamUrlCodingStrategy("/info", AboutPage.class)); // mount(new IndexedParamUrlCodingStrategy("/InfoForRestaurateur", InfoForRestaurateurPage.class)); // mount(new IndexedParamUrlCodingStrategy("/signIn", SignIn.class)); // mount(new IndexedParamUrlCodingStrategy("/signOut", SignOut.class)); // mount(new HybridUrlCodingStrategy("/userProfile", UserProfilePage.class)); // mount(new HybridUrlCodingStrategy("/userPage", UserManagerPage.class)); // mount(new HybridUrlCodingStrategy("/newRistorante", RistoranteAddNewPage.class)); // mount(new MixedParamHybridUrlCodingStrategy("/editRistorante", RistoranteEditDataPage.class, new String[]{YoueatHttpParams.RISTORANTE_ID})); // mount(new MixedParamHybridUrlCodingStrategy("/editAddressRistorante", RistoranteEditAddressPage.class, new String[]{YoueatHttpParams.RISTORANTE_ID})); // mount(new MixedParamHybridUrlCodingStrategy("/editPicturesRistorante", RistoranteEditPicturePage.class, new String[]{YoueatHttpParams.RISTORANTE_ID})); // mount(new MixedParamUrlCodingStrategy(YouEatPagePaths.VIEW_RISTORANTE, RistoranteViewPage.class, new String[]{YoueatHttpParams.RISTORANTE_NAME_AND_CITY})); // mount(new HybridUrlCodingStrategy("/searchFriends", SearchFriendPage.class)); // mount(new HybridUrlCodingStrategy("/friends", FriendsPage.class)); // mount(new IndexedParamUrlCodingStrategy("/signUp", SignUpPage.class)); // mount(new IndexedParamUrlCodingStrategy("/userHomePage", UserHomePage.class)); // mount(new MixedParamHybridUrlCodingStrategy(YouEatPagePaths.VIEW_EATER, EaterViewPage.class, new String[]{YoueatHttpParams.YOUEAT_ID})); // mount(new MixedParamHybridUrlCodingStrategy("/account", EaterAccountPage.class, new String[]{YoueatHttpParams.YOUEAT_ID})); // mount(new HybridUrlCodingStrategy("/passwordRecover", PasswordRecoverPage.class)); // mount(new HybridUrlCodingStrategy("/messages", MessageListPage.class)); // mount(new MixedParamHybridUrlCodingStrategy("/message", MessagePage.class, new String[]{YoueatHttpParams.DIALOG_ID})); // mount(new HybridUrlCodingStrategy("/picture", ImageViewPage.class)); // mount(new QueryStringUrlCodingStrategy("/index", IndexRistoPage.class)); // mount(new MixedParamUrlCodingStrategy("/xd_receiver.htm", XdReceiver.class, null)); // mount(new IndexedParamUrlCodingStrategy("/privacy", PrivacyPage.class)); // mount(new IndexedParamUrlCodingStrategy("/sitemap.xml", SitemapPage.class)); // mount(new IndexedParamUrlCodingStrategy("/feed", FeedPage.class)); // mount(new IndexedParamUrlCodingStrategy("/ristoManager", RistoranteManagerPage.class)); // mount(new IndexedParamUrlCodingStrategy("/activitiesManager", ActivitiesManagerPage.class)); // mount(new IndexedParamUrlCodingStrategy("/commentsManager", CommentsManagerPage.class)); getApplicationSettings().setInternalErrorPage(ErrorPage.class); setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new HttpsConfig(80, 443))); //to remove page version parameter in the URL. this.getRequestCycleSettings().setRenderStrategy(IRequestCycleSettings.RenderStrategy.ONE_PASS_RENDER); }
From source file:org.jaulp.wicket.base.util.application.ApplicationUtils.java
License:Apache License
/** * Sets the root request mapper for the given application from the given httpPort and httpsPort. * * @param application//from www .ja va 2 s .c o m * the application * @param httpPort * the http port * @param httpsPort * the https port */ public static void setRootRequestMapper(final Application application, final int httpPort, final int httpsPort) { application.setRootRequestMapper( new HttpsMapper(application.getRootRequestMapper(), new HttpsConfig(httpPort, httpsPort))); }
From source file:org.jaulp.wicket.base.util.application.ApplicationUtils.java
License:Apache License
/** * Sets the RootRequestMapper for the given application from the given httpPort and httpsPort. * Note: if the configuration type is RuntimeConfigurationType.DEVELOPMENT then only HTTP scheme * will be returned.//from www .j a v a 2 s . co m * * @param application * the application * @param httpPort * the http port * @param httpsPort * the https port */ public static void setRootRequestMapperForDevelopment(final Application application, final int httpPort, final int httpsPort) { application.setRootRequestMapper( new HttpsMapper(application.getRootRequestMapper(), new HttpsConfig(httpPort, httpsPort)) { @Override protected Scheme getDesiredSchemeFor(Class<? extends IRequestablePage> pageClass) { if (application.getConfigurationType().equals(RuntimeConfigurationType.DEVELOPMENT)) { // is in development mode, returning Scheme.HTTP... return Scheme.HTTP; } else { // not in development mode, letting the mapper decide return super.getDesiredSchemeFor(pageClass); } } }); }
From source file:org.tokenizer.xaloon.WicketApplication.java
License:Apache License
@Override protected void init() { super.init(); mountPage("/sitemap.xml", SiteMap.class); mountPage("/blog-rss", BlogRssFeed.class); temporaryFacade.initDemoData();/*from w w w. j a v a 2 s . co m*/ setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new HttpsConfig(8080, 8443))); }
From source file:org.wicketTutorial.https.WicketApplication.java
License:Apache License
/** * @see org.apache.wicket.Application#init() *//*from ww w. j a v a 2 s.com*/ @Override public void init() { setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new HttpsConfig(8080, 443))); }
From source file:org.yes.cart.web.application.StorefrontApplication.java
License:Apache License
/** * {@inheritDoc}// w w w . j a va 2 s . c om */ protected void init() { enableResourceAccess(); super.init(); // dynamic shop markup support via specific resource finder getResourceSettings().setResourceFinder(this); getResourceSettings().setResourceStreamLocator(new ResourceStreamLocator(this)); setRequestCycleProvider(this); // wicket-groovy dynamic pages support //getApplicationSettings().setClassResolver(new GroovyClassResolver(this)); configureMarkupSettings(); getComponentInstantiationListeners().add(getSpringComponentInjector()); getRequestCycleListeners().add(new StorefrontRequestCycleListener()); mountPages(); mountResources(); if ("true".equalsIgnoreCase(getInitParameter("secureMode"))) { final HttpsConfig httpsConfig = new HttpsConfig( Integer.valueOf((String) ObjectUtils.defaultIfNull(getInitParameter("unsecurePort"), "8080")), Integer.valueOf((String) ObjectUtils.defaultIfNull(getInitParameter("securePort"), "8443"))); final HttpsMapper httpsMapper = new HttpsMapper(getRootRequestMapper(), httpsConfig); setRootRequestMapper(httpsMapper); } }