* Replaced callout-bug with simple co tags

* Stylesheet update
This commit is contained in:
Trustin Lee 2008-09-20 09:11:54 +00:00
parent 0f3edc8cd8
commit ea7c7e769c
3 changed files with 113 additions and 100 deletions

View File

@ -90,10 +90,16 @@ pre a:link * {color:#0066cc !important;}
pre a:visited * {color:#6699cc !important;} pre a:visited * {color:#6699cc !important;}
.programlistingco pre { .programlisting, .programlistingco pre {
line-height: 160%; line-height: 160%;
} }
.programlisting img {
margin: 0;
padding: 0;
vertical-align: middle;
}
span.co { span.co {
position: relative; position: relative;
left: 0; left: 0;

View File

@ -46,13 +46,6 @@
the received data, and that's all. Let's start straight from the handler the received data, and that's all. Let's start straight from the handler
implementation, which handles I/O events generated by Netty. implementation, which handles I/O events generated by Netty.
</para> </para>
<programlistingco>
<areaspec>
<area id="example.discard.c1" coords="9" />
<area id="example.discard.c2" coords="10" />
<area id="example.discard.c3" coords="13" />
<area id="example.discard.c4" coords="17" />
</areaspec>
<programlisting>package org.jboss.netty.example.discard; <programlisting>package org.jboss.netty.example.discard;
import org.jboss.netty.channel.&ChannelHandlerContext;; import org.jboss.netty.channel.&ChannelHandlerContext;;
@ -61,15 +54,15 @@ import org.jboss.netty.channel.&ExceptionEvent;;
import org.jboss.netty.channel.&MessageEvent;; import org.jboss.netty.channel.&MessageEvent;;
import org.jboss.netty.channel.&SimpleChannelHandler;; import org.jboss.netty.channel.&SimpleChannelHandler;;
@&ChannelPipelineCoverage;("all") @&ChannelPipelineCoverage;("all")<co id="example.discard.co1"/>
public class DiscardServerHandler extends &SimpleChannelHandler; { public class DiscardServerHandler extends &SimpleChannelHandler; {<co id="example.discard.co2"/>
@Override @Override
public void messageReceived(&ChannelHandlerContext; ctx, &MessageEvent; e) { public void messageReceived(&ChannelHandlerContext; ctx, &MessageEvent; e) {<co id="example.discard.co3"/>
} }
@Override @Override
public void exceptionCaught(&ChannelHandlerContext; ctx, &ExceptionEvent; e) { public void exceptionCaught(&ChannelHandlerContext; ctx, &ExceptionEvent; e) {<co id="example.discard.co4"/>
e.getCause().printStackTrace(); e.getCause().printStackTrace();
&Channel; ch = e.getChannel(); &Channel; ch = e.getChannel();
@ -77,7 +70,7 @@ public class DiscardServerHandler extends &SimpleChannelHandler; {
} }
}</programlisting> }</programlisting>
<calloutlist> <calloutlist>
<callout arearefs="example.discard.c1"> <callout arearefs="example.discard.co1">
<para> <para>
&ChannelPipelineCoverage; annotates a handler type to tell if the &ChannelPipelineCoverage; annotates a handler type to tell if the
handler instance of the annotated type can be shared by more than handler instance of the annotated type can be shared by more than
@ -88,7 +81,7 @@ public class DiscardServerHandler extends &SimpleChannelHandler; {
this yet. We will revisit it soon. this yet. We will revisit it soon.
</para> </para>
</callout> </callout>
<callout arearefs="example.discard.c2"> <callout arearefs="example.discard.co2">
<para> <para>
<classname>DiscardServerHandler</classname> extends <classname>DiscardServerHandler</classname> extends
&SimpleChannelHandler;, which is an implementation of &SimpleChannelHandler;, which is an implementation of
@ -98,7 +91,7 @@ public class DiscardServerHandler extends &SimpleChannelHandler; {
handler interfaces. handler interfaces.
</para> </para>
</callout> </callout>
<callout arearefs="example.discard.c3"> <callout arearefs="example.discard.co3">
<para> <para>
We override the <methodname>messageReceived</methodname> event We override the <methodname>messageReceived</methodname> event
handler method here. This method is called with a &MessageEvent;, handler method here. This method is called with a &MessageEvent;,
@ -107,7 +100,7 @@ public class DiscardServerHandler extends &SimpleChannelHandler; {
by doing nothing to implement the DISCARD protocol. by doing nothing to implement the DISCARD protocol.
</para> </para>
</callout> </callout>
<callout arearefs="example.discard.c4"> <callout arearefs="example.discard.co4">
<para> <para>
<methodname>exceptionCaught</methodname> event handler method is <methodname>exceptionCaught</methodname> event handler method is
called with an &ExceptionEvent; when an exception was raised by called with an &ExceptionEvent; when an exception was raised by
@ -121,20 +114,11 @@ public class DiscardServerHandler extends &SimpleChannelHandler; {
</para> </para>
</callout> </callout>
</calloutlist> </calloutlist>
</programlistingco>
<para> <para>
So far so good. We have implemented the half of the DISCARD server. So far so good. We have implemented the half of the DISCARD server.
What's left now is to write the <methodname>main</methodname> method What's left now is to write the <methodname>main</methodname> method
which starts the server up with the <classname>DiscardServerHandler</classname>. which starts the server up with the <classname>DiscardServerHandler</classname>.
</para> </para>
<programlistingco>
<areaspec>
<area id="example.discard2.c1" coords="13" />
<area id="example.discard2.c2" coords="18" />
<area id="example.discard2.c3" coords="21" />
<area id="example.discard2.c4" coords="23" />
<area id="example.discard2.c5" coords="26" />
</areaspec>
<programlisting>package org.jboss.netty.example.discard; <programlisting>package org.jboss.netty.example.discard;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
@ -147,46 +131,49 @@ import org.jboss.netty.channel.socket.nio.&NioServerSocketChannelFactory;;
public class DiscardServer { public class DiscardServer {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
&ChannelFactory; factory = &ChannelFactory;<co id="example.discard2.co1" /> factory =
new &NioServerSocketChannelFactory;( new &NioServerSocketChannelFactory;<co id="example.discard2.co2" />(
Executors.newCachedThreadPool(), Executors.newCachedThreadPool(),
Executors.newCachedThreadPool()); Executors.newCachedThreadPool());
&ServerBootstrap; bootstrap = new &ServerBootstrap;(factory); &ServerBootstrap; bootstrap = new &ServerBootstrap;<co id="example.discard2.co3" />(factory);
DiscardServerHandler handler = new DiscardServerHandler(); DiscardServerHandler handler = new DiscardServerHandler();
&ChannelPipeline; pipeline = bootstrap.getPipeline(); &ChannelPipeline; pipeline = bootstrap.getPipeline();
pipeline.addLast("handler", handler); pipeline.addLast("handler", handler);<co id="example.discard2.co4" />
bootstrap.setOption("child.tcpNoDelay", true); bootstrap.setOption("child.tcpNoDelay", true);<co id="example.discard2.co5" />
bootstrap.setOption("child.keepAlive", true); bootstrap.setOption("child.keepAlive", true);
bootstrap.bind(new InetSocketAddress(8080)); bootstrap.bind(new InetSocketAddress(8080));<co id="example.discard2.co6" />
} }
}</programlisting> }</programlisting>
<calloutlist> <calloutlist>
<callout arearefs="example.discard2.c1"> <callout arearefs="example.discard2.co1">
<para> <para>
&ChannelFactory; is a factory which creates a &Channel; &ChannelFactory; is a factory which creates a &Channel;
</para> </para>
</callout> </callout>
<callout arearefs="example.discard2.c2"> <callout arearefs="example.discard2.co2">
<para> <para>
</para> </para>
</callout> </callout>
<callout arearefs="example.discard2.c3"> <callout arearefs="example.discard2.co3">
<para> <para>
</para> </para>
</callout> </callout>
<callout arearefs="example.discard2.c4"> <callout arearefs="example.discard2.co4">
<para> <para>
</para> </para>
</callout> </callout>
<callout arearefs="example.discard2.c5"> <callout arearefs="example.discard2.co5">
<para>
</para>
</callout>
<callout arearefs="example.discard2.co6">
<para> <para>
</para> </para>
</callout> </callout>
</calloutlist> </calloutlist>
</programlistingco>
</section> </section>
</chapter> </chapter>

View File

@ -1,8 +1,28 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="1.0">
<xsl:import href="http://docbook.sourceforge.net/release/xsl/1.72.0/fo/docbook.xsl" />
<xsl:import href="classpath:/xslt/org/jboss/pdf.xsl" /> <xsl:import href="classpath:/xslt/org/jboss/pdf.xsl" />
<xsl:param name="body.font.family" select="'Times New Roman, serif'" />
<xsl:param name="monospace.font.family" select="'DejaVu Sans Mono, monospace'" />
<xsl:param name="sans.font.family" select="'Arial, sans-serif'" />
<xsl:param name="title.font.family" select="$body.font.family" />
<xsl:param name="programlisting.font" select="$monospace.font.family" /> <xsl:param name="programlisting.font" select="$monospace.font.family" />
<xsl:param name="programlisting.font.size" select="'75%'" />
<xsl:param name="callout.graphics" select="1" />
<xsl:param name="callout.unicode" select="0" />
<xsl:param name="callout.unicode.font" select="'Malgun Gothic, sans-serif'" />
<xsl:param name="ulink.show" select="0"/>
<xsl:attribute-set name="xref.properties"> <xsl:attribute-set name="xref.properties">
<xsl:attribute name="font-style">normal</xsl:attribute> <xsl:attribute name="font-style">normal</xsl:attribute>
</xsl:attribute-set> </xsl:attribute-set>
<xsl:template match="//programlisting/*/text()|//programlisting/*/*/text()">
<fo:inline font-size="75%">
<xsl:value-of select="." />
</fo:inline>
</xsl:template>
</xsl:stylesheet> </xsl:stylesheet>