2. Handler architecture
based on Netty 4
Request
(Inbound)
Response
(Outbound)
ServerSsl
Aggregates
HttpObjects (headers
and contents) to make
Xitrum HandlerEnv; all
Xitrum handlers work
with HandlerEnv
Request2Env
ChunkedWrite
NoPipelining
Env2Response
SetCORS
BasicAuth
OPTIONSResponse
PublicFileServer
FixiOS6SafariPOST
PublicResourceServer
Serves resource files in
classpath (and JAR files)
HttpResponseEncoder
BaseUrlRemover
Serves static files in
public directory
HttpRequestDecoder
XSendFile
UriParser
XSendResource
MethodOverrider
Selects and calls action
(see next slide)
Converts Xitrum
HandlerEnv to Netty’s
FullHttpResponse
Shortcut may happen
(action will not be
called at Dispatcher)
ResponseCacher
Dispatcher
BadClientSilencer
Catches all errors
These 4 handlers are
provided by Netty; the
others are created by
Xitrum
Action#execute
respondText, respondVi
ew,
respondFile,
respondBinary etc.
3. Routing
• Route collection:
At startup, Xitrum automatically collects all
routes specified by annotations
@GET(“hello”), @POST(“hi”) etc.
• Routing:
At “Dispatcher” (see previous slide), the an
instance of the specified action class is created
and its “execute” method is called.