Java8设计模式最佳实战-设计模式概述(第五天学习记录)

Presentation Patterns

In this chapter, we’ll cover each topic by explaining the concept and showing examples of
在本章中,我们将通过解释概念和展示
implementations. After reading this chapter, you will know about these concepts and will
实现。读完这一章,你将了解这些概念
be able to implement them using Java EE 8. Here are the topics that are covered in
能够使用JavaEE8实现它们。以下是中涉及的主题
upcoming sections:
后续章节:
Explaining the presentation tier
解释演示层
Explaining the intercepting filter pattern
解释拦截过滤器模式
Implementing the intercepting filter pattern using Java EE 8
用javaee8实现拦截过滤模式
Explaining the front controller pattern
解释前控制器模式
Implementing the front controller pattern
实现前端控制器模式
Explaining the application controller pattern
解释应用程序控制器模式
Implementing the application controller pattern
实现应用程序控制器模式

Explaining the presentation tier
解释演示层
The Java EE platform is a distributed multitiered application model that has three widely
javaee平台是一个分布式的多层应用程序模型,它有三个广泛的
used common tiers. These tiers are the presentation tier (or web tier), the business tier, and
使用通用层。这些层是表示层(或web层)、业务层和
the integration tier (or EIS tier).
集成层(或EIS层)。
The presentation tier, also known as the web tier, contains the components that create a
表示层,也称为web层,包含创建
web application. This tier has many components that use the HTTP protocol, construct
web应用程序。这个层有许多使用HTTP协议的组件,construct
views and interfaces for users, and provide a web service. These components are called web
为用户提供视图和接口,并提供web服务。这些组件称为web
components. There are two types of presentation tier:
组件。有两种类型的表示层:
Presentation-oriented tier: This type of presentation tier contains the
面向表示层:这种类型的表示层包含
components to construct an interactive web page and dynamic content using
组件来构造交互式网页和使用
HTML and XHTML. These components are JavaServer Faces technology, Java
HTML和XHTML。这些组件是JavaServer Faces技术,Java
Servlet technology, and JavaServer Page technology, which allow us to construct
Servlet技术和JavaServer页面技术,它们允许我们构造
an interactive web page.
一个交互式网页。

Server-oriented tier: This contains the components to construct an endpoint of a
面向服务器层:包含用于构造
web service. These components are JAX-RS and JAX-WS.
网络服务。这些组件是JAX-RS和JAX-WS。
The presentation-oriented tier is generally used on web applications using componentbased specifications such as JavaServer Faces technology, or web applications using actionbased Java Servlet technology as well as JavaServer Pages technology. The server-oriented
面向表示层通常用于使用基于组件的规范(如javaserverfaces技术)的web应用程序,或使用基于action的javaservlet技术以及javaserverpages技术的web应用程序。面向服务器
tier is generally used on web applications that create a REST API or web service that is
tier通常用于创建restapi或web服务的web应用程序
consumed by the client running on a mobile platform or browser. In the following diagram,在这里插入图片描述

由运行在移动平台或浏览器上的客户端使用。在下图中,
we can see how the presentation tier works
我们可以看到表示层是如何工作的

As shown in the preceding diagram, the Client sends a Request to the server; the
如上图所示,客户机向服务器发送一个请求
Presentation Tier processes the request and sends it to the Business Tier; the Business Tier
并向业务层发送请求
then sends a response to the Presentation Tier if the request is not asynchronous, and
如果请求不是异步的,则向表示层发送响应,并且
finally the Presentation Tier processes and sends the response to the Client.
最后,表示层处理并将响应发送到客户端。
Because the Presentation Tier is responsible for promoting HTTP communications and
因为表示层负责促进HTTP通信和
connections with external users, this tier fulfills many interactions and communications
与外部用户的连接,此层完成许多交互和通信
between web components. Numerous tasks need to be performed for this to work well.
在web组件之间。要使这项工作顺利进行,需要执行许多任务。
These tasks include validating the data sent by a client, formatting it, sending it to the
这些任务包括验证客户端发送的数据、格式化数据、将其发送到
correct business component or class, and filtering the data and requests.
正确的业务组件

猜你喜欢

转载自blog.csdn.net/Coder_Boy_/article/details/110379433
今日推荐