You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by bu...@apache.org on 2012/10/31 05:53:40 UTC

svn commit: r836681 [14/23] - in /websites/staging/mina/trunk/content: ./ asyncweb/ css/ ftpserver/ mina/ mina/userguide/ mina/userguide/ch1-getting-started/ mina/userguide/ch10-executor-filter/ mina/userguide/ch11-ssl-filter/ mina/userguide/ch12-loggi...

Added: websites/staging/mina/trunk/content/mina/userguide/ch15-proxy/ch15-proxy.html
==============================================================================
--- websites/staging/mina/trunk/content/mina/userguide/ch15-proxy/ch15-proxy.html (added)
+++ websites/staging/mina/trunk/content/mina/userguide/ch15-proxy/ch15-proxy.html Wed Oct 31 04:53:33 2012
@@ -0,0 +1,185 @@
+<!DOCTYPE html>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<html>
+<head>
+	<title>Chapter 15 - Proxy &mdash; Apache MINA</title>
+	
+		<link href="./../../../css/common.css" rel="stylesheet" type="text/css">
+		<link href="./../../../css/mina.css" rel="stylesheet" type="text/css">
+	
+</head>
+  <body>
+    <div id="container">
+      <div id="header">
+        <div id="subProjectsNavBar">
+          <a href="./../../../">
+            
+              Apache MINA Project
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../mina/index.html">
+            
+              <strong>MINA</strong>
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../asyncweb/index.html">
+            
+              AsyncWeb
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../ftpserver/index.html">
+            
+              FtpServer
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../sshd/index.html">
+            
+              Sshd
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../vysper/index.html">
+            
+              Vysper
+            
+          </a>
+        </div><!-- subProjectsNavBar -->
+      </div><!-- header -->
+      <div id="content">
+        <div id="leftColumn">
+                              
+          
+          
+          
+            <div id="navigation">
+
+    <h5>Latest Downloads</h5>
+    <ul>
+        <li><a href="./../../../mina/downloads.html">Mina 2.0.7</a></li>
+    </ul>
+    <h5>Documentation</h5>
+    <ul>
+      <li><a href="./../../../mina/userguide/user-guide-toc.html" class="external-link" rel="nofollow">User guide</a></li>
+      <li><a href="./../../../mina/features.html" class="external-link" rel="nofollow">Features</a/</li>
+      <li><a href="./../../../mina/road-map.html" class="external-link" rel="nofollow">Road Map</a/</li>
+      <li><a href="./../../../mina/faq.html" class="external-link" rel="nofollow">FAQ</a/</li>
+    </ul>
+    <h5>Resources</h5>
+    <ul>
+      <li><a href="./../../../mina/downloads.html" class="external-link" rel="nofollow">Downloads</a></li>
+      <li><a href="./../../../mina/mailing-lists.html" class="external-link" rel="nofollow">Mailing lists & IRC</a></li>
+      <li><a href="./../../../mina/issue-tracking.html" class="external-link" rel="nofollow">Issue tracking</a></li>
+      <li><a href="./../../../mina/sources.html" class="external-link" rel="nofollow">Sources</a></li>
+      <li><a href="./../../../mina/performances.html" class="external-link" rel="nofollow">Performances</a></li>
+      <li><a href="./../../../mina/testimonials.html" class="external-link" rel="nofollow">Testimonials</a></li>
+      <li><a href="./../../../mina/conferences.html" class="external-link" rel="nofollow">Conferences</a></li>
+      <li><a href="./../../../mina/developper-guide.html" class="external-link" rel="nofollow">Developers Guide</a></li>
+      <li><a href="./../../../mina/related-projects.html" class="external-link" rel="nofollow">Related Projects</a></li>
+      <li><a href="http://people.apache.org/~vgritsenko/stats/projects/mina.html" class="external-link" rel="nofollow">Statistics</a></li>
+    </ul>
+
+    <h5>Community</h5>
+    <ul>
+      <li><a href="http://www.apache.org/foundation/contributing.html" class="external-link" rel="nofollow">Contributing</a></li>
+      <li><a href="./../../../contributors.html" class="external-link" rel="nofollow">Team</a></li>
+      <li><a href="./../../../special-thanks.html" class="external-link" rel="nofollow">Special Thanks</a></li>
+      <li><a href="http://www.apache.org/security/" class="external-link" rel="nofollow">Security</a></li>
+    </ul>
+
+    <h5>About Apache</h5>
+    <ul>
+      <li><a href="http://www.apache.org" class="external-link" rel="nofollow">Apache main site</a></li>
+      <li><a href="http://www.apache.org/licenses/" class="external-link" rel="nofollow">License</a></li>
+      <li><a href="http://www.apache.org/foundation/sponsorship.html" title="The ASF sponsorship program" class="external-link" rel="nofollow">Sponsorship program</a></li>
+      <li><a href="http://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</a></li>
+    </ul>
+
+    <h3><a name="Navigation-Upcoming"></a>Upcoming</h3>
+    <ul>
+      <li>No event</li>
+    </ul>
+
+</div>
+
+<!-- navigation -->
+          
+          
+        </div><!-- leftColumn -->
+      <div id="rightColumn">
+
+
+
+    <div class="nav">
+        <div class="nav_prev">
+        
+            <a href="../ch14-state-machine/ch14-state-machine.html">Chapter 14 - State Machine</a>
+		
+        </div>
+        <div class="nav_up">
+        
+            <a href="../user-guide-toc.html">User Guide</a>
+		
+        </div>
+        <div class="nav_next">
+        
+            <a href="../ch16-jmx-support/ch16-jmx-support.html">Chapter 16 - JMX support</a>
+		
+        </div>
+        <div class="clearfix"></div>
+    </div>
+
+
+<h1 id="chapter-15-proxy">Chapter 15 - Proxy</h1>
+<p>To be completed...</p>
+
+
+    <div class="nav">
+        <div class="nav_prev">
+        
+            <a href="../ch14-state-machine/ch14-state-machine.html">Chapter 14 - State Machine</a>
+		
+        </div>
+        <div class="nav_up">
+        
+            <a href="../user-guide-toc.html">User Guide</a>
+		
+        </div>
+        <div class="nav_next">
+        
+            <a href="../ch16-jmx-support/ch16-jmx-support.html">Chapter 16 - JMX support</a>
+		
+        </div>
+        <div class="clearfix"></div>
+    </div>
+
+
+                </div><!-- rightColumn -->
+                <div id="endContent"></div>
+            </div><!-- content -->
+            <div id="footer">&copy; 2003-2012, <a href="http://www.apache.org">The Apache Software Foundation</a> - <a href="privacy-policy.html">Privacy Policy</a><br />
+                Apache MINA, MINA, Apache Vysper, Vysper, Apache SSHd, SSHd, Apache FtpServer, FtpServer, Apache AsyncWeb, AsyncWeb,
+                Apache, the Apache feather logo, and the Apache Mina project logos are trademarks of The Apache Software Foundation.
+            </div>
+        </div><!-- container -->
+    </body>
+</html>
+

Added: websites/staging/mina/trunk/content/mina/userguide/ch16-jmx-support/ch16-jmx-support.html
==============================================================================
--- websites/staging/mina/trunk/content/mina/userguide/ch16-jmx-support/ch16-jmx-support.html (added)
+++ websites/staging/mina/trunk/content/mina/userguide/ch16-jmx-support/ch16-jmx-support.html Wed Oct 31 04:53:33 2012
@@ -0,0 +1,239 @@
+<!DOCTYPE html>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<html>
+<head>
+	<title>Chapter 16 - JMX Support &mdash; Apache MINA</title>
+	
+		<link href="./../../../css/common.css" rel="stylesheet" type="text/css">
+		<link href="./../../../css/mina.css" rel="stylesheet" type="text/css">
+	
+</head>
+  <body>
+    <div id="container">
+      <div id="header">
+        <div id="subProjectsNavBar">
+          <a href="./../../../">
+            
+              Apache MINA Project
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../mina/index.html">
+            
+              <strong>MINA</strong>
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../asyncweb/index.html">
+            
+              AsyncWeb
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../ftpserver/index.html">
+            
+              FtpServer
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../sshd/index.html">
+            
+              Sshd
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../vysper/index.html">
+            
+              Vysper
+            
+          </a>
+        </div><!-- subProjectsNavBar -->
+      </div><!-- header -->
+      <div id="content">
+        <div id="leftColumn">
+                              
+          
+          
+          
+            <div id="navigation">
+
+    <h5>Latest Downloads</h5>
+    <ul>
+        <li><a href="./../../../mina/downloads.html">Mina 2.0.7</a></li>
+    </ul>
+    <h5>Documentation</h5>
+    <ul>
+      <li><a href="./../../../mina/userguide/user-guide-toc.html" class="external-link" rel="nofollow">User guide</a></li>
+      <li><a href="./../../../mina/features.html" class="external-link" rel="nofollow">Features</a/</li>
+      <li><a href="./../../../mina/road-map.html" class="external-link" rel="nofollow">Road Map</a/</li>
+      <li><a href="./../../../mina/faq.html" class="external-link" rel="nofollow">FAQ</a/</li>
+    </ul>
+    <h5>Resources</h5>
+    <ul>
+      <li><a href="./../../../mina/downloads.html" class="external-link" rel="nofollow">Downloads</a></li>
+      <li><a href="./../../../mina/mailing-lists.html" class="external-link" rel="nofollow">Mailing lists & IRC</a></li>
+      <li><a href="./../../../mina/issue-tracking.html" class="external-link" rel="nofollow">Issue tracking</a></li>
+      <li><a href="./../../../mina/sources.html" class="external-link" rel="nofollow">Sources</a></li>
+      <li><a href="./../../../mina/performances.html" class="external-link" rel="nofollow">Performances</a></li>
+      <li><a href="./../../../mina/testimonials.html" class="external-link" rel="nofollow">Testimonials</a></li>
+      <li><a href="./../../../mina/conferences.html" class="external-link" rel="nofollow">Conferences</a></li>
+      <li><a href="./../../../mina/developper-guide.html" class="external-link" rel="nofollow">Developers Guide</a></li>
+      <li><a href="./../../../mina/related-projects.html" class="external-link" rel="nofollow">Related Projects</a></li>
+      <li><a href="http://people.apache.org/~vgritsenko/stats/projects/mina.html" class="external-link" rel="nofollow">Statistics</a></li>
+    </ul>
+
+    <h5>Community</h5>
+    <ul>
+      <li><a href="http://www.apache.org/foundation/contributing.html" class="external-link" rel="nofollow">Contributing</a></li>
+      <li><a href="./../../../contributors.html" class="external-link" rel="nofollow">Team</a></li>
+      <li><a href="./../../../special-thanks.html" class="external-link" rel="nofollow">Special Thanks</a></li>
+      <li><a href="http://www.apache.org/security/" class="external-link" rel="nofollow">Security</a></li>
+    </ul>
+
+    <h5>About Apache</h5>
+    <ul>
+      <li><a href="http://www.apache.org" class="external-link" rel="nofollow">Apache main site</a></li>
+      <li><a href="http://www.apache.org/licenses/" class="external-link" rel="nofollow">License</a></li>
+      <li><a href="http://www.apache.org/foundation/sponsorship.html" title="The ASF sponsorship program" class="external-link" rel="nofollow">Sponsorship program</a></li>
+      <li><a href="http://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</a></li>
+    </ul>
+
+    <h3><a name="Navigation-Upcoming"></a>Upcoming</h3>
+    <ul>
+      <li>No event</li>
+    </ul>
+
+</div>
+
+<!-- navigation -->
+          
+          
+        </div><!-- leftColumn -->
+      <div id="rightColumn">
+
+
+
+    <div class="nav">
+        <div class="nav_prev">
+        
+            <a href="../ch15-proxy/ch15-proxy.html">Chapter 15 - Proxy</a>
+		
+        </div>
+        <div class="nav_up">
+        
+            <a href="../user-guide-toc.html">User Guide</a>
+		
+        </div>
+        <div class="nav_next">
+        
+            <a href="../ch17-spring-integration/ch17-spring-integration.html">Chapter 17 - Spring Integration</a>
+		
+        </div>
+        <div class="clearfix"></div>
+    </div>
+
+
+<h1 id="chapter-16-jmx-support">Chapter 16 - JMX Support</h1>
+<p>Java Management Extensions (JMX) is used for managing and monitoring java applications.  This tutorial will provide you with an example as to how you can JMX-enable your MINA based application.</p>
+<p>This tutorial is designed to help you get the JMX technology integrated in to your MINA-based application. In this tutorial, we will integrate the MINA-JMX classes into the imagine server example program.</p>
+<h1 id="adding-jmx-support">Adding JMX Support</h1>
+<p>To JMX enable MINA application we have to perform following</p>
+<ul>
+<li>Create/Get MBean server</li>
+<li>Instantiate desired MBeans (IoAcceptor, IoFilter)<br />
+</li>
+<li>Register MBeans with MBean server</li>
+</ul>
+<p>We shall follow \src\main\java\org\apache\mina\example\imagine\step3\server\ImageServer.java, for the rest of our discussion</p>
+<h2 id="createget-mbean-server">Create/Get MBean server</h2>
+<div class="codehilite"><pre><span class="sr">//</span> <span class="n">create</span> <span class="n">a</span> <span class="n">JMX</span> <span class="n">MBean</span> <span class="n">Server</span> <span class="n">server</span> <span class="n">instance</span>
+<span class="n">MBeanServer</span> <span class="n">mBeanServer</span> <span class="o">=</span> <span class="n">ManagementFactory</span><span class="o">.</span><span class="n">getPlatformMBeanServer</span><span class="p">();</span>
+</pre></div>
+
+
+<p>This lines get the MBean Server instance.</p>
+<h2 id="instantiate-mbeans">Instantiate MBean(s)</h2>
+<p>We create an MBean for IoService</p>
+<div class="codehilite"><pre><span class="sr">//</span> <span class="n">create</span> <span class="n">a</span> <span class="n">JMX</span><span class="o">-</span><span class="n">aware</span> <span class="n">bean</span> <span class="n">that</span> <span class="n">wraps</span> <span class="n">a</span> <span class="n">MINA</span> <span class="n">IoService</span> <span class="n">object</span><span class="o">.</span>  <span class="n">In</span> <span class="n">this</span>
+<span class="sr">//</span> <span class="k">case</span><span class="p">,</span> <span class="n">a</span> <span class="n">NioSocketAcceptor</span><span class="o">.</span> 
+<span class="n">IoServiceMBean</span> <span class="n">acceptorMBean</span> <span class="o">=</span> <span class="k">new</span> <span class="n">IoServiceMBean</span><span class="p">(</span> <span class="n">acceptor</span> <span class="p">);</span>
+</pre></div>
+
+
+<p>This creates an IoService MBean. It accepts instance of an acceptor that it exposed via JMX.</p>
+<p>Similarly, you can add IoFilterMBean and other custom MBeans as well</p>
+<h2 id="registering-mbeans-with-mbean-server">Registering MBeans with MBean Server</h2>
+<div class="codehilite"><pre><span class="sr">//</span> <span class="n">create</span> <span class="n">a</span> <span class="n">JMX</span> <span class="n">ObjectName</span><span class="o">.</span>  <span class="n">This</span> <span class="n">has</span> <span class="n">to</span> <span class="n">be</span> <span class="n">in</span> <span class="n">a</span> <span class="n">specific</span> <span class="nb">format</span><span class="o">.</span>  
+<span class="n">ObjectName</span> <span class="n">acceptorName</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ObjectName</span><span class="p">(</span> <span class="n">acceptor</span><span class="o">.</span><span class="n">getClass</span><span class="p">()</span><span class="o">.</span><span class="n">getPackage</span><span class="p">()</span><span class="o">.</span><span class="n">getName</span><span class="p">()</span> <span class="o">+</span>
+        <span class="s">&quot;:type=acceptor,name=&quot;</span> <span class="o">+</span> <span class="n">acceptor</span><span class="o">.</span><span class="n">getClass</span><span class="p">()</span><span class="o">.</span><span class="n">getSimpleName</span><span class="p">());</span>
+
+<span class="sr">//</span> <span class="n">register</span> <span class="n">the</span> <span class="n">bean</span> <span class="n">on</span> <span class="n">the</span> <span class="n">MBeanServer</span><span class="o">.</span>  <span class="n">Without</span> <span class="n">this</span> <span class="n">line</span><span class="p">,</span> <span class="nb">no</span> <span class="n">JMX</span> <span class="n">will</span> <span class="n">happen</span> <span class="k">for</span>
+<span class="sr">//</span> <span class="n">this</span> <span class="n">acceptor</span><span class="o">.</span>
+<span class="n">mBeanServer</span><span class="o">.</span><span class="n">registerMBean</span><span class="p">(</span> <span class="n">acceptorMBean</span><span class="p">,</span> <span class="n">acceptorName</span> <span class="p">);</span>
+</pre></div>
+
+
+<p>We create an ObjectName that need to be used as logical name for accessing the MBean and register the MBean to the MBean Server. Our application in now JMX enabled. Lets see it in action.</p>
+<h2 id="start-the-imagine-server">Start the Imagine Server</h2>
+<p>If you are using Java 5 or earlier:</p>
+<div class="codehilite"><pre><span class="n">java</span> <span class="o">-</span><span class="n">Dcom</span><span class="o">.</span><span class="n">sun</span><span class="o">.</span><span class="n">management</span><span class="o">.</span><span class="n">jmxremote</span> <span class="o">-</span><span class="n">classpath</span> <span class="sr">&lt;CLASSPATH&gt;</span> <span class="n">org</span><span class="o">.</span><span class="n">apache</span><span class="o">.</span><span class="n">mina</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">imagine</span><span class="o">.</span><span class="n">step3</span><span class="o">.</span><span class="n">server</span><span class="o">.</span><span class="n">ImageServer</span>
+</pre></div>
+
+
+<p>If you  are using Java 6:</p>
+<div class="codehilite"><pre><span class="n">java</span>  <span class="o">-</span><span class="n">classpath</span> <span class="sr">&lt;CLASSPATH&gt;</span> <span class="p">}}{{{}</span><span class="n">org</span><span class="o">.</span><span class="n">apache</span><span class="o">.</span><span class="n">mina</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">imagine</span><span class="o">.</span><span class="n">step3</span><span class="o">.</span><span class="n">server</span><span class="o">.</span><span class="n">ImageServer</span>
+</pre></div>
+
+
+<h2 id="start-jconsole">Start JConsole</h2>
+<p>Start JConsole using the following command: </p>
+<p>&lt;JDK_HOME&gt;/bin/jconsole</p>
+<p>We can see the different attributes and operations that are exposed by the MBeans</p>
+
+
+    <div class="nav">
+        <div class="nav_prev">
+        
+            <a href="../ch15-proxy/ch15-proxy.html">Chapter 15 - Proxy</a>
+		
+        </div>
+        <div class="nav_up">
+        
+            <a href="../user-guide-toc.html">User Guide</a>
+		
+        </div>
+        <div class="nav_next">
+        
+            <a href="../ch17-spring-integration/ch17-spring-integration.html">Chapter 17 - Spring Integration</a>
+		
+        </div>
+        <div class="clearfix"></div>
+    </div>
+
+
+                </div><!-- rightColumn -->
+                <div id="endContent"></div>
+            </div><!-- content -->
+            <div id="footer">&copy; 2003-2012, <a href="http://www.apache.org">The Apache Software Foundation</a> - <a href="privacy-policy.html">Privacy Policy</a><br />
+                Apache MINA, MINA, Apache Vysper, Vysper, Apache SSHd, SSHd, Apache FtpServer, FtpServer, Apache AsyncWeb, AsyncWeb,
+                Apache, the Apache feather logo, and the Apache Mina project logos are trademarks of The Apache Software Foundation.
+            </div>
+        </div><!-- container -->
+    </body>
+</html>
+

Added: websites/staging/mina/trunk/content/mina/userguide/ch17-spring-integration/ch17-spring-integration.html
==============================================================================
--- websites/staging/mina/trunk/content/mina/userguide/ch17-spring-integration/ch17-spring-integration.html (added)
+++ websites/staging/mina/trunk/content/mina/userguide/ch17-spring-integration/ch17-spring-integration.html Wed Oct 31 04:53:33 2012
@@ -0,0 +1,282 @@
+<!DOCTYPE html>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<html>
+<head>
+	<title>Chapter 17 - Spring Integration &mdash; Apache MINA</title>
+	
+		<link href="./../../../css/common.css" rel="stylesheet" type="text/css">
+		<link href="./../../../css/mina.css" rel="stylesheet" type="text/css">
+	
+</head>
+  <body>
+    <div id="container">
+      <div id="header">
+        <div id="subProjectsNavBar">
+          <a href="./../../../">
+            
+              Apache MINA Project
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../mina/index.html">
+            
+              <strong>MINA</strong>
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../asyncweb/index.html">
+            
+              AsyncWeb
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../ftpserver/index.html">
+            
+              FtpServer
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../sshd/index.html">
+            
+              Sshd
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../vysper/index.html">
+            
+              Vysper
+            
+          </a>
+        </div><!-- subProjectsNavBar -->
+      </div><!-- header -->
+      <div id="content">
+        <div id="leftColumn">
+                              
+          
+          
+          
+            <div id="navigation">
+
+    <h5>Latest Downloads</h5>
+    <ul>
+        <li><a href="./../../../mina/downloads.html">Mina 2.0.7</a></li>
+    </ul>
+    <h5>Documentation</h5>
+    <ul>
+      <li><a href="./../../../mina/userguide/user-guide-toc.html" class="external-link" rel="nofollow">User guide</a></li>
+      <li><a href="./../../../mina/features.html" class="external-link" rel="nofollow">Features</a/</li>
+      <li><a href="./../../../mina/road-map.html" class="external-link" rel="nofollow">Road Map</a/</li>
+      <li><a href="./../../../mina/faq.html" class="external-link" rel="nofollow">FAQ</a/</li>
+    </ul>
+    <h5>Resources</h5>
+    <ul>
+      <li><a href="./../../../mina/downloads.html" class="external-link" rel="nofollow">Downloads</a></li>
+      <li><a href="./../../../mina/mailing-lists.html" class="external-link" rel="nofollow">Mailing lists & IRC</a></li>
+      <li><a href="./../../../mina/issue-tracking.html" class="external-link" rel="nofollow">Issue tracking</a></li>
+      <li><a href="./../../../mina/sources.html" class="external-link" rel="nofollow">Sources</a></li>
+      <li><a href="./../../../mina/performances.html" class="external-link" rel="nofollow">Performances</a></li>
+      <li><a href="./../../../mina/testimonials.html" class="external-link" rel="nofollow">Testimonials</a></li>
+      <li><a href="./../../../mina/conferences.html" class="external-link" rel="nofollow">Conferences</a></li>
+      <li><a href="./../../../mina/developper-guide.html" class="external-link" rel="nofollow">Developers Guide</a></li>
+      <li><a href="./../../../mina/related-projects.html" class="external-link" rel="nofollow">Related Projects</a></li>
+      <li><a href="http://people.apache.org/~vgritsenko/stats/projects/mina.html" class="external-link" rel="nofollow">Statistics</a></li>
+    </ul>
+
+    <h5>Community</h5>
+    <ul>
+      <li><a href="http://www.apache.org/foundation/contributing.html" class="external-link" rel="nofollow">Contributing</a></li>
+      <li><a href="./../../../contributors.html" class="external-link" rel="nofollow">Team</a></li>
+      <li><a href="./../../../special-thanks.html" class="external-link" rel="nofollow">Special Thanks</a></li>
+      <li><a href="http://www.apache.org/security/" class="external-link" rel="nofollow">Security</a></li>
+    </ul>
+
+    <h5>About Apache</h5>
+    <ul>
+      <li><a href="http://www.apache.org" class="external-link" rel="nofollow">Apache main site</a></li>
+      <li><a href="http://www.apache.org/licenses/" class="external-link" rel="nofollow">License</a></li>
+      <li><a href="http://www.apache.org/foundation/sponsorship.html" title="The ASF sponsorship program" class="external-link" rel="nofollow">Sponsorship program</a></li>
+      <li><a href="http://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</a></li>
+    </ul>
+
+    <h3><a name="Navigation-Upcoming"></a>Upcoming</h3>
+    <ul>
+      <li>No event</li>
+    </ul>
+
+</div>
+
+<!-- navigation -->
+          
+          
+        </div><!-- leftColumn -->
+      <div id="rightColumn">
+
+
+
+    <div class="nav">
+        <div class="nav_prev">
+        
+            <a href="../ch16-jmx-support/ch16-jmx-support.html">Chapter 16 - Adding JMX Support</a>
+		
+        </div>
+        <div class="nav_up">
+        
+            <a href="../user-guide-toc.html">User Guide</a>
+		
+        </div>
+        <div class="nav_next">
+        
+			&nbsp;
+        
+        </div>
+        <div class="clearfix"></div>
+    </div>
+
+
+<h1 id="chapter-17-spring-integration">Chapter 17 - Spring Integration</h1>
+<p>This article demonstrates integrating MINA application with Spring. I wrote this article on my blog, and though to put it here, where this information actually belongs to. Can find the original copy at <a href="http://www.ashishpaliwal.com/blog/2008/11/integrating-apache-mina-with-spring/">Integrating Apache MINA with Spring</a>.</p>
+<h2 id="application-structure">Application Structure</h2>
+<p>We shall take a standard MINA application which has following construct</p>
+<ul>
+<li>One Handler</li>
+<li>Two Filter - Logging Filter and a ProtocolCodec Filter</li>
+<li>NioDatagram Socket</li>
+</ul>
+<h3 id="initialization-code">Initialization Code</h3>
+<p>Lets see the code first. For simplicity we have omitted the glue code.</p>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">void</span> <span class="n">initialize</span><span class="p">()</span> <span class="n">throws</span> <span class="n">IOException</span> <span class="p">{</span>
+
+    <span class="sr">//</span> <span class="n">Create</span> <span class="n">an</span> <span class="n">Acceptor</span>
+    <span class="n">NioDatagramAcceptor</span> <span class="n">acceptor</span> <span class="o">=</span> <span class="k">new</span> <span class="n">NioDatagramAcceptor</span><span class="p">();</span>
+
+    <span class="sr">//</span> <span class="n">Add</span> <span class="n">Handler</span>
+    <span class="n">acceptor</span><span class="o">.</span><span class="n">setHandler</span><span class="p">(</span><span class="k">new</span> <span class="n">ServerHandler</span><span class="p">());</span>
+
+    <span class="n">acceptor</span><span class="o">.</span><span class="n">getFilterChain</span><span class="p">()</span><span class="o">.</span><span class="n">addLast</span><span class="p">(</span><span class="s">&quot;logging&quot;</span><span class="p">,</span>
+                <span class="k">new</span> <span class="n">LoggingFilter</span><span class="p">());</span>
+    <span class="n">acceptor</span><span class="o">.</span><span class="n">getFilterChain</span><span class="p">()</span><span class="o">.</span><span class="n">addLast</span><span class="p">(</span><span class="s">&quot;codec&quot;</span><span class="p">,</span>
+                <span class="k">new</span> <span class="n">ProtocolCodecFilter</span><span class="p">(</span><span class="k">new</span> <span class="n">SNMPCodecFactory</span><span class="p">()));</span>
+
+    <span class="sr">//</span> <span class="n">Create</span> <span class="n">Session</span> <span class="n">Configuration</span>
+    <span class="n">DatagramSessionConfig</span> <span class="n">dcfg</span> <span class="o">=</span> <span class="n">acceptor</span><span class="o">.</span><span class="n">getSessionConfig</span><span class="p">();</span>
+        <span class="n">dcfg</span><span class="o">.</span><span class="n">setReuseAddress</span><span class="p">(</span><span class="n">true</span><span class="p">);</span>
+        <span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&quot;Starting Server......&quot;</span><span class="p">);</span>
+        <span class="sr">//</span> <span class="n">Bind</span> <span class="ow">and</span> <span class="n">be</span> <span class="n">ready</span> <span class="n">to</span> <span class="nb">listen</span>
+        <span class="n">acceptor</span><span class="o">.</span><span class="nb">bind</span><span class="p">(</span><span class="k">new</span> <span class="n">InetSocketAddress</span><span class="p">(</span><span class="n">DEFAULT_PORT</span><span class="p">));</span>
+        <span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&quot;Server listening on &quot;</span><span class="o">+</span><span class="n">DEFAULT_PORT</span><span class="p">);</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<h2 id="integration-process">Integration Process</h2>
+<p>To integrate with Spring, we need to do following:</p>
+<ul>
+<li>Set the IO handler</li>
+<li>Create the Filters and add to the chain</li>
+<li>Create the Socket and set Socket Parameters</li>
+</ul>
+<p>NOTE: The latest MINA releases doesn't have the package specific to Spring, like its earlier versions. The package is now named Integration Beans, to make the implementation work for all DI frameworks.</p>
+<p>Lets see the Spring xml file. Please see that I have removed generic part from xml and have put only the specific things needed to pull up the implementation.
+This example has been derived from <a href="http://svn.apache.org/viewvc/mina/branches/1.0/example/src/main/java/org/apache/mina/example/chat/">Chat example</a> shipped with MINA release. Please refer the xml shipped with chat example.</p>
+<p>Now lets pull things together</p>
+<p>Lets set the IO Handler in the spring context file</p>
+<div class="codehilite"><pre><span class="o">&lt;!--</span> <span class="n">The</span> <span class="n">IoHandler</span> <span class="n">implementation</span> <span class="o">--&gt;</span>
+<span class="o">&lt;</span><span class="n">bean</span> <span class="n">id</span><span class="o">=</span><span class="s">&quot;trapHandler&quot;</span> <span class="n">class</span><span class="o">=</span><span class="s">&quot;com.ashishpaliwal.udp.mina.server.ServerHandler&quot;</span><span class="o">&gt;</span>
+</pre></div>
+
+
+<p>Lets create the Filter chain</p>
+<div class="codehilite"><pre><span class="nt">&lt;bean</span> <span class="na">id=</span><span class="s">&quot;snmpCodecFilter&quot;</span> <span class="na">class=</span><span class="s">&quot;org.apache.mina.filter.codec.ProtocolCodecFilter&quot;</span><span class="nt">&gt;</span>
+  <span class="nt">&lt;constructor-arg&gt;</span>
+    <span class="nt">&lt;bean</span> <span class="na">class=</span><span class="s">&quot;com.ashishpaliwal.udp.mina.snmp.SNMPCodecFactory&quot;</span> <span class="nt">/&gt;</span>
+  <span class="nt">&lt;/constructor-arg&gt;</span>
+<span class="nt">&lt;/bean&gt;</span>
+
+<span class="nt">&lt;bean</span> <span class="na">id=</span><span class="s">&quot;loggingFilter&quot;</span> <span class="na">class=</span><span class="s">&quot;org.apache.mina.filter.logging.LoggingFilter&quot;</span> <span class="nt">/&gt;</span>
+
+<span class="c">&lt;!-- The filter chain. --&gt;</span>
+<span class="nt">&lt;bean</span> <span class="na">id=</span><span class="s">&quot;filterChainBuilder&quot;</span> <span class="na">class=</span><span class="s">&quot;org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder&quot;</span><span class="nt">&gt;</span>
+  <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;filters&quot;</span><span class="nt">&gt;</span>
+    <span class="nt">&lt;map&gt;</span>
+      <span class="nt">&lt;entry</span> <span class="na">key=</span><span class="s">&quot;loggingFilter&quot;</span> <span class="na">value-ref=</span><span class="s">&quot;loggingFilter&quot;</span><span class="nt">/&gt;</span>
+      <span class="nt">&lt;entry</span> <span class="na">key=</span><span class="s">&quot;codecFilter&quot;</span> <span class="na">value-ref=</span><span class="s">&quot;snmpCodecFilter&quot;</span><span class="nt">/&gt;</span>
+    <span class="nt">&lt;/map&gt;</span>
+  <span class="nt">&lt;/property&gt;</span>
+<span class="nt">&lt;/bean&gt;</span>
+</pre></div>
+
+
+<p>Here, we create instance of our IoFilter. See that for the ProtocolCodec factory, we have used Constructor injection. Logging Filter creation is straight forward. Once we have defined the beans for the filters to be used, we now create the Filter Chain to be used for the implementation. We define a bean with id "FilterChainBuidler" and add the defined filters to it. We are almost ready, and we just need to create the Socket and call bind</p>
+<p>Lets complete the last part of creating the Socket and completing the chain</p>
+<div class="codehilite"><pre><span class="nt">&lt;bean</span> <span class="na">class=</span><span class="s">&quot;org.springframework.beans.factory.config.CustomEditorConfigurer&quot;</span><span class="nt">&gt;</span>
+    <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;customEditors&quot;</span><span class="nt">&gt;</span>
+      <span class="nt">&lt;map&gt;</span>
+        <span class="nt">&lt;entry</span> <span class="na">key=</span><span class="s">&quot;java.net.SocketAddress&quot;</span><span class="nt">&gt;</span>
+          <span class="nt">&lt;bean</span> <span class="na">class=</span><span class="s">&quot;org.apache.mina.integration.beans.InetSocketAddressEditor&quot;</span> <span class="nt">/&gt;</span>
+        <span class="nt">&lt;/entry&gt;</span>
+      <span class="nt">&lt;/map&gt;</span>
+    <span class="nt">&lt;/property&gt;</span>
+<span class="nt">&lt;/bean&gt;</span>
+
+<span class="c">&lt;!-- The IoAcceptor which binds to port 161 --&gt;</span>
+<span class="nt">&lt;bean</span> <span class="na">id=</span><span class="s">&quot;ioAcceptor&quot;</span> <span class="na">class=</span><span class="s">&quot;org.apache.mina.transport.socket.nio.NioDatagramAcceptor&quot;</span> <span class="na">init-method=</span><span class="s">&quot;bind&quot;</span> <span class="na">destroy-method=</span><span class="s">&quot;unbind&quot;</span><span class="nt">&gt;</span>
+  <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;defaultLocalAddress&quot;</span> <span class="na">value=</span><span class="s">&quot;:161&quot;</span> <span class="nt">/&gt;</span>
+  <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;handler&quot;</span> <span class="na">ref=</span><span class="s">&quot;trapHandler&quot;</span> <span class="nt">/&gt;</span>
+  <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;filterChainBuilder&quot;</span> <span class="na">ref=</span><span class="s">&quot;filterChainBuilder&quot;</span> <span class="nt">/&gt;</span>
+<span class="nt">&lt;/bean&gt;</span>
+</pre></div>
+
+
+<p>Now we create our ioAcceptor, set IO handler and Filter Chain. Now we have to write a function to read this file using Spring and start our application. Here's the code</p>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">void</span> <span class="n">initializeViaSpring</span><span class="p">()</span> <span class="n">throws</span> <span class="n">Exception</span> <span class="p">{</span>
+    <span class="k">new</span> <span class="n">ClassPathXmlApplicationContext</span><span class="p">(</span><span class="s">&quot;trapReceiverContext.xml&quot;</span><span class="p">);</span>
+<span class="p">}</span>
+</pre></div>
+
+
+    <div class="nav">
+        <div class="nav_prev">
+        
+            <a href="../ch16-jmx-support/ch16-jmx-support.html">Chapter 16 - Adding JMX Support</a>
+		
+        </div>
+        <div class="nav_up">
+        
+            <a href="../user-guide-toc.html">User Guide</a>
+		
+        </div>
+        <div class="nav_next">
+        
+			&nbsp;
+        
+        </div>
+        <div class="clearfix"></div>
+    </div>
+
+
+                </div><!-- rightColumn -->
+                <div id="endContent"></div>
+            </div><!-- content -->
+            <div id="footer">&copy; 2003-2012, <a href="http://www.apache.org">The Apache Software Foundation</a> - <a href="privacy-policy.html">Privacy Policy</a><br />
+                Apache MINA, MINA, Apache Vysper, Vysper, Apache SSHd, SSHd, Apache FtpServer, FtpServer, Apache AsyncWeb, AsyncWeb,
+                Apache, the Apache feather logo, and the Apache Mina project logos are trademarks of The Apache Software Foundation.
+            </div>
+        </div><!-- container -->
+    </body>
+</html>
+

Added: websites/staging/mina/trunk/content/mina/userguide/ch2-basics/application-architecture.html
==============================================================================
--- websites/staging/mina/trunk/content/mina/userguide/ch2-basics/application-architecture.html (added)
+++ websites/staging/mina/trunk/content/mina/userguide/ch2-basics/application-architecture.html Wed Oct 31 04:53:33 2012
@@ -0,0 +1,211 @@
+<!DOCTYPE html>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<html>
+<head>
+	<title>Application Architecture &mdash; Apache MINA</title>
+	
+		<link href="./../../../css/common.css" rel="stylesheet" type="text/css">
+		<link href="./../../../css/mina.css" rel="stylesheet" type="text/css">
+	
+</head>
+  <body>
+    <div id="container">
+      <div id="header">
+        <div id="subProjectsNavBar">
+          <a href="./../../../">
+            
+              Apache MINA Project
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../mina/index.html">
+            
+              <strong>MINA</strong>
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../asyncweb/index.html">
+            
+              AsyncWeb
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../ftpserver/index.html">
+            
+              FtpServer
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../sshd/index.html">
+            
+              Sshd
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../vysper/index.html">
+            
+              Vysper
+            
+          </a>
+        </div><!-- subProjectsNavBar -->
+      </div><!-- header -->
+      <div id="content">
+        <div id="leftColumn">
+                              
+          
+          
+          
+            <div id="navigation">
+
+    <h5>Latest Downloads</h5>
+    <ul>
+        <li><a href="./../../../mina/downloads.html">Mina 2.0.7</a></li>
+    </ul>
+    <h5>Documentation</h5>
+    <ul>
+      <li><a href="./../../../mina/userguide/user-guide-toc.html" class="external-link" rel="nofollow">User guide</a></li>
+      <li><a href="./../../../mina/features.html" class="external-link" rel="nofollow">Features</a/</li>
+      <li><a href="./../../../mina/road-map.html" class="external-link" rel="nofollow">Road Map</a/</li>
+      <li><a href="./../../../mina/faq.html" class="external-link" rel="nofollow">FAQ</a/</li>
+    </ul>
+    <h5>Resources</h5>
+    <ul>
+      <li><a href="./../../../mina/downloads.html" class="external-link" rel="nofollow">Downloads</a></li>
+      <li><a href="./../../../mina/mailing-lists.html" class="external-link" rel="nofollow">Mailing lists & IRC</a></li>
+      <li><a href="./../../../mina/issue-tracking.html" class="external-link" rel="nofollow">Issue tracking</a></li>
+      <li><a href="./../../../mina/sources.html" class="external-link" rel="nofollow">Sources</a></li>
+      <li><a href="./../../../mina/performances.html" class="external-link" rel="nofollow">Performances</a></li>
+      <li><a href="./../../../mina/testimonials.html" class="external-link" rel="nofollow">Testimonials</a></li>
+      <li><a href="./../../../mina/conferences.html" class="external-link" rel="nofollow">Conferences</a></li>
+      <li><a href="./../../../mina/developper-guide.html" class="external-link" rel="nofollow">Developers Guide</a></li>
+      <li><a href="./../../../mina/related-projects.html" class="external-link" rel="nofollow">Related Projects</a></li>
+      <li><a href="http://people.apache.org/~vgritsenko/stats/projects/mina.html" class="external-link" rel="nofollow">Statistics</a></li>
+    </ul>
+
+    <h5>Community</h5>
+    <ul>
+      <li><a href="http://www.apache.org/foundation/contributing.html" class="external-link" rel="nofollow">Contributing</a></li>
+      <li><a href="./../../../contributors.html" class="external-link" rel="nofollow">Team</a></li>
+      <li><a href="./../../../special-thanks.html" class="external-link" rel="nofollow">Special Thanks</a></li>
+      <li><a href="http://www.apache.org/security/" class="external-link" rel="nofollow">Security</a></li>
+    </ul>
+
+    <h5>About Apache</h5>
+    <ul>
+      <li><a href="http://www.apache.org" class="external-link" rel="nofollow">Apache main site</a></li>
+      <li><a href="http://www.apache.org/licenses/" class="external-link" rel="nofollow">License</a></li>
+      <li><a href="http://www.apache.org/foundation/sponsorship.html" title="The ASF sponsorship program" class="external-link" rel="nofollow">Sponsorship program</a></li>
+      <li><a href="http://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</a></li>
+    </ul>
+
+    <h3><a name="Navigation-Upcoming"></a>Upcoming</h3>
+    <ul>
+      <li>No event</li>
+    </ul>
+
+</div>
+
+<!-- navigation -->
+          
+          
+        </div><!-- leftColumn -->
+      <div id="rightColumn">
+
+
+
+    <div class="nav">
+        <div class="nav_prev">
+        
+			&nbsp;
+        
+        </div>
+        <div class="nav_up">
+        
+            <a href="ch2-basics.html">Chapter 2 - Basics</a>
+		
+        </div>
+        <div class="nav_next">
+        
+            <a href="sample-tcp-server.html">Sample TCP Server</a>
+		
+        </div>
+        <div class="clearfix"></div>
+    </div>
+
+
+<h1 id="mina-based-application-architecture">MINA based Application Architecture</h1>
+<p>It's the question most asked : 'How does a <strong>MINA</strong> based application look like'? In this article lets see what's the architecture of MINA based application. Have tried to gather the information from presentations based on <strong>MINA</strong>.</p>
+<p>A Bird's Eye View :</p>
+<p><img alt="" src="../../../staticresources/images/mina/apparch_small.png" /></p>
+<p>Here, we can see that <strong>MINA</strong> is the glue between your application (be it a client or a server) and the underlying network layer, which can be based on TCP, UDP, in-VM comunication or even a RS-232C serial protocol for a client.</p>
+<p>You just have to design your application on top of MINA without having to handle all the complexity of the newtork layer.</p>
+<p>Lets take a deeper dive into the details now. The following image shows a bit more the internal of <strong>MINA</strong>, and what are each of the <strong>MINA</strong> components doing :</p>
+<p><img alt="" src="../../../staticresources/images/mina/mina_app_arch.png" /></p>
+<p>(The image is from Emmanuel L&eacute;charny presentation <a href="../../../staticresources/pdfs/Mina_in_real_life_ASEU-2009.pdf">MINA in real life (ApacheCon EU 2009)</a>)</p>
+<p>Broadly, MINA based applications are divided into 3 layers</p>
+<ul>
+<li>I/O Service - Performs actual I/O</li>
+<li>I/O Filter Chain - Filters/Transforms bytes into desired Data Structures and vice-versa</li>
+<li>I/O Handler - Here resides the actual business logic</li>
+</ul>
+<p>So, in order to create a MINA based Application, you have to :</p>
+<ol>
+<li>Create an I/O service - Choose from already available Services (*Acceptor) or create your own</li>
+<li>Create a Filter Chain - Choose from already existing Filters or create a custom Filter for transforming request/response</li>
+<li>Create an I/O Handler - Write business logic, on handling different messages</li>
+</ol>
+<p>This is pretty much it. </p>
+<p>You can get a bit deeper by reading those two pages :</p>
+<ul>
+<li><a href="server-architecture.html">Server Architecture</a></li>
+<li><a href="client-architecture.html">Client Architecture</a></li>
+</ul>
+<p>Of course, <strong>MINA</strong> offers more than just that, and you will robably have to take care of many oher aspects, like the messages encoding/decoding, the network configuration how to scale up, etc... We will have a further look at those aspects in the next chapters.</p>
+
+
+    <div class="nav">
+        <div class="nav_prev">
+        
+			&nbsp;
+        
+        </div>
+        <div class="nav_up">
+        
+            <a href="ch2-basics.html">Chapter 2 - Basics</a>
+		
+        </div>
+        <div class="nav_next">
+        
+            <a href="sample-tcp-server.html">Sample TCP Server</a>
+		
+        </div>
+        <div class="clearfix"></div>
+    </div>
+
+
+                </div><!-- rightColumn -->
+                <div id="endContent"></div>
+            </div><!-- content -->
+            <div id="footer">&copy; 2003-2012, <a href="http://www.apache.org">The Apache Software Foundation</a> - <a href="privacy-policy.html">Privacy Policy</a><br />
+                Apache MINA, MINA, Apache Vysper, Vysper, Apache SSHd, SSHd, Apache FtpServer, FtpServer, Apache AsyncWeb, AsyncWeb,
+                Apache, the Apache feather logo, and the Apache Mina project logos are trademarks of The Apache Software Foundation.
+            </div>
+        </div><!-- container -->
+    </body>
+</html>
+

Added: websites/staging/mina/trunk/content/mina/userguide/ch2-basics/ch2-basics.html
==============================================================================
--- websites/staging/mina/trunk/content/mina/userguide/ch2-basics/ch2-basics.html (added)
+++ websites/staging/mina/trunk/content/mina/userguide/ch2-basics/ch2-basics.html Wed Oct 31 04:53:33 2012
@@ -0,0 +1,198 @@
+<!DOCTYPE html>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<html>
+<head>
+	<title>Chapter 2 - Basics &mdash; Apache MINA</title>
+	
+		<link href="./../../../css/common.css" rel="stylesheet" type="text/css">
+		<link href="./../../../css/mina.css" rel="stylesheet" type="text/css">
+	
+</head>
+  <body>
+    <div id="container">
+      <div id="header">
+        <div id="subProjectsNavBar">
+          <a href="./../../../">
+            
+              Apache MINA Project
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../mina/index.html">
+            
+              <strong>MINA</strong>
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../asyncweb/index.html">
+            
+              AsyncWeb
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../ftpserver/index.html">
+            
+              FtpServer
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../sshd/index.html">
+            
+              Sshd
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../vysper/index.html">
+            
+              Vysper
+            
+          </a>
+        </div><!-- subProjectsNavBar -->
+      </div><!-- header -->
+      <div id="content">
+        <div id="leftColumn">
+                              
+          
+          
+          
+            <div id="navigation">
+
+    <h5>Latest Downloads</h5>
+    <ul>
+        <li><a href="./../../../mina/downloads.html">Mina 2.0.7</a></li>
+    </ul>
+    <h5>Documentation</h5>
+    <ul>
+      <li><a href="./../../../mina/userguide/user-guide-toc.html" class="external-link" rel="nofollow">User guide</a></li>
+      <li><a href="./../../../mina/features.html" class="external-link" rel="nofollow">Features</a/</li>
+      <li><a href="./../../../mina/road-map.html" class="external-link" rel="nofollow">Road Map</a/</li>
+      <li><a href="./../../../mina/faq.html" class="external-link" rel="nofollow">FAQ</a/</li>
+    </ul>
+    <h5>Resources</h5>
+    <ul>
+      <li><a href="./../../../mina/downloads.html" class="external-link" rel="nofollow">Downloads</a></li>
+      <li><a href="./../../../mina/mailing-lists.html" class="external-link" rel="nofollow">Mailing lists & IRC</a></li>
+      <li><a href="./../../../mina/issue-tracking.html" class="external-link" rel="nofollow">Issue tracking</a></li>
+      <li><a href="./../../../mina/sources.html" class="external-link" rel="nofollow">Sources</a></li>
+      <li><a href="./../../../mina/performances.html" class="external-link" rel="nofollow">Performances</a></li>
+      <li><a href="./../../../mina/testimonials.html" class="external-link" rel="nofollow">Testimonials</a></li>
+      <li><a href="./../../../mina/conferences.html" class="external-link" rel="nofollow">Conferences</a></li>
+      <li><a href="./../../../mina/developper-guide.html" class="external-link" rel="nofollow">Developers Guide</a></li>
+      <li><a href="./../../../mina/related-projects.html" class="external-link" rel="nofollow">Related Projects</a></li>
+      <li><a href="http://people.apache.org/~vgritsenko/stats/projects/mina.html" class="external-link" rel="nofollow">Statistics</a></li>
+    </ul>
+
+    <h5>Community</h5>
+    <ul>
+      <li><a href="http://www.apache.org/foundation/contributing.html" class="external-link" rel="nofollow">Contributing</a></li>
+      <li><a href="./../../../contributors.html" class="external-link" rel="nofollow">Team</a></li>
+      <li><a href="./../../../special-thanks.html" class="external-link" rel="nofollow">Special Thanks</a></li>
+      <li><a href="http://www.apache.org/security/" class="external-link" rel="nofollow">Security</a></li>
+    </ul>
+
+    <h5>About Apache</h5>
+    <ul>
+      <li><a href="http://www.apache.org" class="external-link" rel="nofollow">Apache main site</a></li>
+      <li><a href="http://www.apache.org/licenses/" class="external-link" rel="nofollow">License</a></li>
+      <li><a href="http://www.apache.org/foundation/sponsorship.html" title="The ASF sponsorship program" class="external-link" rel="nofollow">Sponsorship program</a></li>
+      <li><a href="http://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</a></li>
+    </ul>
+
+    <h3><a name="Navigation-Upcoming"></a>Upcoming</h3>
+    <ul>
+      <li>No event</li>
+    </ul>
+
+</div>
+
+<!-- navigation -->
+          
+          
+        </div><!-- leftColumn -->
+      <div id="rightColumn">
+
+
+
+    <div class="nav">
+        <div class="nav_prev">
+        
+            <a href="../ch1-getting-started/ch1-getting-started.html">Chapter 1 - Getting Started</a>
+		
+        </div>
+        <div class="nav_up">
+        
+            <a href="../user-guide-toc.html">User Guide</a>
+		
+        </div>
+        <div class="nav_next">
+        
+            <a href="../ch3-service/ch3-service.html">Chapter 3 - Service</a>
+		
+        </div>
+        <div class="clearfix"></div>
+    </div>
+
+
+<h1 id="chapter-2-basics">Chapter 2 - Basics</h1>
+<p>In Chapter 1, we had a brief glimpse of Apache MINA. In this chapter we shall have a look at Client/Server Architecture and details on working out a MINA based Server and Client.</p>
+<p>We will also expose some very simple Servers and Clients, based on TCP and UDP.</p>
+<ul>
+<li><a href="application-architecture.html">Application Architecture</a><ul>
+<li><a href="server-architecture.html">Server Architecture</a></li>
+<li><a href="client-architecture.html">Client Architecture</a></li>
+</ul>
+</li>
+<li><a href="sample-tcp-server.html">Sample TCP Server</a></li>
+<li><a href="sample-tcp-client.html">Sample TCP Client</a></li>
+<li><a href="sample-udp-server.html">Sample UDP Server</a></li>
+<li><a href="sample-udp-client.html">Sample UDP Client</a></li>
+<li><a href="summary.html">Summary</a></li>
+</ul>
+
+
+    <div class="nav">
+        <div class="nav_prev">
+        
+            <a href="../ch1-getting-started/ch1-getting-started.html">Chapter 1 - Getting Started</a>
+		
+        </div>
+        <div class="nav_up">
+        
+            <a href="../user-guide-toc.html">User Guide</a>
+		
+        </div>
+        <div class="nav_next">
+        
+            <a href="../ch3-service/ch3-service.html">Chapter 3 - Service</a>
+		
+        </div>
+        <div class="clearfix"></div>
+    </div>
+
+
+                </div><!-- rightColumn -->
+                <div id="endContent"></div>
+            </div><!-- content -->
+            <div id="footer">&copy; 2003-2012, <a href="http://www.apache.org">The Apache Software Foundation</a> - <a href="privacy-policy.html">Privacy Policy</a><br />
+                Apache MINA, MINA, Apache Vysper, Vysper, Apache SSHd, SSHd, Apache FtpServer, FtpServer, Apache AsyncWeb, AsyncWeb,
+                Apache, the Apache feather logo, and the Apache Mina project logos are trademarks of The Apache Software Foundation.
+            </div>
+        </div><!-- container -->
+    </body>
+</html>
+

Added: websites/staging/mina/trunk/content/mina/userguide/ch2-basics/client-architecture.html
==============================================================================
--- websites/staging/mina/trunk/content/mina/userguide/ch2-basics/client-architecture.html (added)
+++ websites/staging/mina/trunk/content/mina/userguide/ch2-basics/client-architecture.html Wed Oct 31 04:53:33 2012
@@ -0,0 +1,192 @@
+<!DOCTYPE html>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<html>
+<head>
+	<title>Client Architecture &mdash; Apache MINA</title>
+	
+		<link href="./../../../css/common.css" rel="stylesheet" type="text/css">
+		<link href="./../../../css/mina.css" rel="stylesheet" type="text/css">
+	
+</head>
+  <body>
+    <div id="container">
+      <div id="header">
+        <div id="subProjectsNavBar">
+          <a href="./../../../">
+            
+              Apache MINA Project
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../mina/index.html">
+            
+              <strong>MINA</strong>
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../asyncweb/index.html">
+            
+              AsyncWeb
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../ftpserver/index.html">
+            
+              FtpServer
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../sshd/index.html">
+            
+              Sshd
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../vysper/index.html">
+            
+              Vysper
+            
+          </a>
+        </div><!-- subProjectsNavBar -->
+      </div><!-- header -->
+      <div id="content">
+        <div id="leftColumn">
+                              
+          
+          
+          
+            <div id="navigation">
+
+    <h5>Latest Downloads</h5>
+    <ul>
+        <li><a href="./../../../mina/downloads.html">Mina 2.0.7</a></li>
+    </ul>
+    <h5>Documentation</h5>
+    <ul>
+      <li><a href="./../../../mina/userguide/user-guide-toc.html" class="external-link" rel="nofollow">User guide</a></li>
+      <li><a href="./../../../mina/features.html" class="external-link" rel="nofollow">Features</a/</li>
+      <li><a href="./../../../mina/road-map.html" class="external-link" rel="nofollow">Road Map</a/</li>
+      <li><a href="./../../../mina/faq.html" class="external-link" rel="nofollow">FAQ</a/</li>
+    </ul>
+    <h5>Resources</h5>
+    <ul>
+      <li><a href="./../../../mina/downloads.html" class="external-link" rel="nofollow">Downloads</a></li>
+      <li><a href="./../../../mina/mailing-lists.html" class="external-link" rel="nofollow">Mailing lists & IRC</a></li>
+      <li><a href="./../../../mina/issue-tracking.html" class="external-link" rel="nofollow">Issue tracking</a></li>
+      <li><a href="./../../../mina/sources.html" class="external-link" rel="nofollow">Sources</a></li>
+      <li><a href="./../../../mina/performances.html" class="external-link" rel="nofollow">Performances</a></li>
+      <li><a href="./../../../mina/testimonials.html" class="external-link" rel="nofollow">Testimonials</a></li>
+      <li><a href="./../../../mina/conferences.html" class="external-link" rel="nofollow">Conferences</a></li>
+      <li><a href="./../../../mina/developper-guide.html" class="external-link" rel="nofollow">Developers Guide</a></li>
+      <li><a href="./../../../mina/related-projects.html" class="external-link" rel="nofollow">Related Projects</a></li>
+      <li><a href="http://people.apache.org/~vgritsenko/stats/projects/mina.html" class="external-link" rel="nofollow">Statistics</a></li>
+    </ul>
+
+    <h5>Community</h5>
+    <ul>
+      <li><a href="http://www.apache.org/foundation/contributing.html" class="external-link" rel="nofollow">Contributing</a></li>
+      <li><a href="./../../../contributors.html" class="external-link" rel="nofollow">Team</a></li>
+      <li><a href="./../../../special-thanks.html" class="external-link" rel="nofollow">Special Thanks</a></li>
+      <li><a href="http://www.apache.org/security/" class="external-link" rel="nofollow">Security</a></li>
+    </ul>
+
+    <h5>About Apache</h5>
+    <ul>
+      <li><a href="http://www.apache.org" class="external-link" rel="nofollow">Apache main site</a></li>
+      <li><a href="http://www.apache.org/licenses/" class="external-link" rel="nofollow">License</a></li>
+      <li><a href="http://www.apache.org/foundation/sponsorship.html" title="The ASF sponsorship program" class="external-link" rel="nofollow">Sponsorship program</a></li>
+      <li><a href="http://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</a></li>
+    </ul>
+
+    <h3><a name="Navigation-Upcoming"></a>Upcoming</h3>
+    <ul>
+      <li>No event</li>
+    </ul>
+
+</div>
+
+<!-- navigation -->
+          
+          
+        </div><!-- leftColumn -->
+      <div id="rightColumn">
+
+
+
+    <div class="nav">
+        <div class="nav_prev">
+        
+            <a href="server-architecture.html">Server Architecture</a>
+		
+        </div>
+        <div class="nav_up">
+        
+            <a href="application-architecture.html">Application Architecture</a>
+		
+        </div>
+        <div class="nav_next">
+        
+			&nbsp;
+        
+        </div>
+        <div class="clearfix"></div>
+    </div>
+
+
+<h1 id="client-architecture">Client Architecture</h1>
+<p>We had a brief look at MINA based Server Architecture, lets see how Client looks like. Clients need to connect to a Server, send message and process the responses.</p>
+<p><img alt="" src="../../../staticresources/images/mina/clientdiagram.png" /></p>
+<ul>
+<li>Client first creates an IOConnector (MINA Construct for connecting to Socket), initiates a bind with Server</li>
+<li>Upon Connection creation, a Session is created and is associated with Connection</li>
+<li>Application/Client writes to the Session, resulting in data being sent to Server, after traversing the Filter Chain</li>
+<li>All the responses/messages received from Server are traverses the Filter Chain and lands at IOHandler, for processing</li>
+</ul>
+
+
+    <div class="nav">
+        <div class="nav_prev">
+        
+            <a href="server-architecture.html">Server Architecture</a>
+		
+        </div>
+        <div class="nav_up">
+        
+            <a href="application-architecture.html">Application Architecture</a>
+		
+        </div>
+        <div class="nav_next">
+        
+			&nbsp;
+        
+        </div>
+        <div class="clearfix"></div>
+    </div>
+
+
+                </div><!-- rightColumn -->
+                <div id="endContent"></div>
+            </div><!-- content -->
+            <div id="footer">&copy; 2003-2012, <a href="http://www.apache.org">The Apache Software Foundation</a> - <a href="privacy-policy.html">Privacy Policy</a><br />
+                Apache MINA, MINA, Apache Vysper, Vysper, Apache SSHd, SSHd, Apache FtpServer, FtpServer, Apache AsyncWeb, AsyncWeb,
+                Apache, the Apache feather logo, and the Apache Mina project logos are trademarks of The Apache Software Foundation.
+            </div>
+        </div><!-- container -->
+    </body>
+</html>
+

Added: websites/staging/mina/trunk/content/mina/userguide/ch2-basics/sample-tcp-client.html
==============================================================================
--- websites/staging/mina/trunk/content/mina/userguide/ch2-basics/sample-tcp-client.html (added)
+++ websites/staging/mina/trunk/content/mina/userguide/ch2-basics/sample-tcp-client.html Wed Oct 31 04:53:33 2012
@@ -0,0 +1,275 @@
+<!DOCTYPE html>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<html>
+<head>
+	<title>Sample TCP Client  &mdash; Apache MINA</title>
+	
+		<link href="./../../../css/common.css" rel="stylesheet" type="text/css">
+		<link href="./../../../css/mina.css" rel="stylesheet" type="text/css">
+	
+</head>
+  <body>
+    <div id="container">
+      <div id="header">
+        <div id="subProjectsNavBar">
+          <a href="./../../../">
+            
+              Apache MINA Project
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../mina/index.html">
+            
+              <strong>MINA</strong>
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../asyncweb/index.html">
+            
+              AsyncWeb
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../ftpserver/index.html">
+            
+              FtpServer
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../sshd/index.html">
+            
+              Sshd
+            
+          </a>
+          &nbsp;|&nbsp;
+          <a href="./../../../vysper/index.html">
+            
+              Vysper
+            
+          </a>
+        </div><!-- subProjectsNavBar -->
+      </div><!-- header -->
+      <div id="content">
+        <div id="leftColumn">
+                              
+          
+          
+          
+            <div id="navigation">
+
+    <h5>Latest Downloads</h5>
+    <ul>
+        <li><a href="./../../../mina/downloads.html">Mina 2.0.7</a></li>
+    </ul>
+    <h5>Documentation</h5>
+    <ul>
+      <li><a href="./../../../mina/userguide/user-guide-toc.html" class="external-link" rel="nofollow">User guide</a></li>
+      <li><a href="./../../../mina/features.html" class="external-link" rel="nofollow">Features</a/</li>
+      <li><a href="./../../../mina/road-map.html" class="external-link" rel="nofollow">Road Map</a/</li>
+      <li><a href="./../../../mina/faq.html" class="external-link" rel="nofollow">FAQ</a/</li>
+    </ul>
+    <h5>Resources</h5>
+    <ul>
+      <li><a href="./../../../mina/downloads.html" class="external-link" rel="nofollow">Downloads</a></li>
+      <li><a href="./../../../mina/mailing-lists.html" class="external-link" rel="nofollow">Mailing lists & IRC</a></li>
+      <li><a href="./../../../mina/issue-tracking.html" class="external-link" rel="nofollow">Issue tracking</a></li>
+      <li><a href="./../../../mina/sources.html" class="external-link" rel="nofollow">Sources</a></li>
+      <li><a href="./../../../mina/performances.html" class="external-link" rel="nofollow">Performances</a></li>
+      <li><a href="./../../../mina/testimonials.html" class="external-link" rel="nofollow">Testimonials</a></li>
+      <li><a href="./../../../mina/conferences.html" class="external-link" rel="nofollow">Conferences</a></li>
+      <li><a href="./../../../mina/developper-guide.html" class="external-link" rel="nofollow">Developers Guide</a></li>
+      <li><a href="./../../../mina/related-projects.html" class="external-link" rel="nofollow">Related Projects</a></li>
+      <li><a href="http://people.apache.org/~vgritsenko/stats/projects/mina.html" class="external-link" rel="nofollow">Statistics</a></li>
+    </ul>
+
+    <h5>Community</h5>
+    <ul>
+      <li><a href="http://www.apache.org/foundation/contributing.html" class="external-link" rel="nofollow">Contributing</a></li>
+      <li><a href="./../../../contributors.html" class="external-link" rel="nofollow">Team</a></li>
+      <li><a href="./../../../special-thanks.html" class="external-link" rel="nofollow">Special Thanks</a></li>
+      <li><a href="http://www.apache.org/security/" class="external-link" rel="nofollow">Security</a></li>
+    </ul>
+
+    <h5>About Apache</h5>
+    <ul>
+      <li><a href="http://www.apache.org" class="external-link" rel="nofollow">Apache main site</a></li>
+      <li><a href="http://www.apache.org/licenses/" class="external-link" rel="nofollow">License</a></li>
+      <li><a href="http://www.apache.org/foundation/sponsorship.html" title="The ASF sponsorship program" class="external-link" rel="nofollow">Sponsorship program</a></li>
+      <li><a href="http://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</a></li>
+    </ul>
+
+    <h3><a name="Navigation-Upcoming"></a>Upcoming</h3>
+    <ul>
+      <li>No event</li>
+    </ul>
+
+</div>
+
+<!-- navigation -->
+          
+          
+        </div><!-- leftColumn -->
+      <div id="rightColumn">
+
+
+
+    <div class="nav">
+        <div class="nav_prev">
+        
+            <a href="sample-tcp-server.html">Sample TCP Server</a>
+		
+        </div>
+        <div class="nav_up">
+        
+            <a href="ch2-basics.html">Chapter 2 - Basics</a>
+		
+        </div>
+        <div class="nav_next">
+        
+            <a href="sample-udp-server.html">Sample UDP Server</a>
+		
+        </div>
+        <div class="clearfix"></div>
+    </div>
+
+
+<h1 id="sample-tcp-client">Sample TCP Client</h1>
+<p>We have seen the Client Architecture. Lets explore a sample Client implementation.</p>
+<p>We shall use <a href="http://mina.apache.org/report/trunk/xref/org/apache/mina/example/sumup/Client.html">Sumup Client</a> as a reference implementation.</p>
+<p>We will remove boiler plate code and concentrate on the important constructs. Below the code for the Client :</p>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">static</span> <span class="n">void</span> <span class="n">main</span><span class="p">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="p">)</span> <span class="n">throws</span> <span class="n">Throwable</span> <span class="p">{</span>
+    <span class="n">NioSocketConnector</span> <span class="n">connector</span> <span class="o">=</span> <span class="k">new</span> <span class="n">NioSocketConnector</span><span class="p">();</span>
+    <span class="n">connector</span><span class="o">.</span><span class="n">setConnectTimeoutMillis</span><span class="p">(</span><span class="n">CONNECT_TIMEOUT</span><span class="p">);</span>
+
+    <span class="k">if</span> <span class="p">(</span><span class="n">USE_CUSTOM_CODEC</span><span class="p">)</span> <span class="p">{</span>
+    <span class="n">connector</span><span class="o">.</span><span class="n">getFilterChain</span><span class="p">()</span><span class="o">.</span><span class="n">addLast</span><span class="p">(</span><span class="s">&quot;codec&quot;</span><span class="p">,</span>
+        <span class="k">new</span> <span class="n">ProtocolCodecFilter</span><span class="p">(</span><span class="k">new</span> <span class="n">SumUpProtocolCodecFactory</span><span class="p">(</span><span class="n">false</span><span class="p">)));</span>
+    <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+        <span class="n">connector</span><span class="o">.</span><span class="n">getFilterChain</span><span class="p">()</span><span class="o">.</span><span class="n">addLast</span><span class="p">(</span><span class="s">&quot;codec&quot;</span><span class="p">,</span>
+            <span class="k">new</span> <span class="n">ProtocolCodecFilter</span><span class="p">(</span><span class="k">new</span> <span class="n">ObjectSerializationCodecFactory</span><span class="p">()));</span>
+    <span class="p">}</span>
+
+    <span class="n">connector</span><span class="o">.</span><span class="n">getFilterChain</span><span class="p">()</span><span class="o">.</span><span class="n">addLast</span><span class="p">(</span><span class="s">&quot;logger&quot;</span><span class="p">,</span> <span class="k">new</span> <span class="n">LoggingFilter</span><span class="p">());</span>
+    <span class="n">connector</span><span class="o">.</span><span class="n">setHandler</span><span class="p">(</span><span class="k">new</span> <span class="n">ClientSessionHandler</span><span class="p">(</span><span class="nb">values</span><span class="p">));</span>
+    <span class="n">IoSession</span> <span class="n">session</span><span class="p">;</span>
+
+    <span class="k">for</span> <span class="p">(;;)</span> <span class="p">{</span>
+        <span class="n">try</span> <span class="p">{</span>
+            <span class="n">ConnectFuture</span> <span class="n">future</span> <span class="o">=</span> <span class="n">connector</span><span class="o">.</span><span class="nb">connect</span><span class="p">(</span><span class="k">new</span> <span class="n">InetSocketAddress</span><span class="p">(</span><span class="n">HOSTNAME</span><span class="p">,</span> <span class="n">PORT</span><span class="p">));</span>
+            <span class="n">future</span><span class="o">.</span><span class="n">awaitUninterruptibly</span><span class="p">();</span>
+            <span class="n">session</span> <span class="o">=</span> <span class="n">future</span><span class="o">.</span><span class="n">getSession</span><span class="p">();</span>
+            <span class="n">break</span><span class="p">;</span>
+        <span class="p">}</span> <span class="n">catch</span> <span class="p">(</span><span class="n">RuntimeIoException</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
+            <span class="n">System</span><span class="o">.</span><span class="n">err</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="o">&amp;</span><span class="n">quot</span><span class="p">;</span><span class="n">Failed</span> <span class="n">to</span> <span class="nb">connect</span><span class="o">.&amp;</span><span class="n">quot</span><span class="p">;);</span>
+            <span class="n">e</span><span class="o">.</span><span class="n">printStackTrace</span><span class="p">();</span>
+            <span class="n">Thread</span><span class="o">.</span><span class="nb">sleep</span><span class="p">(</span><span class="mi">5000</span><span class="p">);</span>
+        <span class="p">}</span>
+    <span class="p">}</span>
+
+    <span class="sr">//</span> <span class="nb">wait</span> <span class="k">until</span> <span class="n">the</span> <span class="n">summation</span> <span class="n">is</span> <span class="n">done</span>
+    <span class="n">session</span><span class="o">.</span><span class="n">getCloseFuture</span><span class="p">()</span><span class="o">.</span><span class="n">awaitUninterruptibly</span><span class="p">();</span>
+    <span class="n">connector</span><span class="o">.</span><span class="n">dispose</span><span class="p">();</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p>To construct a Client, we need to do following</p>
+<ul>
+<li>Create a Connector</li>
+<li>Create a Filter Chain</li>
+<li>Create a IOHandler and add to Connector</li>
+<li>Bind to Server</li>
+</ul>
+<p>Lets examine each one in detail</p>
+<h2 id="create-a-connector">Create a Connector</h2>
+<div class="codehilite"><pre><span class="n">NioSocketConnector</span> <span class="n">connector</span> <span class="o">=</span> <span class="k">new</span> <span class="n">NioSocketConnector</span><span class="p">();</span>
+</pre></div>
+
+
+<p>Here we have created a NIO Socket connector</p>
+<h2 id="create-a-filter-chain">Create a Filter Chain</h2>
+<div class="codehilite"><pre><span class="k">if</span> <span class="p">(</span><span class="n">USE_CUSTOM_CODEC</span><span class="p">)</span> <span class="p">{</span>
+    <span class="n">connector</span><span class="o">.</span><span class="n">getFilterChain</span><span class="p">()</span><span class="o">.</span><span class="n">addLast</span><span class="p">(</span><span class="s">&quot;codec&quot;</span><span class="p">,</span>
+        <span class="k">new</span> <span class="n">ProtocolCodecFilter</span><span class="p">(</span><span class="k">new</span> <span class="n">SumUpProtocolCodecFactory</span><span class="p">(</span><span class="n">false</span><span class="p">)));</span>
+<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+    <span class="n">connector</span><span class="o">.</span><span class="n">getFilterChain</span><span class="p">()</span><span class="o">.</span><span class="n">addLast</span><span class="p">(</span><span class="s">&quot;codec&quot;</span><span class="p">,</span>
+        <span class="k">new</span> <span class="n">ProtocolCodecFilter</span><span class="p">(</span><span class="k">new</span> <span class="n">ObjectSerializationCodecFactory</span><span class="p">()));</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p>We add Filters to the Filter Chain for the Connector. Here we have added a ProtocolCodec, to the filter Chain.</p>
+<h2 id="create-iohandler">Create IOHandler</h2>
+<div class="codehilite"><pre><span class="n">connector</span><span class="o">.</span><span class="n">setHandler</span><span class="p">(</span><span class="k">new</span> <span class="n">ClientSessionHandler</span><span class="p">(</span><span class="nb">values</span><span class="p">));</span>
+</pre></div>
+
+
+<p>Here we create an instance of <a href="http://mina.apache.org/report/trunk/xref/org/apache/mina/example/sumup/ClientSessionHandler.html">ClientSessionHandler</a> and set it as a handler for the Connector.</p>
+<h2 id="bind-to-server">Bind to Server</h2>
+<div class="codehilite"><pre><span class="n">IoSession</span> <span class="n">session</span><span class="p">;</span>
+
+<span class="k">for</span> <span class="p">(;;)</span> <span class="p">{</span>
+    <span class="n">try</span> <span class="p">{</span>
+        <span class="n">ConnectFuture</span> <span class="n">future</span> <span class="o">=</span> <span class="n">connector</span><span class="o">.</span><span class="nb">connect</span><span class="p">(</span><span class="k">new</span> <span class="n">InetSocketAddress</span><span class="p">(</span><span class="n">HOSTNAME</span><span class="p">,</span> <span class="n">PORT</span><span class="p">));</span>
+        <span class="n">future</span><span class="o">.</span><span class="n">awaitUninterruptibly</span><span class="p">();</span>
+        <span class="n">session</span> <span class="o">=</span> <span class="n">future</span><span class="o">.</span><span class="n">getSession</span><span class="p">();</span>
+        <span class="n">break</span><span class="p">;</span>
+    <span class="p">}</span> <span class="n">catch</span> <span class="p">(</span><span class="n">RuntimeIoException</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">System</span><span class="o">.</span><span class="n">err</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot;Failed to connect.&quot;</span><span class="p">);</span>
+        <span class="n">e</span><span class="o">.</span><span class="n">printStackTrace</span><span class="p">();</span>
+        <span class="n">Thread</span><span class="o">.</span><span class="nb">sleep</span><span class="p">(</span><span class="mi">5000</span><span class="p">);</span>
+    <span class="p">}</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p>Here is the most important stuff. We connect to remote Server. Since, connect is an async task, we use the <a href="http://mina.apache.org/report/trunk/xref/org/apache/mina/core/future/ConnectFuture.html">ConnectFuture</a> class to know the when the connection is complete.
+Once the connection is complete, we get the associated <a href="http://mina.apache.org/report/trunk/xref/org/apache/mina/core/session/IoSession.html">IoSession</a>. To send any message to the Server, we shall have to write to the session. All responses/messages from server shall traverse the Filter chain and finally be handled in IoHandler.</p>
+
+
+    <div class="nav">
+        <div class="nav_prev">
+        
+            <a href="sample-tcp-server.html">Sample TCP Server</a>
+		
+        </div>
+        <div class="nav_up">
+        
+            <a href="ch2-basics.html">Chapter 2 - Basics</a>
+		
+        </div>
+        <div class="nav_next">
+        
+            <a href="sample-udp-server.html">Sample UDP Server</a>
+		
+        </div>
+        <div class="clearfix"></div>
+    </div>
+
+
+                </div><!-- rightColumn -->
+                <div id="endContent"></div>
+            </div><!-- content -->
+            <div id="footer">&copy; 2003-2012, <a href="http://www.apache.org">The Apache Software Foundation</a> - <a href="privacy-policy.html">Privacy Policy</a><br />
+                Apache MINA, MINA, Apache Vysper, Vysper, Apache SSHd, SSHd, Apache FtpServer, FtpServer, Apache AsyncWeb, AsyncWeb,
+                Apache, the Apache feather logo, and the Apache Mina project logos are trademarks of The Apache Software Foundation.
+            </div>
+        </div><!-- container -->
+    </body>
+</html>
+