This is an automated email from the ASF dual-hosted git repository.

johnnyv pushed a commit to branch bugfix/DIRMINA1132
in repository https://gitbox.apache.org/repos/asf/mina.git


The following commit(s) were added to refs/heads/bugfix/DIRMINA1132 by this 
push:
     new 3f04424  Adds filter extend handler for engine creation allowing users 
to implement components like DIRMINA-1122 by themselves without having to patch 
the project.  Simply override onEngineCreated()
3f04424 is described below

commit 3f04424e8a54f3a4137def47f7f2467bdb30532c
Author: Jonathan Valliere <john...@apache.org>
AuthorDate: Sat Jul 31 11:07:52 2021 -0400

    Adds filter extend handler for engine creation allowing users to
    implement components like DIRMINA-1122 by themselves without having to
    patch the project.  Simply override onEngineCreated()
---
 .../java/org/apache/mina/filter/ssl2/SSL2Filter.java    | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git 
a/mina-core/src/main/java/org/apache/mina/filter/ssl2/SSL2Filter.java 
b/mina-core/src/main/java/org/apache/mina/filter/ssl2/SSL2Filter.java
index 9b5c5a5..4a35d2f 100644
--- a/mina-core/src/main/java/org/apache/mina/filter/ssl2/SSL2Filter.java
+++ b/mina-core/src/main/java/org/apache/mina/filter/ssl2/SSL2Filter.java
@@ -183,7 +183,7 @@ public class SSL2Filter extends IoFilterAdapter {
        public void onPostAdd(IoFilterChain parent, String name, NextFilter 
next) throws Exception {
                IoSession session = parent.getSession();
                if (session.isConnected()) {
-                       this.sessionConnected(next, session);
+                       this.onConnected(next, session);
                }
                super.onPostAdd(parent, name, next);
        }
@@ -209,7 +209,7 @@ public class SSL2Filter extends IoFilterAdapter {
         * @param session
         * @throws Exception
         */
-       protected void sessionConnected(NextFilter next, IoSession session) 
throws Exception {
+       protected void onConnected(NextFilter next, IoSession session) throws 
Exception {
                SSL2Handler x = 
SSL2Handler.class.cast(session.getAttribute(SSL_HANDLER));
 
                if (x == null) {
@@ -220,6 +220,7 @@ public class SSL2Filter extends IoFilterAdapter {
                        e.setEnabledCipherSuites(mEnabledCipherSuites);
                        e.setEnabledProtocols(mEnabledProtocols);
                        e.setUseClientMode(!session.isServer());
+                       this.onEngineCreated(session, e);
                        x = new SSL2HandlerG0(e, EXECUTOR, session);
                        session.setAttribute(SSL_HANDLER, x);
                }
@@ -228,6 +229,16 @@ public class SSL2Filter extends IoFilterAdapter {
        }
 
        /**
+        * Customization handler for init of the engine
+        * 
+        * @param session
+        * @param engine
+        */
+       protected void onEngineCreated(IoSession session, SSLEngine engine) {
+               
+       }
+
+       /**
         * {@inheritDoc}
         */
        @Override
@@ -235,7 +246,7 @@ public class SSL2Filter extends IoFilterAdapter {
                if (LOGGER.isDebugEnabled())
                        LOGGER.debug("session {} openend", session);
 
-               this.sessionConnected(next, session);
+               this.onConnected(next, session);
                super.sessionOpened(next, session);
        }
 

Reply via email to