How Tomcat Works

The StaticResourceProcessor Class

The ex02.pyrmont.StaticResourceProcessor class is used to serve requests for static resources. The only method it has is the process method. Listing 2.5 offers the StaticResourceProcessor class.

Listing 2.5: The StaticResourceProcessor class

package ex02.pyrmont;

import java.io.IOException;
public class StaticResourceProcessor {
    public void process(Request request, Response response) {
    try {
        response.sendStaticResource();
        }catch (IOException e) {
        e.printStackTrace();
        }
    }
}

The process method receives two arguments: an ex02.pyrmont.Request instance and an ex02.pyrmont.Response instance. This method simply calls the sendStaticResource method on the Response object.