Sophie

Sophie

distrib > Mandriva > 2010.0 > x86_64 > by-pkgid > c27466c2a3fa3cf6008c3a485d00ce04 > files > 82

jetty5-manual-5.1.15-1.5.2mdv2010.0.noarch.rpm

SECTION: 200-General
TITLE: Servlets v Handlers
QUESTION: Should I use Servlets or HttpHandlers?

Jetty can be used as a HTTP Server, as a Servlet Container or both.  
<p>
If it is being used
as a standard servlet container, then servlets (or filters) should be used for your dynamic 
content.
Servlets may be directly configured in code or jetty.xml, however it is probably best to 
use a standard webapplication layout and a web.xml to configure servlets.

<p>

If Jetty is being used as an embedded HTTP server without servlet support, then
HttpHandler can be used. HttpHandlers are Jetty's own API for handling HTTP requests.
<p>
Only in rare circumstances should both servlets and HttpHandlers be used by a 
developer. 
The Jetty tutorial expands on the difference between Servlets and Handlers.