Java Reference
In-Depth Information
To implement a <code>Service</code>, the <code>execute()</code>
method is the only method that must be implemented.
public interface Service {
Single method to become a service.
@throws Exception if any exceptions need to be thrown back
to the calling Controller.
public void execute(HttpServletRequest request,
HttpServletResponse response,
ServletContext context) throws Exception;
As you can see, the Service interface contains a single method that takes an
HttpServletRequest , HttpServletResponse , and a ServletContext . Now you can add a new
Service by simply implementing the Service's execute() method.
A Sample Service
To see how easy this model is to extend, let's add a sample Service. The source for this sample
Service can be found in Listing 13.3.
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.ServletContext;
SearchService - This class provides an example of how to add a
Service. It must implement the Servlet interface.
public class ExampleService implements Service {
Empty constructor.
public ExampleService() {
Search WWH ::

Custom Search