The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.
Send messages to iframe using iframeEl.contentWindow.postMessage
Recieve messages using window.addEventListener('message')
| package com.alkhodiry.mb.rest.filters; | |
| import java.io.IOException; | |
| import javax.servlet.FilterChain; | |
| import javax.servlet.ServletException; | |
| import javax.servlet.http.HttpServletRequest; | |
| import javax.servlet.http.HttpServletResponse; | |
| import org.apache.commons.logging.Log; |
You’ve bought your SSL secure certificate and successfully installed on Tomcat with the keytool but how do your redirect the entire site to go HTTPS and redirect any HTTP connection straight over to HTTPS.
You need to edit the 2 Tomcat configuration files; server.xml and web.xml and then when edited restart the tomcat service.
Open server.xml typically found in tomcat/conf and change:
| import java.util.concurrent.Callable; | |
| import java.util.concurrent.Future; | |
| import java.util.concurrent.FutureTask; | |
| import java.util.concurrent.PriorityBlockingQueue; | |
| import java.util.concurrent.RejectedExecutionHandler; | |
| import java.util.concurrent.RunnableFuture; | |
| import java.util.concurrent.ThreadFactory; | |
| import java.util.concurrent.ThreadPoolExecutor; | |
| import java.util.concurrent.TimeUnit; |
| MongoTemplate mongo = ...; | |
| List<Converter> converters = new ArrayList<Converter>(); | |
| converters.add(new Converter<DBObject, Participant>() { | |
| public Participant convert(DBObject s) { | |
| throw new UnsupportedOperationException("Not supported yet 1."); | |
| } | |
| }); | |
| converters.add(new Converter<Participant, DBObject>() { |
| import java.security.SecureRandom; | |
| import java.security.cert.CertificateException; | |
| import java.security.cert.X509Certificate; | |
| import javax.net.ssl.HostnameVerifier; | |
| import javax.net.ssl.HttpsURLConnection; | |
| import javax.net.ssl.SSLContext; | |
| import javax.net.ssl.SSLSession; | |
| import javax.net.ssl.TrustManager; | |
| import javax.net.ssl.X509TrustManager; |
| #! /bin/sh | |
| # ================================================================== | |
| # ______ __ _____ | |
| # /_ __/___ ____ ___ _________ _/ /_ /__ / | |
| # / / / __ \/ __ `__ \/ ___/ __ `/ __/ / / | |
| # / / / /_/ / / / / / / /__/ /_/ / /_ / / | |
| #/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/ | |
| # Multi-instance Apache Tomcat installation with a focus | |
| # on best-practices as defined by Apache, SpringSource, and MuleSoft |
| public abstract class BaseRepository<T extends Object, ID extends Serializable> | |
| implements JpaRepository<T, ID>, JpaSpecificationExecutor<T> { | |
| private @PersistenceContext EntityManager em; | |
| private SimpleJpaRepository<T, ID> target; | |
| protected EntityManager getEntityManager() { | |
| return em; | |
| } |