SOEN 6011 Software Engineering Processes - PowerPoint PPT Presentation

About This Presentation
Title:

SOEN 6011 Software Engineering Processes

Description:

Applet as a client side Java application. ... throws ServletException, IOException. ServletOutputStream out = response.getOutputStream ... – PowerPoint PPT presentation

Number of Views:54
Avg rating:3.0/5.0
Slides: 24
Provided by: ENCS
Category:

less

Transcript and Presenter's Notes

Title: SOEN 6011 Software Engineering Processes


1
SOEN 6011Software Engineering Processes
  • Section SS Fall 2007
  • Dr Greg Butler
  • http//www.cs.concordia.ca/gregb/home/soen6011-f2
    007.html

2
Week 6
  • Servlets and JSP
  • Larman Controller Principle
  • Fowler Front Controller
  • GoF Command pattern
  • Java reflection to instantiate Command

3
Servlets, The General Idea
  • Applet as a client side Java application.
  • Servlet as a server side technology for
    implementing part of the functionality of an
    application.
  • HTTP (URL) requests cause a servlet to be
  • Instantiated (if it did not exist).
  • Run.
  • The servlet builds a response which is then sent
    back to the client (usually in the form of HTML).

4
Servlet HelloWeb
  • public class HelloWebServlet
  • extends HttpServlet
  • protected void doGet(
  • HttpServletRequest request,
  • HttpServletResponse response)
  • throws ServletException, IOException
  • ServletOutputStream out
  • response.getOutputStream()
  • out.println("Hello Web!")

5
Java Server Page
  • Servlet
  • Embed HTML inside code.
  • JSP
  • Embed code inside HTML.

6
HelloWeb.jsp
  • lt_at_ page
  • contentType"text/html charsetiso-8859-1"
    language"java" ... gt
  • lthtmlgt
  • ltbodygt
  • Hello Web!
  • lt/bodygt
  • lt/htmlgt

7
Hello.jsp
  • lt_at_ page
  • contentType"text/html charsetiso-8859-1"
    language"java" ... gt
  • lthtmlgt
  • ltbodygt
  • Hello lt request.getParameter("name") gt
  • lt/bodygt
  • lt/htmlgt

8
Java Server Page
  • Implemented as a (special kind of) servlet.

9
Controller Illustration Web-based EA
10
(No Transcript)
11
PATTERN Controller
  • What object in the domain (or application
    coordination layer) receives requests for work
    from the UI layer?

12
PATTERN Controller (Larman 17.13)
  • Problem What object in the domain (or
    application coordination layer) receives requests
    for work from the UI layer?
  • System operations (see SSD) major input events
    to the system
  • The controller is the first object beyond the UI
    layer that is responsible for receiving or
    handling a system operations message.
  • Note that UI objects delegate system operation
    request to a controller.

13
PATTERN Controller (Larman 17.13)
  • Solution Assign the responsibility to a class
    representing one of the following choices
  • A façade controller, which represents
  • the overall system
  • A root object
  • A device that the software is running within, or
  • A major subsystem
  • A use case or session controller which represents
    a use case scenario in which the system operation
    occurs

14
Fig. 17.21
15
Fowlers EA Patterns
Template View
Page Controller
Presentation
Front Controller
Transform View
Domain Model
Transaction Script
Domain
Table Module
Active Record
Data Mapper
Row Data Gateway
Table Data Gateway
Data Source
16
Front Controller
  • Fowler A controller that handles all requests
    for a web site.
  • The Front Controller consolidates all request
    handling by channeling requests through a single
    handler object. This object can carry out common
    behaviour which can be modified at runtime with
    decorators. This handler then dispatches to
    command objects for behaviour particular to a
    request.

17
Front Controller
  • GoF design pattern Command
  • Use a Command object to encapsulate the steps
    that are executed by a command.
  • CommanddoIt() executes command
  • Allows CommandunDoIt() etc
  • GoF design pattern Decorator
  • Decoratorm() adds additional behaviour, but
    delegates to real Objectm() for real behaviour
  • Eg, logging command execution before/after
    executing command

18
Page vs Front Controller Differences in URL
  • Page Controllers for A1
  • http/stu.cs/343A1/ViewTaskList
  • http/stu.cs/343A1/AddTask
  • http/stu.cs/343A1/RemoveAllTasks
  • Front Controller for A1
  • Base URL http/stu.cs/343A1/frontController
  • /frontController?commandViewTaskList
  • /frontController?commandAddTaskGradetitleabc

19
Front Controller
20
Front Controller
21
Front Controller Sequence Diagram
22
Front Controller ProcessRequest
23
Front Controller (contd)
Write a Comment
User Comments (0)
About PowerShow.com