01.01.2015 Views

UML Weekend Crash Course™ - To Parent Directory

UML Weekend Crash Course™ - To Parent Directory

UML Weekend Crash Course™ - To Parent Directory

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

298<br />

Sunday Afternoon<br />

Model<br />

Controller<br />

JavaBeans<br />

Web<br />

Browser<br />

Java<br />

Servlet<br />

View<br />

JSP pages<br />

with HTML<br />

content<br />

Figure 29-1<br />

<strong>UML</strong> Component diagram, Model 2 Architecture<br />

Web Browser<br />

Servlet<br />

Controller<br />

JSP pages JavaBeans Database<br />

send HTTP request for servlet<br />

verify HTTP request parameters<br />

fulfill business logic of the request<br />

update/query database<br />

forward HTTP request to the<br />

appropriate view<br />

get data from JavaBeans<br />

generate output<br />

send HTTP response<br />

Figure 29-2 <strong>UML</strong> Sequence diagram, Model 2 Architecture<br />

The controller servlet of the Model 2 Architecture offers some additional benefits beyond<br />

the high cohesion and good maintainability of MVC. Because all requests for the Web application<br />

come through one servlet, the developer can place generic security checks and audit<br />

logging code in the servlet and that code will be run for any request for any part of the Web<br />

application.<br />

In the discussion of the case study in Session 28, the two JSP views were separated from<br />

the model. For a full Model 2 Architecture, the development team now adds a single servlet<br />

that will receive all requests that are sent by the Web browser for any part of the Web<br />

application. In this case, the development team decides that having separate controllers for<br />

the wired Web clients and wireless Web clients could enhance maintainability. Thus, they<br />

use two servlet controllers instead of the usual one. Their new architecture is shown in<br />

Figure 29-3.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!