Separate the user guide out of the project.
This commit is contained in:
parent
e3fdab81ed
commit
4a4e46b83b
@ -1,132 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009 Red Hat, Inc.
|
||||
*
|
||||
* Red Hat 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.
|
||||
*/
|
||||
|
||||
@import url("documentation.css");
|
||||
@import url("docnav.css");
|
||||
@import url("reports.css");
|
||||
@import url("extensions.css");
|
||||
@import url("codehighlight.css");
|
||||
|
||||
body {
|
||||
background-image:url(../images/community/bkg_gradient.gif);
|
||||
background-repeat:repeat-x;
|
||||
margin:0 auto;
|
||||
font-family:'Lucida Grande', Geneva, Verdana, Arial, sans-serif;
|
||||
font-size:12px;
|
||||
max-width:55em;
|
||||
padding:0em 2em;
|
||||
color:#333;
|
||||
line-height:150%;
|
||||
text-align:justify;
|
||||
}
|
||||
|
||||
/* Links */
|
||||
|
||||
a:link {color:#0066cc;}
|
||||
|
||||
a:visited {color:#6699cc;}
|
||||
|
||||
div.longdesc-link {
|
||||
float:right;
|
||||
color:#999;
|
||||
}
|
||||
|
||||
/* Headings */
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
color:#4a5d75;
|
||||
line-height:130%;
|
||||
margin-top:0em;
|
||||
font-family:'Lucida Grande', Geneva, Verdana, Arial, sans-serif;
|
||||
background-color:transparent;
|
||||
}
|
||||
|
||||
h1 {
|
||||
background-image:url(../images/community/title_hdr.png);
|
||||
background-repeat:no-repeat;
|
||||
border-top:1px dotted #CCCCCC;
|
||||
line-height:1.2em;
|
||||
color:#182737;
|
||||
font-size:2em;
|
||||
padding:1.5em;
|
||||
}
|
||||
|
||||
h2 {font-size:1.6em;}
|
||||
|
||||
h3 {
|
||||
font-size:1.3em;
|
||||
padding-top:0em;
|
||||
padding-bottom:0em;
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size:1.1em;
|
||||
padding-top:0em;
|
||||
padding-bottom:0em;
|
||||
}
|
||||
|
||||
h5.formalpara {
|
||||
font-size:1em;
|
||||
margin-top:2em;
|
||||
margin-bottom:.8em;
|
||||
}
|
||||
|
||||
/* Element rules */
|
||||
|
||||
hr {
|
||||
border-collapse:collapse;
|
||||
border-style:none;
|
||||
border-top:1px dotted #ccc;
|
||||
width:100% !important;
|
||||
}
|
||||
|
||||
sup {color:#999;}
|
||||
|
||||
/* Custom overrides */
|
||||
|
||||
tt, tt *, pre, pre *, code, code * {
|
||||
font-size: 100% !important;
|
||||
font-family: "Liberation Mono", "DejaVu Sans Mono", Consolas, Monaco, "Vera Sans Mono", "Lucida Console", "Courier New", monospace !important;
|
||||
}
|
||||
|
||||
pre a:link * {color:#0066cc !important;}
|
||||
|
||||
pre a:visited * {color:#6699cc !important;}
|
||||
|
||||
.programlisting, .programlistingco pre {
|
||||
line-height: 160%;
|
||||
}
|
||||
|
||||
.programlisting img {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
span.co {
|
||||
position: relative;
|
||||
left: 0;
|
||||
top: 0;
|
||||
margin: 0 0;
|
||||
padding: 0 0;
|
||||
height: 17px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
span.co * {
|
||||
margin: 0 0;
|
||||
padding: 0 0;
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
<!--
|
||||
* Copyright 2009 Red Hat, Inc.
|
||||
*
|
||||
* Red Hat 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.
|
||||
-->
|
||||
|
||||
<!-- Frequently used URLs -->
|
||||
|
||||
<!ENTITY Home "http://www.jboss.org/netty/">
|
||||
<!ENTITY Downloads "&Home;downloads.html">
|
||||
<!ENTITY Community "&Home;community.html">
|
||||
<!ENTITY DocHome "http://docs.jboss.org/netty/3.2/">
|
||||
<!ENTITY API "&DocHome;api/org/jboss/netty/">
|
||||
<!ENTITY XRef "&DocHome;xref/org/jboss/netty/">
|
||||
|
||||
<!-- Types in the bootstrap package -->
|
||||
|
||||
<!ENTITY Bootstrap "<ulink url='&API;bootstrap/Bootstrap.html'><classname>Bootstrap</classname></ulink>">
|
||||
<!ENTITY ClientBootstrap "<ulink url='&API;bootstrap/ClientBootstrap.html'><classname>ClientBootstrap</classname></ulink>">
|
||||
<!ENTITY ServerBootstrap "<ulink url='&API;bootstrap/ServerBootstrap.html'><classname>ServerBootstrap</classname></ulink>">
|
||||
|
||||
<!-- Types in the buffer package -->
|
||||
|
||||
<!ENTITY ChannelBuffer "<ulink url='&API;buffer/ChannelBuffer.html'><interfacename>ChannelBuffer</interfacename></ulink>">
|
||||
<!ENTITY ChannelBuffers "<ulink url='&API;buffer/ChannelBuffers.html'><classname>ChannelBuffers</classname></ulink>">
|
||||
|
||||
<!-- Types in the channel package -->
|
||||
|
||||
<!ENTITY Channel "<ulink url='&API;channel/Channel.html'><interfacename>Channel</interfacename></ulink>">
|
||||
<!ENTITY ChannelDownstreamHandler "<ulink url='&API;channel/ChannelDownstreamHandler.html'><interfacename>ChannelDownstreamHandler</interfacename></ulink>">
|
||||
<!ENTITY ChannelEvent "<ulink url='&API;channel/ChannelEvent.html'><interfacename>ChannelEvent</interfacename></ulink>">
|
||||
<!ENTITY ChannelFactory "<ulink url='&API;channel/ChannelFactory.html'><interfacename>ChannelFactory</interfacename></ulink>">
|
||||
<!ENTITY ChannelFuture "<ulink url='&API;channel/ChannelFuture.html'><interfacename>ChannelFuture</interfacename></ulink>">
|
||||
<!ENTITY ChannelFutureListener "<ulink url='&API;channel/ChannelFutureListener.html'><interfacename>ChannelFutureListener</interfacename></ulink>">
|
||||
<!ENTITY ChannelHandler "<ulink url='&API;channel/ChannelHandler.html'><interfacename>ChannelHandler</interfacename></ulink>">
|
||||
<!ENTITY ChannelHandlerContext "<ulink url='&API;channel/ChannelHandlerContext.html'><interfacename>ChannelHandlerContext</interfacename></ulink>">
|
||||
<!ENTITY ChannelPipeline "<ulink url='&API;channel/ChannelPipeline.html'><interfacename>ChannelPipeline</interfacename></ulink>">
|
||||
<!ENTITY ChannelPipelineCoverage "<ulink url='&API;channel/ChannelPipelineCoverage.html'><interfacename>ChannelPipelineCoverage</interfacename></ulink>">
|
||||
<!ENTITY ChannelPipelineFactory "<ulink url='&API;channel/ChannelPipelineFactory.html'><interfacename>ChannelPipelineFactory</interfacename></ulink>">
|
||||
<!ENTITY Channels "<ulink url='&API;channel/Channels.html'><classname>Channels</classname></ulink>">
|
||||
<!ENTITY ChannelStateEvent "<ulink url='&API;channel/ChannelStateEvent.html'><interfacename>ChannelStateEvent</interfacename></ulink>">
|
||||
<!ENTITY ChannelUpstreamHandler "<ulink url='&API;channel/ChannelUpstreamHandler.html'><interfacename>ChannelUpstreamHandler</interfacename></ulink>">
|
||||
<!ENTITY ExceptionEvent "<ulink url='&API;channel/ExceptionEvent.html'><interfacename>ExceptionEvent</interfacename></ulink>">
|
||||
<!ENTITY MessageEvent "<ulink url='&API;channel/MessageEvent.html'><interfacename>MessageEvent</interfacename></ulink>">
|
||||
<!ENTITY SimpleChannelHandler "<ulink url='&API;channel/SimpleChannelHandler.html'><classname>SimpleChannelHandler</classname></ulink>">
|
||||
|
||||
<!-- Types in the channel.group package -->
|
||||
|
||||
<!ENTITY ChannelGroup "<ulink url='&API;channel/group/ChannelGroup.html'><interfacename>ChannelGroup</interfacename></ulink>">
|
||||
<!ENTITY ChannelGroupFuture "<ulink url='&API;channel/group/ChannelGroupFuture.html'><interfacename>ChannelGroupFuture</interfacename></ulink>">
|
||||
<!ENTITY DefaultChannelGroup "<ulink url='&API;channel/group/DefaultChannelGroup.html'><classname>DefaultChannelGroup</classname></ulink>">
|
||||
|
||||
<!-- Types in the channel.socket package -->
|
||||
|
||||
<!ENTITY ServerSocketChannel "<ulink url='&API;channel/socket/ServerSocketChannel.html'><interfacename>ServerSocketChannel</interfacename></ulink>">
|
||||
<!ENTITY SocketChannel "<ulink url='&API;channel/socket/SocketChannel.html'><interfacename>SocketChannel</interfacename></ulink>">
|
||||
|
||||
<!-- Types in the channel.socket.nio package -->
|
||||
|
||||
<!ENTITY NioClientSocketChannelFactory "<ulink url='&API;channel/socket/nio/NioClientSocketChannelFactory.html'><classname>NioClientSocketChannelFactory</classname></ulink>">
|
||||
<!ENTITY NioServerSocketChannelFactory "<ulink url='&API;channel/socket/nio/NioServerSocketChannelFactory.html'><classname>NioServerSocketChannelFactory</classname></ulink>">
|
||||
|
||||
<!-- Types in the handler.codec.frame package -->
|
||||
|
||||
<!ENTITY FrameDecoder "<ulink url='&API;handler/codec/frame/FrameDecoder.html'><classname>FrameDecoder</classname></ulink>">
|
||||
|
||||
<!-- Types in the handler.codec.protobuf package -->
|
||||
|
||||
<!ENTITY ProtobufEncoder "<ulink url='&API;handler/codec/protobuf/ProtobufEncoder.html'><classname>ProtobufEncoder</classname></ulink>">
|
||||
<!ENTITY ProtobufDecoder "<ulink url='&API;handler/codec/protobuf/ProtobufDecoder.html'><classname>ProtobufDecoder</classname></ulink>">
|
||||
|
||||
<!-- Types in the handler.codec.replay package -->
|
||||
|
||||
<!ENTITY ReplayingDecoder "<ulink url='&API;handler/codec/replay/ReplayingDecoder.html'><classname>ReplayingDecoder</classname></ulink>">
|
||||
<!ENTITY VoidEnum "<ulink url='&API;handler/codec/replay/VoidEnum.html'><classname>VoidEnum</classname></ulink>">
|
||||
|
||||
<!-- Types in the handler.ssl package -->
|
||||
<!ENTITY SslHandler "<ulink url='&API;handler/ssl/SslHandler.html'><classname>SslHandler</classname></ulink>">
|
@ -1,63 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
* Copyright 2009 Red Hat, Inc.
|
||||
*
|
||||
* Red Hat 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.
|
||||
-->
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % CustomDTD SYSTEM "custom.dtd">
|
||||
%CustomDTD;
|
||||
]>
|
||||
<book lang="en">
|
||||
<bookinfo>
|
||||
<title>The Netty Project 3.2 User Guide</title>
|
||||
<subtitle>The Proven Approach to Rapid Network Application Development</subtitle>
|
||||
<releaseinfo>
|
||||
<!-- The version.txt file is generated by maven-antrun-plugin. -->
|
||||
<xi:include href="../../../target/version.txt" parse="text"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
</releaseinfo>
|
||||
</bookinfo>
|
||||
|
||||
<toc/>
|
||||
|
||||
<xi:include href="module/preface.xml"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
|
||||
<xi:include href="module/start.xml"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
|
||||
<xi:include href="module/architecture.xml"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
|
||||
<!-- The following chapters are not written yet. -->
|
||||
<!--
|
||||
<xi:include href="module/state-mgmt.xml"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
|
||||
<xi:include href="module/codec.xml"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
|
||||
<xi:include href="module/threading.xml"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
|
||||
<xi:include href="module/security.xml"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
|
||||
<xi:include href="module/transport.xml"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
|
||||
<xi:include href="module/appendix.xml"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
-->
|
||||
</book>
|
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Copyright 2009 Red Hat, Inc.
|
||||
*
|
||||
* Red Hat 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.
|
||||
-->
|
||||
<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % CustomDTD SYSTEM "../custom.dtd">
|
||||
%CustomDTD;
|
||||
]>
|
||||
<appendix id="appendix">
|
||||
<title>Additional Resources</title>
|
||||
<para>To be written...</para>
|
||||
</appendix>
|
@ -1,346 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Copyright 2009 Red Hat, Inc.
|
||||
*
|
||||
* Red Hat 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.
|
||||
-->
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % CustomDTD SYSTEM "../custom.dtd">
|
||||
%CustomDTD;
|
||||
]>
|
||||
<chapter id="architecture">
|
||||
<title>Architectural Overview</title>
|
||||
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="images/architecture.png" format="PNG" scale="50" scalefit="1" align="center" />
|
||||
</imageobject>
|
||||
<textobject>
|
||||
<phrase>The Architecture Diagram of Netty</phrase>
|
||||
</textobject>
|
||||
</mediaobject>
|
||||
|
||||
<para>
|
||||
In this chapter, we will examine what core functionalities are provided in
|
||||
Netty and how they constitute a complete network application development
|
||||
stack on top of the core. Please keep this diagram in mind as you read this
|
||||
chapter.
|
||||
</para>
|
||||
|
||||
<section>
|
||||
<title>Rich Buffer Data Structure</title>
|
||||
<para>
|
||||
Netty uses its own buffer API instead of NIO <classname>ByteBuffer</classname>
|
||||
to represent a sequence of bytes. This approach has significant advantages
|
||||
over using <classname>ByteBuffer</classname>. Netty's new buffer type,
|
||||
&ChannelBuffer; has been designed from the ground up to address the problems
|
||||
of <classname>ByteBuffer</classname> and to meet the daily needs of
|
||||
network application developers. To list a few cool features:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
You can define your own buffer type if necessary.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Transparent zero copy is achieved by a built-in composite buffer type.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
A dynamic buffer type is provided out-of-the-box, whose capacity is
|
||||
expanded on demand, just like <classname>StringBuffer</classname>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
There's no need to call <methodname>flip()</methodname> anymore.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
It is often faster than <classname>ByteBuffer</classname>.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
For more information, please refer to the
|
||||
<ulink url="&API;buffer/package-summary.html#package_description"><literal>org.jboss.netty.buffer</literal> package description</ulink>.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Universal Asynchronous I/O API</title>
|
||||
<para>
|
||||
Traditional I/O APIs in Java provide different types and methods for
|
||||
different transport types. For example,
|
||||
<classname>java.net.Socket</classname> and
|
||||
<classname>java.net.DatagramSocket</classname> do not have any common
|
||||
super type and therefore they have very different ways to perform socket
|
||||
I/O.
|
||||
</para>
|
||||
<para>
|
||||
This mismatch makes porting a network application from one transport to
|
||||
another tedious and difficult. The lack of portability between
|
||||
transports becomes a problem when you need to support additional
|
||||
transports, as this often entails rewriting the network layer of the
|
||||
application. Logically, many protocols can run on more than one
|
||||
transport such as TCP/IP, UDP/IP, SCTP, and serial port communication.
|
||||
</para>
|
||||
<para>
|
||||
To make matters worse, Java's New I/O (NIO) API introduced
|
||||
incompatibilities with the old blocking I/O (OIO) API and will continue
|
||||
to do so in the next release, NIO.2 (AIO). Because all these APIs are
|
||||
different from each other in design and performance characteristics, you
|
||||
are often forced to determine which API your application will depend on
|
||||
before you even begin the implementation phase.
|
||||
</para>
|
||||
<para>
|
||||
For instance, you might want to start with OIO because the number of
|
||||
clients you are going to serve will be very small and writing a socket
|
||||
server using OIO is much easier than using NIO. However, you are going
|
||||
to be in trouble when your business grows exponentially and your server
|
||||
needs to serve tens of thousands of clients simultaneously. You could
|
||||
start with NIO, but doing so may hinder rapid development by greatly
|
||||
increasing development time due to the complexity of the NIO Selector
|
||||
API.
|
||||
</para>
|
||||
<para>
|
||||
Netty has a universal asynchronous I/O interface called a &Channel;, which
|
||||
abstracts away all operations required for point-to-point communication.
|
||||
That is, once you wrote your application on one Netty transport, your
|
||||
application can run on other Netty transports. Netty provides a number
|
||||
of essential transports via one universal API:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
NIO-based TCP/IP transport
|
||||
(See <literal>org.jboss.netty.channel.socket.nio</literal>),
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
OIO-based TCP/IP transport
|
||||
(See <literal>org.jboss.netty.channel.socket.oio</literal>),
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>OIO-based UDP/IP transport, and</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Local transport (See <literal>org.jboss.netty.channel.local</literal>).
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
Switching from one transport to another usually takes just a couple
|
||||
lines of changes such as choosing a different &ChannelFactory;
|
||||
implementation.
|
||||
</para>
|
||||
<para>
|
||||
Also, you are even able to take advantage of new transports which aren't
|
||||
yet written (such as serial port communication transport), again
|
||||
by replacing just a couple lines of constructor calls. Moreover, you can
|
||||
write your own transport by extending the core API.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Event Model based on the Interceptor Chain Pattern</title>
|
||||
<para>
|
||||
A well-defined and extensible event model is a must for an event-driven
|
||||
application. Netty has a well-defined event model focused on I/O. It
|
||||
also allows you to implement your own event type without breaking the
|
||||
existing code because each event type is distinguished from another by
|
||||
a strict type hierarchy. This is another differentiator against other
|
||||
frameworks. Many NIO frameworks have no or a very limited notion of an
|
||||
event model. If they offer extension at all, they often break the
|
||||
existing code when you try to add custom event types
|
||||
</para>
|
||||
<para>
|
||||
A &ChannelEvent; is handled by a list of &ChannelHandler;s in a
|
||||
&ChannelPipeline;. The pipeline implements an advanced form of the
|
||||
<ulink url="http://java.sun.com/blueprints/corej2eepatterns/Patterns/InterceptingFilter.html">Intercepting Filter</ulink>
|
||||
pattern to give a user full control over how an event is handled and how
|
||||
the handlers in the pipeline interact with each other. For example,
|
||||
you can define what to do when data is read from a socket:
|
||||
</para>
|
||||
<programlisting>public class MyReadHandler implements &SimpleChannelHandler; {
|
||||
public void messageReceived(&ChannelHandlerContext; ctx, &MessageEvent; evt) {
|
||||
Object message = evt.getMessage();
|
||||
// Do something with the received message.
|
||||
...
|
||||
|
||||
// And forward the event to the next handler.
|
||||
ctx.sendUpstream(evt);
|
||||
}
|
||||
}</programlisting>
|
||||
<para>
|
||||
You can also define what to do when a handler receives a write request:
|
||||
</para>
|
||||
<programlisting>public class MyWriteHandler implements &SimpleChannelHandler; {
|
||||
public void writeRequested(&ChannelHandlerContext; ctx, &MessageEvent; evt) {
|
||||
Object message = evt.getMessage();
|
||||
// Do something with the message to be written.
|
||||
...
|
||||
|
||||
// And forward the event to the next handler.
|
||||
ctx.sendDownstream(evt);
|
||||
}
|
||||
}</programlisting>
|
||||
<para>
|
||||
For more information on the event model, please refer to the
|
||||
API documentation of &ChannelEvent; and &ChannelPipeline;.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Advanced Components for More Rapid Development</title>
|
||||
<para>
|
||||
On top of the core components mentioned above, that already enable the
|
||||
implementation of all types of network applications, Netty provides a set
|
||||
of advanced features to accelerate the page of development even more.
|
||||
</para>
|
||||
|
||||
<section>
|
||||
<title>Codec framework</title>
|
||||
<para>
|
||||
As demonstrated in <xref linkend="start.pojo"/>, it is always a good
|
||||
idea to separate a protocol codec from business logic. However, there
|
||||
are some complications when implementing this idea from scratch. You
|
||||
have to deal with the fragmentation of messages. Some protocols are
|
||||
multi-layered (i.e. built on top of other lower level protocols). Some
|
||||
are too complicated to be implemented in a single state machine.
|
||||
</para>
|
||||
<para>
|
||||
Consequently, a good network application framework should provide an
|
||||
extensible, reusable, unit-testable, and multi-layered codec framework
|
||||
that generates maintainable user codecs.
|
||||
</para>
|
||||
<para>
|
||||
Netty provides a number of basic and advanced codecs to address most
|
||||
issues you will encounter when you write a protocol codec regardless
|
||||
if it is simple or not, binary or text - simply whatever.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>SSL / TLS Support</title>
|
||||
<para>
|
||||
Unlike old blocking I/O, it is a non-trivial task to support SSL in NIO.
|
||||
You can't simply wrap a stream to encrypt or decrypt data but you have
|
||||
to use <classname>javax.net.ssl.SSLEngine</classname>.
|
||||
<classname>SSLEngine</classname> is a state machine which is as complex
|
||||
as SSL itself. You have to manage all possible states such as cipher
|
||||
suite and encryption key negotiation (or re-negotiation), certificate
|
||||
exchange, and validation. Moreover, <classname>SSLEngine</classname> is
|
||||
not even completely thread-safe, as one would expect.
|
||||
</para>
|
||||
<para>
|
||||
In Netty, &SslHandler; takes care of all the gory details and pitfalls
|
||||
of <classname>SSLEngine</classname>. All you need to do is to configure
|
||||
the &SslHandler; and insert it into your &ChannelPipeline;. It also
|
||||
allows you to implement advanced features like
|
||||
<ulink url="http://en.wikipedia.org/wiki/Starttls">StartTLS</ulink>
|
||||
very easily.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>HTTP Implementation</title>
|
||||
<para>
|
||||
HTTP is definitely the most popular protocol in the Internet. There are
|
||||
already a number of HTTP implementations such as a Servlet container.
|
||||
Then why does Netty have HTTP on top of its core?
|
||||
</para>
|
||||
<para>
|
||||
Netty's HTTP support is very different from the existing HTTP libraries.
|
||||
It gives you complete control over how HTTP messages are exchanged at a
|
||||
low level. Because it is basically the combination of an HTTP codec and
|
||||
HTTP message classes, there is no restriction such as an enforced thread
|
||||
model. That is, you can write your own HTTP client or server that works
|
||||
exactly the way you want. You have full control over everything that's
|
||||
in the HTTP specification, including the thread model, connection life
|
||||
cycle, and chunked encoding.
|
||||
</para>
|
||||
<para>
|
||||
Thanks to its highly customizable nature, you can write a very efficient
|
||||
HTTP server such as:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
Chat server that requires persistent connections and server push
|
||||
technology (e.g. <ulink url="http://en.wikipedia.org/wiki/Comet_%28programming%29">Comet</ulink>
|
||||
and <ulink url="http://en.wikipedia.org/wiki/WebSockets">WebSockets</ulink>)
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Media streaming server that needs to keep the connection open
|
||||
until the whole media is streamed (e.g. 2 hours of video)
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
File server that allows the uploading of large files without
|
||||
memory pressure (e.g. uploading 1GB per request)
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Scalable mash-up client that connects to tens of thousands of 3rd
|
||||
party web services asynchronously
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Google Protocol Buffer Integration</title>
|
||||
<para>
|
||||
<ulink url="http://code.google.com/apis/protocolbuffers/docs/overview.html">Google Protocol Buffers</ulink>
|
||||
are an ideal solution for the rapid implementation of a highly efficient
|
||||
binary protocols that evolve over time. With &ProtobufEncoder; and
|
||||
&ProtobufDecoder;, you can turn the message classes generated by the
|
||||
Google Protocol Buffers Compiler (protoc) into Netty codec. Please take
|
||||
a look into the
|
||||
<ulink url="&XRef;example/localtime/package-summary.html">'LocalTime' example</ulink>
|
||||
that shows how easily you can create a high-performing binary protocol
|
||||
client and server from the
|
||||
<ulink url="http://anonsvn.jboss.org/repos/netty/trunk/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.proto">sample protocol definition</ulink>.
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Summary</title>
|
||||
<para>
|
||||
In this chapter, we reviewed the overall architecture of Netty from the
|
||||
feature standpoint. Netty has a simple, yet powerful architecture.
|
||||
It is composed of three components - buffer, channel, and event model -
|
||||
and all advanced features are built on top of the three core components.
|
||||
Once you understood how these three work together, it should not be
|
||||
difficult to understand the more advanced features which were covered
|
||||
briefly in this chapter.
|
||||
</para>
|
||||
<para>
|
||||
You might still have unanswered questions about what the overall
|
||||
architecture looks like exactly and how each of the features work
|
||||
together. If so, it is a good idea to
|
||||
<ulink url="&Community;">talk to us</ulink> to improve this guide.
|
||||
</para>
|
||||
</section>
|
||||
</chapter>
|
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Copyright 2009 Red Hat, Inc.
|
||||
*
|
||||
* Red Hat 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.
|
||||
-->
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % CustomDTD SYSTEM "../custom.dtd">
|
||||
%CustomDTD;
|
||||
]>
|
||||
<chapter id="codec">
|
||||
<title>Encoders and Decoders</title>
|
||||
<para>To be written...</para>
|
||||
</chapter>
|
@ -1,87 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Copyright 2009 Red Hat, Inc.
|
||||
*
|
||||
* Red Hat 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.
|
||||
-->
|
||||
<!DOCTYPE preface PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % CustomDTD SYSTEM "../custom.dtd">
|
||||
%CustomDTD;
|
||||
]>
|
||||
<preface id="preface">
|
||||
<title>Preface</title>
|
||||
|
||||
<section>
|
||||
<title>The Problem</title>
|
||||
<para>
|
||||
Nowadays we use general purpose applications or libraries to communicate
|
||||
with each other. For example, we often use an HTTP client library to
|
||||
retrieve information from a web server and to invoke a remote procedure
|
||||
call via web services.
|
||||
</para>
|
||||
<para>
|
||||
However, a general purpose protocol or its implementation sometimes
|
||||
does not scale very well. It is like we don't use a general purpose
|
||||
HTTP server to exchange huge files, e-mail messages, and near-realtime
|
||||
messages such as financial information and multiplayer game data.
|
||||
What's required is a highly optimized protocol implementation which is
|
||||
dedicated to a special purpose. For example, you might want to
|
||||
implement an HTTP server which is optimized for AJAX-based chat
|
||||
application, media streaming, or large file transfer. You could even
|
||||
want to design and implement a whole new protocol which is precisely
|
||||
tailored to your need.
|
||||
</para>
|
||||
<para>
|
||||
Another inevitable case is when you have to deal with a legacy
|
||||
proprietary protocol to ensure the interoperability with an old system.
|
||||
What matters in this case is how quickly we can implement that protocol
|
||||
while not sacrificing the stability and performance of the resulting
|
||||
application.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>The Solution</title>
|
||||
<para>
|
||||
<firstterm><ulink url="&Home;">The Netty project</ulink></firstterm> is
|
||||
an effort to provide an asynchronous event-driven network application
|
||||
framework and tooling for the rapid development of maintainable
|
||||
high-performance · high-scalability protocol servers and clients.
|
||||
</para>
|
||||
<para>
|
||||
In other words, Netty is a NIO client server framework which enables
|
||||
quick and easy development of network applications such as protocol
|
||||
servers and clients. It greatly simplifies and streamlines network
|
||||
programming such as TCP and UDP socket server development.
|
||||
</para>
|
||||
<para>
|
||||
'Quick and easy' does not mean that a resulting application will suffer
|
||||
from a maintainability or a performance issue. Netty has been designed
|
||||
carefully with the experiences earned from the implementation of a lot
|
||||
of protocols such as FTP, SMTP, HTTP, and various binary and text-based
|
||||
legacy protocols. As a result, Netty has succeeded to find a way to
|
||||
achieve ease of development, performance, stability, and flexibility
|
||||
without a compromise.
|
||||
</para>
|
||||
<para>
|
||||
Some users might already have found other network application
|
||||
framework that claims to have the same advantage, and you might want
|
||||
to ask what makes Netty so different from them. The answer is the
|
||||
philosophy where it is built on. Netty is designed to give you the most
|
||||
comfortable experience both in terms of the API and the implementation
|
||||
from the day one. It is not something tangible but you will realize that
|
||||
this philosophy will make your life much easier as you read this guide
|
||||
and play with Netty.
|
||||
</para>
|
||||
</section>
|
||||
</preface>
|
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Copyright 2009 Red Hat, Inc.
|
||||
*
|
||||
* Red Hat 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.
|
||||
-->
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % CustomDTD SYSTEM "../custom.dtd">
|
||||
%CustomDTD;
|
||||
]>
|
||||
<chapter id="security">
|
||||
<title>Securing the Wire</title>
|
||||
<para>To be written...</para>
|
||||
</chapter>
|
File diff suppressed because it is too large
Load Diff
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Copyright 2009 Red Hat, Inc.
|
||||
*
|
||||
* Red Hat 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.
|
||||
-->
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % CustomDTD SYSTEM "../custom.dtd">
|
||||
%CustomDTD;
|
||||
]>
|
||||
<chapter id="state-mgmt">
|
||||
<title>State Management</title>
|
||||
<para>To be written...</para>
|
||||
</chapter>
|
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Copyright 2009 Red Hat, Inc.
|
||||
*
|
||||
* Red Hat 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.
|
||||
-->
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % CustomDTD SYSTEM "../custom.dtd">
|
||||
%CustomDTD;
|
||||
]>
|
||||
<chapter id="chapter-id">
|
||||
<title>Chapter title</title>
|
||||
<para>To be written...</para>
|
||||
</chapter>
|
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Copyright 2009 Red Hat, Inc.
|
||||
*
|
||||
* Red Hat 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.
|
||||
-->
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % CustomDTD SYSTEM "../custom.dtd">
|
||||
%CustomDTD;
|
||||
]>
|
||||
<chapter id="threading">
|
||||
<title>Thread Management</title>
|
||||
<para>To be written...</para>
|
||||
</chapter>
|
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Copyright 2009 Red Hat, Inc.
|
||||
*
|
||||
* Red Hat 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.
|
||||
-->
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % CustomDTD SYSTEM "../custom.dtd">
|
||||
%CustomDTD;
|
||||
]>
|
||||
<chapter id="transport">
|
||||
<title>Transports</title>
|
||||
<para>To be written...</para>
|
||||
</chapter>
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 49 KiB |
@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Copyright 2009 Red Hat, Inc.
|
||||
*
|
||||
* Red Hat 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.
|
||||
-->
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||
<xsl:import href="classpath:/xslt/org/jboss/eclipse.xsl" />
|
||||
|
||||
<xsl:param name="siteHref" select="'http://www.jboss.org/netty/'"/>
|
||||
<xsl:param name="docHref" select="'http://www.jboss.org/netty/documentation.html'"/>
|
||||
<xsl:param name="siteLinkText" select="'JBoss.org: Netty - The Client Server Framework and Tools'"/>
|
||||
|
||||
<xsl:param name="callout.defaultcolumn">1</xsl:param>
|
||||
</xsl:stylesheet>
|
@ -1,153 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Copyright 2009 Red Hat, Inc.
|
||||
*
|
||||
* Red Hat 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.
|
||||
-->
|
||||
<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="classpath:/xslt/org/jboss/pdf.xsl" />
|
||||
<xsl:import href="classpath:/xslt/org/jboss/xslt/fonts/pdf/fonts.xsl" />
|
||||
|
||||
<!-- Override the default font settings -->
|
||||
<xsl:template name="pickfont-serif">
|
||||
<xsl:variable name="font">
|
||||
<xsl:call-template name="pickfont"/>
|
||||
</xsl:variable>
|
||||
<xsl:copy-of select="$font"/>
|
||||
<xsl:text>Liberation Serif,serif</xsl:text>
|
||||
</xsl:template>
|
||||
<xsl:param name="title.font.family">
|
||||
<xsl:variable name="font">
|
||||
<xsl:call-template name="pickfont-serif"/>
|
||||
</xsl:variable>
|
||||
<xsl:message>
|
||||
<xsl:text>Setting 'title.font.family' param=</xsl:text><xsl:copy-of select="$font"/>
|
||||
</xsl:message>
|
||||
<xsl:copy-of select="$font"/>
|
||||
</xsl:param>
|
||||
<xsl:param name="body.font.family">
|
||||
<xsl:variable name="font">
|
||||
<xsl:call-template name="pickfont-serif"/>
|
||||
</xsl:variable>
|
||||
<xsl:message>
|
||||
<xsl:text>Setting 'body.font.family' param=</xsl:text><xsl:copy-of select="$font"/>
|
||||
</xsl:message>
|
||||
<xsl:copy-of select="$font"/>
|
||||
</xsl:param>
|
||||
<xsl:param name="monospace.font.family">
|
||||
<xsl:variable name="font">
|
||||
<xsl:call-template name="pickfont-mono"/>
|
||||
</xsl:variable>
|
||||
<xsl:message>
|
||||
<xsl:text>Setting 'monospace.font.family' param=</xsl:text><xsl:copy-of select="$font"/>
|
||||
</xsl:message>
|
||||
<xsl:copy-of select="$font"/>
|
||||
</xsl:param>
|
||||
<xsl:param name="sans.font.family">
|
||||
<xsl:variable name="font">
|
||||
<xsl:call-template name="pickfont-sans"/>
|
||||
</xsl:variable>
|
||||
<xsl:message>
|
||||
<xsl:text>Setting 'sans.font.family' param=</xsl:text><xsl:copy-of select="$font"/>
|
||||
</xsl:message>
|
||||
<xsl:copy-of select="$font"/>
|
||||
</xsl:param>
|
||||
<xsl:param name="programlisting.font">
|
||||
<xsl:variable name="font">
|
||||
<xsl:call-template name="pickfont-mono"/>
|
||||
</xsl:variable>
|
||||
<xsl:message>
|
||||
<xsl:text>Setting 'programlisting.font' param=</xsl:text><xsl:copy-of select="$font"/>
|
||||
</xsl:message>
|
||||
<xsl:copy-of select="$font"/>
|
||||
</xsl:param>
|
||||
<xsl:param name="programlisting.font.size" select="'85%'" />
|
||||
|
||||
<!-- Remove the blank pages between the chapters -->
|
||||
<xsl:param name="double.sided" select="0" />
|
||||
|
||||
<!-- Use SVG for callout images instead of PNG -->
|
||||
<xsl:param name="callout.graphics" select="1" />
|
||||
<xsl:param name="callout.graphics.extension" select="'.svg'" />
|
||||
|
||||
<!-- Hide URL -->
|
||||
<xsl:param name="ulink.show" select="0"/>
|
||||
|
||||
<!-- Don't use italic font for links -->
|
||||
<xsl:attribute-set name="xref.properties">
|
||||
<xsl:attribute name="font-style">normal</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- Decrease the link font size in the program listing -->
|
||||
<xsl:attribute-set name="monospace.properties">
|
||||
<xsl:attribute name="font-size">1em</xsl:attribute>
|
||||
<xsl:attribute name="font-family">
|
||||
<xsl:value-of select="$monospace.font.family"/>
|
||||
</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- Add some spacing between callout listing items -->
|
||||
<xsl:template match="callout">
|
||||
<xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
|
||||
<fo:list-item id="{$id}" space-before="1em">
|
||||
<fo:list-item-label end-indent="label-end()">
|
||||
<fo:block>
|
||||
<xsl:call-template name="callout.arearefs">
|
||||
<xsl:with-param name="arearefs" select="@arearefs"/>
|
||||
</xsl:call-template>
|
||||
</fo:block>
|
||||
</fo:list-item-label>
|
||||
<fo:list-item-body start-indent="body-start()">
|
||||
<fo:block padding-top="0.2em">
|
||||
<xsl:apply-templates/>
|
||||
</fo:block>
|
||||
</fo:list-item-body>
|
||||
</fo:list-item>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Slight baseline-shift for callouts in the program listing -->
|
||||
<xsl:template name="callout-bug">
|
||||
<xsl:param name="conum" select='1'/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$conum <= $callout.graphics.number.limit">
|
||||
<xsl:variable name="filename"
|
||||
select="concat($callout.graphics.path, $conum,
|
||||
$callout.graphics.extension)"/>
|
||||
|
||||
<fo:external-graphic content-width="{$callout.icon.size}"
|
||||
width="{$callout.icon.size}"
|
||||
padding="0.0em" margin="0.0em"
|
||||
baseline-shift="-0.375em">
|
||||
<xsl:attribute name="src">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$passivetex.extensions != 0
|
||||
or $fop.extensions != 0
|
||||
or $arbortext.extensions != 0">
|
||||
<xsl:value-of select="$filename"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>url(</xsl:text>
|
||||
<xsl:value-of select="$filename"/>
|
||||
<xsl:text>)</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
</fo:external-graphic>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
|
@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Copyright 2009 Red Hat, Inc.
|
||||
*
|
||||
* Red Hat 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.
|
||||
-->
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||
<xsl:import href="classpath:/xslt/org/jboss/xhtml-single.xsl" />
|
||||
|
||||
<xsl:param name="siteHref" select="'http://www.jboss.org/netty/'"/>
|
||||
<xsl:param name="docHref" select="'http://www.jboss.org/netty/documentation.html'"/>
|
||||
<xsl:param name="siteLinkText" select="'JBoss.org: Netty - The Client Server Framework and Tools'"/>
|
||||
|
||||
<xsl:param name="callout.defaultcolumn">1</xsl:param>
|
||||
</xsl:stylesheet>
|
@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Copyright 2009 Red Hat, Inc.
|
||||
*
|
||||
* Red Hat 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.
|
||||
-->
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||
<xsl:import href="classpath:/xslt/org/jboss/xhtml.xsl" />
|
||||
|
||||
<xsl:param name="siteHref" select="'http://www.jboss.org/netty/'"/>
|
||||
<xsl:param name="docHref" select="'http://www.jboss.org/netty/documentation.html'"/>
|
||||
<xsl:param name="siteLinkText" select="'JBoss.org: Netty - The Client Server Framework and Tools'"/>
|
||||
|
||||
<xsl:param name="callout.defaultcolumn">1</xsl:param>
|
||||
</xsl:stylesheet>
|
Loading…
Reference in New Issue
Block a user