@Override public int getPort(HttpsConfig config) { return config.getHttpPort(); } },
@Override public int getPort(HttpsConfig config) { return config.getHttpsPort(); } },
/** * Sets the root request mapper for the given application from the given httpPort and httpsPort. * * @param application * 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; }
if (protocol == Protocol.HTTP) if (processor.getConfig().getHttpPort() != 80) port = processor.getConfig().getHttpPort(); if (processor.getConfig().getHttpsPort() != 443) port = processor.getConfig().getHttpsPort();
/** {@inheritDoc} */ @Override public IRequestTarget resolve(RequestCycle rc, RequestParameters rp) { if (portConfig != null && portConfig.isPreferStateful()) { // we need to persist the session before a redirect to https so the session lasts across // both http and https calls. Session.get().bind(); } IRequestTarget target = super.resolve(rc, rp); return checkSecure(target); }
public HttpsConfig getHttpsConfig() { return new HttpsConfig(config.getHttpPort(), config.getHttpsPort()); } }
@Override public void respond(IRequestCycle requestCycle) { String location = url; if (location.startsWith("/")) { // context-absolute url location = requestCycle.getUrlRenderer().renderContextRelativeUrl(location); } if (config.isPreferStateful()) { // we need to persist the session before a redirect to https so the session lasts // across both http and https calls. Session.get().bind(); } WebResponse response = (WebResponse)requestCycle.getResponse(); response.sendRedirect(location); } }
new HttpsConfig(httpPort, httpsPort))
@Override public void respond(IRequestCycle requestCycle) { String location = url; if (location.startsWith("/")) { // context-absolute url location = requestCycle.getUrlRenderer().renderContextRelativeUrl(location); } if (config.isPreferStateful()) { // we need to persist the session before a redirect to https so the session lasts // across both http and https calls. Session.get().bind(); } WebResponse response = (WebResponse)requestCycle.getResponse(); response.sendRedirect(location); } }
@Override public int getPort(HttpsConfig config) { return config.getHttpPort(); } },
@Override public int getPort(HttpsConfig config) { return config.getHttpsPort(); } },
@Override public void init(boolean isServlet, FilterConfig filterConfig) throws ServletException { super.init(isServlet, filterConfig); this.filterConfig = filterConfig; getApplication().getRequestCycleSettings().setRenderStrategy(RenderStrategy.REDIRECT_TO_RENDER); getApplication().getRequestCycleSettings().addResponseFilter(new PortletInvalidMarkupFilter()); //fix for https://github.com/wicketstuff/core/issues/487 getApplication().getMarkupSettings().setMarkupIdGenerator(new PortletMarkupIdGenerator()); //make the wicket bridge schema (HTTPS/HTTP) aware getApplication().setRootRequestMapper(new HttpsMapper(new PortletRequestMapper(getApplication()), new HttpsConfig()){ @Override protected Scheme getDesiredSchemeFor(IRequestHandler handler) { Request request = RequestCycle.get().getRequest(); return super.getSchemeOf(request); } }); //Application must use the portlet specific page renderer provider. getApplication().setPageRendererProvider(PortletPageRenderer::new); // fix for https://github.com/wicketstuff/core/issues/478 issue getApplication().setRequestCycleProvider(context -> new RequestCycle(context) { @Override protected UrlRenderer newUrlRenderer() { return new PortletUrlRenderer(getRequest()); } }); //fix for https://github.com/wicketstuff/core/issues/588 issue getApplication().getJavaScriptLibrarySettings().setWicketAjaxReference(WicketPortletAjaxResourceReference.get()); }