Servlets and Filters
Resin 3.0

Features
Installation
Configuration
Web Applications
IOC/AOP
Resources
JSP
Quercus
Servlets and Filters
Databases
Admin (JMX)
CMP
EJB
Amber
EJB 3.0
Security
XML and XSLT
XTP
JMS
Performance
Protocols
Third-party
Troubleshooting/FAQ

Servlets
Servlet Lib
run-at
Filters
Filter Lib
Tutorials
FAQ
Quercus
Resin 3.0
Servlets

Servlets

Servlets are Java classes which service HTTP requests. The only requirement for writing a servlet is that it implements the javax.servlet.Servlet interface.

Servlet Library

Resin provides a set of convenient servlets in the com.caucho.servlets.* package.

ErrorStatusServlet

Sends an HTTP error code and optionally an error message back to the client.

LoadBalanceServlet

Configures a front-end Resin instance to load-balance requests to backend Resin instances.

CGIServlet

Implements CGI calls.

DirectoryServlet

The directory servlet provides the basic directory browsing. Sites will normally disable it.

FastCGIServlet

Implements the FastCGI protocol.

HttpProxyServlet

is a servlet that proxies to another server.

WebDAV

WebDAV, web-based distributed authoring and versioning, is a set of extensions to the HTTP protocol that is a convenient replacement for FTP when developing web sites.

run-at: Periodic Services

Some web applications need a task to be run at regular intervals, e.g. once an hour or once a day. For example, a search application might want to spider the web site every day to automatically pick up any new pages. Syndication applications might poll their news sites every hour to check for updates.

Filters
Filter Library

Resin provides a set of convenient filters in the com.caucho.filters.* package.

GzipFilter

The GzipFilter compresses the output of pages for browsers which understand compression, and leaves the output unchanged if the browser does not support compression.

XsltFilter

The XsltFilter transforms the response using xslt.

TransactionFilter

The TransactionFilter wraps the request in a UserTransaction and commits the transaction when the servlet completes.

ExpiresFilter

The ExpiresFilter sets the Expires cache control header, allowing servlet output and jsp results to be cached for a short time.

AnonymousExpiresFilter

The AnonymousExpiresFilter caches the response for anonymous users.

RewriteFilter

The RewriteFilter rewrites and forwards URLs matching a regular expression.

ThrottleFilter

The ThrottleFilter filter implemented with restricts the number of requests from the same IP, defaulting to 2 (the HTTP spec limit.) The ThrottleFilter is useful to limit some parallel download programs that can use more threads than they should.

Servlet and Filter Tutorials
A Hello, World Servlet

A trivial "hello, world" servlet

Bean-style servlet

Resin allows servlets to be configured with bean-style setters.

Sub-bean servlet init

Servlet initializers using the bean-style initialization can set sub-beans.

Filter Templates

This tutorial provides a good source for cut-and-paste development of your own Filters.

Servlets and Filters FAQ

Can I put a filter in resin.conf that get's executed before the filters in web.xml?

I would like to have a filter in resin.conf that always gets executed first in the filter chain to provide stats about the URL's that are called and the response time.


Quercus
Resin 3.0
Servlets
Copyright © 1998-2006 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.