diff --git a/src/docbook/css/jbossorg.css b/src/docbook/css/jbossorg.css index 1625dc4c61..153e8357a4 100644 --- a/src/docbook/css/jbossorg.css +++ b/src/docbook/css/jbossorg.css @@ -90,10 +90,16 @@ pre a:link * {color:#0066cc !important;} pre a:visited * {color:#6699cc !important;} -.programlistingco pre { +.programlisting, .programlistingco pre { line-height: 160%; } +.programlisting img { + margin: 0; + padding: 0; + vertical-align: middle; +} + span.co { position: relative; left: 0; diff --git a/src/docbook/module/start.xml b/src/docbook/module/start.xml index 4f8adb4d78..36cbcbbee8 100644 --- a/src/docbook/module/start.xml +++ b/src/docbook/module/start.xml @@ -46,14 +46,7 @@ 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; + package org.jboss.netty.example.discard; import org.jboss.netty.channel.&ChannelHandlerContext;; import org.jboss.netty.channel.&ChannelPipelineCoverage;; @@ -61,81 +54,72 @@ 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; { +@&ChannelPipelineCoverage;("all") +public class DiscardServerHandler extends &SimpleChannelHandler; { @Override - public void messageReceived(&ChannelHandlerContext; ctx, &MessageEvent; e) { + public void messageReceived(&ChannelHandlerContext; ctx, &MessageEvent; e) { } @Override - public void exceptionCaught(&ChannelHandlerContext; ctx, &ExceptionEvent; e) { + public void exceptionCaught(&ChannelHandlerContext; ctx, &ExceptionEvent; e) { e.getCause().printStackTrace(); &Channel; ch = e.getChannel(); ch.close(); } } - - - - &ChannelPipelineCoverage; annotates a handler type to tell if the - handler instance of the annotated type can be shared by more than - one &Channel; (and its associated &ChannelPipeline;). - DiscardServerHandler doesn't manage any - stateful information, and therefore it's annotated with the value - "all". It's OK even if you are confused with - this yet. We will revisit it soon. - - - - - DiscardServerHandler extends - &SimpleChannelHandler;, which is an implementation of - &ChannelUpstreamHandler;. &SimpleChannelHandler; provides various - event handler methods that you can override. For now, it's just - enough to extend &SimpleChannelHandler; rather than to implement - handler interfaces. - - - - - We override the messageReceived event - handler method here. This method is called with a &MessageEvent;, - which contains the received data, whenever new data is received - from a client. In this example, we just ignore the received data - by doing nothing to implement the DISCARD protocol. - - - - - exceptionCaught event handler method is - called with an &ExceptionEvent; when an exception was raised by - Netty due to I/O error or by a handler implementation due to the - exception thrown while processing events. In most cases, the - caught exception should be logged and its associated channel - should be closed here, although the implementation of this method - can be different depending on what you want to do to deal with an - exceptional situation. For example, you might want to send a - response message with an error code before closing the connection. - - - - + + + + &ChannelPipelineCoverage; annotates a handler type to tell if the + handler instance of the annotated type can be shared by more than + one &Channel; (and its associated &ChannelPipeline;). + DiscardServerHandler doesn't manage any + stateful information, and therefore it's annotated with the value + "all". It's OK even if you are confused with + this yet. We will revisit it soon. + + + + + DiscardServerHandler extends + &SimpleChannelHandler;, which is an implementation of + &ChannelUpstreamHandler;. &SimpleChannelHandler; provides various + event handler methods that you can override. For now, it's just + enough to extend &SimpleChannelHandler; rather than to implement + handler interfaces. + + + + + We override the messageReceived event + handler method here. This method is called with a &MessageEvent;, + which contains the received data, whenever new data is received + from a client. In this example, we just ignore the received data + by doing nothing to implement the DISCARD protocol. + + + + + exceptionCaught event handler method is + called with an &ExceptionEvent; when an exception was raised by + Netty due to I/O error or by a handler implementation due to the + exception thrown while processing events. In most cases, the + caught exception should be logged and its associated channel + should be closed here, although the implementation of this method + can be different depending on what you want to do to deal with an + exceptional situation. For example, you might want to send a + response message with an error code before closing the connection. + + + So far so good. We have implemented the half of the DISCARD server. What's left now is to write the main method which starts the server up with the DiscardServerHandler. - - - - - - - - - package org.jboss.netty.example.discard; + package org.jboss.netty.example.discard; import java.net.InetSocketAddress; import java.util.concurrent.Executors; @@ -147,46 +131,49 @@ import org.jboss.netty.channel.socket.nio.&NioServerSocketChannelFactory;; public class DiscardServer { public static void main(String[] args) throws Exception { - &ChannelFactory; factory = - new &NioServerSocketChannelFactory;( + &ChannelFactory; factory = + new &NioServerSocketChannelFactory;( Executors.newCachedThreadPool(), Executors.newCachedThreadPool()); - &ServerBootstrap; bootstrap = new &ServerBootstrap;(factory); + &ServerBootstrap; bootstrap = new &ServerBootstrap;(factory); DiscardServerHandler handler = new DiscardServerHandler(); &ChannelPipeline; pipeline = bootstrap.getPipeline(); - pipeline.addLast("handler", handler); + pipeline.addLast("handler", handler); - bootstrap.setOption("child.tcpNoDelay", true); + bootstrap.setOption("child.tcpNoDelay", true); bootstrap.setOption("child.keepAlive", true); - bootstrap.bind(new InetSocketAddress(8080)); + bootstrap.bind(new InetSocketAddress(8080)); } } - - - - &ChannelFactory; is a factory which creates a &Channel; - - - - - - - - - - - - - - - - - - - - + + + + &ChannelFactory; is a factory which creates a &Channel; + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/docbook/xslt/pdf.xsl b/src/docbook/xslt/pdf.xsl index 15e14ad8c7..e23935899f 100644 --- a/src/docbook/xslt/pdf.xsl +++ b/src/docbook/xslt/pdf.xsl @@ -1,8 +1,28 @@ - - + + + + + + + + + + + + + + + normal + + + + +