Learn Java for Web Development

(Tina Meador) #1
CHAPTER 3: Best Practices in Java EE Web Development 155

Service to Worker

The Service to Worker design pattern assembles two patterns, Front Controller and View Helper, into
a microframework with a dispatcher component to utilize the benefits associated with each pattern.


The Service to Worker pattern is a combination of a dispatcher with views and helpers to handle
client requests and to generate dynamic content as the response. The Service to Worker pattern can
be used in an application when the application requires dynamic content generation.


The members of the Service to Worker pattern, as illustrated in Figure 3-17, are as follows:


   Front controller
 Dispatcher
 Helper
 View
 View helper

Client

Request

Delegate

Dispatch
Gather data

get Data

Front Controller Dispatcher View Helper View Helper

Figure 3-16. Dispatcher View sequence diagram

Free download pdf