You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by el...@apache.org on 2019/03/14 01:51:44 UTC
svn commit: r1855472 -
/mina/site/trunk/content/mina-project/2.1-vs-2.0.mdtext
Author: elecharny
Date: Thu Mar 14 01:51:44 2019
New Revision: 1855472
URL: http://svn.apache.org/viewvc?rev=1855472&view=rev
Log:
solved some formating issue
Modified:
mina/site/trunk/content/mina-project/2.1-vs-2.0.mdtext
Modified: mina/site/trunk/content/mina-project/2.1-vs-2.0.mdtext
URL: http://svn.apache.org/viewvc/mina/site/trunk/content/mina-project/2.1-vs-2.0.mdtext?rev=1855472&r1=1855471&r2=1855472&view=diff
==============================================================================
--- mina/site/trunk/content/mina-project/2.1-vs-2.0.mdtext (original)
+++ mina/site/trunk/content/mina-project/2.1-vs-2.0.mdtext Thu Mar 14 01:51:44 2019
@@ -26,22 +26,22 @@ It was decided to change that and make i
The following application code is to be used if the application needs to know if the session has been secured or not:
- :::java
- connector.setHandler(new IoHandlerAdapter() {
- @Override
- public void sessionCreated(IoSession session) throws Exception {
- // Add the SSL notification in the session's attribute liste
- session.setAttribute(SslFilter.USE_NOTIFICATION, Boolean.TRUE);
- }
- ...
- @Override
- public void messageReceived(IoSession session, Object message) throws Exception {
- // Check if the 'fake' session secured message notification has been received
- if (message == SslFilter.SESSION_SECURED) {
- counter.countDown();
- }
- }
- }
+ :::java
+ connector.setHandler(new IoHandlerAdapter() {
+ @Override
+ public void sessionCreated(IoSession session) throws Exception {
+ // Add the SSL notification in the session's attribute liste
+ session.setAttribute(SslFilter.USE_NOTIFICATION, Boolean.TRUE);
+ }
+ ...
+ @Override
+ public void messageReceived(IoSession session, Object message) throws Exception {
+ // Check if the 'fake' session secured message notification has been received
+ if (message == SslFilter.SESSION_SECURED) {
+ counter.countDown();
+ }
+ }
+ }
As we can see in this piece of code, this is a two step process:
* first we have to inform our session that we want to be informaed about the secured status
@@ -58,14 +58,15 @@ We also have modified the *SslFilter* co
The following code show the difference with the previous code :
- :::java
- connector.setHandler(new IoHandlerAdapter() {
- @Override
- public void event(IoSession session, FilterEvent event) throws Exception {
- if (event == SslEvent.SECURED ) {
- // DO whatever the application needs to do when the session is secured
- }
- }
+ :::java
+ connector.setHandler(new IoHandlerAdapter() {
+ @Override
+ public void event(IoSession session, FilterEvent event) throws Exception {
+ if (event == SslEvent.SECURED ) {
+ // DO whatever the application needs to do when the session is secured
+ }
+ }
+ }
As we can see, we don't need to initialize the session telling it to inform the application through a notification: this will be done no matter what.