From b571bdc0e2cc31e7bdc7fef4ea9648f9b33329b5 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Fri, 19 Sep 2008 07:28:48 +0000 Subject: [PATCH] * Updated to the latest version of jdocbook plugin and jbossorg styles * Writing the getting started chapter... --- pom.xml | 9 ++--- src/docbook/module/start.xml | 78 +++++++++++++++++++++++++++++++++++- 2 files changed, 81 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 9d5a7855ce..bed385e660 100644 --- a/pom.xml +++ b/pom.xml @@ -316,7 +316,6 @@ org.jboss.maven.plugins maven-jdocbook-plugin - 2.0.0 generate-docbook @@ -331,12 +330,12 @@ org.jboss jbossorg-docbook-xslt - 1.0.0 + 1.1.0 org.jboss jbossorg-jdocbook-style - 1.0.0 + 1.1.0 jdocbook-style @@ -352,12 +351,12 @@ html - classpath:/xslt/org/jboss/main-html.xsl + classpath:/xslt/org/jboss/xhtml.xsl index.html html_single - classpath:/xslt/org/jboss/nochunk-html.xsl + classpath:/xslt/org/jboss/xhtml-single.xsl index.html diff --git a/src/docbook/module/start.xml b/src/docbook/module/start.xml index eff7b6cda6..3ab60a7700 100644 --- a/src/docbook/module/start.xml +++ b/src/docbook/module/start.xml @@ -2,5 +2,81 @@ Getting Started - To be written... + + This chapter tours around the core constructs of Netty with simple + examples to let you get started with Netty easily. You should be able to + write a network application on top of Netty right away when you are at the + end of this chapter. + + + If you prefer the top-down approach in learning something, you might want + to start from and get back here. + + +
+ Minimum Requirement + + The minimum requirements to run the examples which are introduced in + this chapter are just two; the latest version of Netty release and JDK + 1.5 or above. The latest version of Netty is available in + the project + download page. To get the right version of JDK, please refer to + your preferred JDK vendor's web site. + + + Is that all? To tell the truth, you should find these two are just + enough to implement almost any type of protocols. Otherwise, please + feel free to + contact the Netty + project team and let us know what's missing. + +
+ +
+ Writing a Discard Server + + The most simplistic protocol in the world is not 'Hello, World!' but + DISCARD. It's + a protocol which discards any received data without any response. + + + What you are supposed to do to implement the DISCARD protocol is to log + the received data, and that's all. Let's start straight from the handler + implementation, which handles I/O events generated by Netty. + + + + + + package org.jboss.netty.example.discard; + +import org.jboss.netty.channel.ChannelHandlerContext; +import org.jboss.netty.channel.ChannelPipelineCoverage; +import org.jboss.netty.channel.ExceptionEvent; +import org.jboss.netty.channel.MessageEvent; +import org.jboss.netty.channel.SimpleChannelHandler; + +@ChannelPipelineCoverage("all") +public class DiscardServerHandler extends SimpleChannelHandler { + + @Override + public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) { + } + + @Override + public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) { + e.getCause().printStackTrace(); + e.getChannel().close(); + } +} + + + + TEST! + + + + +
+