Overall structure and hierarchical relationship in web applications

zhaozj2021-02-16  62

Network level internal principles

This chapter will explain how to design and utilize the physical and logic of the web level. We will tell the relationships of each building and the role played by the various components throughout the application. It will be particularly concerned about the Web layer, which allows applications and clients to communicate and interoperate through web pages.

Struts framework is based on Java Servlet and Java Server Page technology, and on this basis, it is independent in a web container. For Struts developers, understand how the web container handles client requests is a basis for the Framework itself. This chapter will explain a variety of components of the web container and explain their functions in detail.

System structure preview

This part we will see the Struts application structure from a higher level. Although this section shows the company's application structure, it is not all written use of Struts to be applied and so. But this type of application allows us to understand how many configuration Struts applications.

Many applications, especially J2EE applications, can be layered. The function of the application is divided into many opposing layers, or functional layers, which can achieve duties, reuse, and more scalable, and many other benefits. This separation may be physically separated, that is to say distributed on separate hardware resources, or pure logic functions. In this case, it is a layer or multilayer disposed on the same hardware resource, but this separation is given in the form of software. The figure below shows a typical hierarchy of Struts applications.

Not each Struts application is included in the above figure. For many smaller applications, the intermediate layer is mainly consisting of a Web container, and then interacts directly by it and databases in the Enterprise Information System (EIS) layer.

Note: What is a container?

There are a variety of containers. EJB container, web container, servlet container, etc. In short. The container is the environment that is provided to the software component, does not require concerns of component developers. The Web container allows the Servlet, JSP components, and other Java classes to be configured therein. Like JNDI, connecting pools, and business services can be configured at the level of the container, and component developers do not need to worry about the management of these resources; this is similar to the EJB container management of security transactions and entity pools. Bean pooling.

When we use the service provided by the container, component developers may have to give up control of container environments and do not require developers to worry about compilation. Third-party providers must follow the public rules that are published to build a container. Although third-party providers can implement part of the container in their own way, they must follow this rule to ensure that developers can make it easy to develop.

Client layer

The client layer provides a way to interact for users and applications. This interaction can pass through the browser, may also be a way to implement a network service interface. No matter which type of customer, this interaction includes executing a request and receives some reflection from the intermediate layer.

For the Struts framework application, the longest customer type is a web browser. However, it is also possible to have types of wireless devices and Java Applet.

Web layer

Figure 2-1 shows the intermediate layer is integrated with the Web layer and some application service components. In Figure 2-1, it is an EJB container. These two layers are often combined, and many application services include web layer functions.

The Web layer provides the ability to interact with the client and the application logic of other layers. In many general web applications, this layer is generally not logically logic. In larger enterprise applications, the Web layer is a translator that allows HTTP requests to map to other services in the middle layer.

The Web layer is also responsible for processing the screen process in accordance with the application and user status. The Web layer also interacts with the database or in enterprise applications as the application server. The web layer is a binder that is equivalent to bonding the background transaction system of the customer application and the core. Components in the Web layer allow developers to extend the functionality of the web service. For Struts, it uses the frame component running in the servlet container.

middle layer

The intermediate layer is often referred to as an application layer or a server. This part is attributed to this fact that there is often a server at this layer. Not all applications are available. This is even more such for small web applications. Many small engineering choices give up using large application servers and interact directly with the database or some of the other data stores. When an application server exists, the web layer uses some of RMI's variants to interact with them. When the EJB service exists in this layer, the AC protocol is RMI based on IIOP.

Note: RMI OVERIIOP

Remote Method Invocation (RMI) Allows the method on the remote object. RMI's Java implementation is a well-known Java Remote Method Call Protocol (JRMP) that there is already a certain time, which is specifically designed for Java remote communication.

There is a problem with the Java version of the RMI, that is, the JVM must run at the client and the server, which can only be used. For many other languages ​​(like C ), Java needs to interact with these systems. In this way, RMI Over IIOP appears.

INTENET Interoperability Protocol (IIOP) is designed to make distributed components interact with each other through TCP / IP. IIOP is the language and platform opposite.

Therefore, Java can interact on a wide variety of platforms by using RMIs on the IIOP. RMI / IIOP is as written, it is necessary to support the EJB server, and therefore exist in the specifications of EJB and J2EE.

When including the application layer, it provides more scalability, fault-tolerant and highly available architectures. Of course, it relies on many different factors. One of the main purposes is to separate the functions of the performance from the model and transaction rules. Modern, many web applications are used as an application layer with an EJB server. They may not use all aspects of the J2EE architecture, such as EJBS, but there are many other benefits caused by the existence of J2EE servers.

Enterprise Information System Layer (EIS)

The enterprise information system layer includes data and services used throughout the enterprise. It provides corporate resources, including database, mainframe, user relationship management applications (CRM), resource planning systems.

The intermediate layer interacts by using protocols for this resource and components in the enterprise information system. For example, the intermediate layer typically uses a JDBC driver to interact with the relational database. For enterprise resource planning systems, although some systems and other resources begin to support more like web services, private adapters are still used.

This is my first translation, there is a place where you are not right. And send your opinions to my email: Anywn_ldh@126.com

转载请注明原文地址:https://www.9cbs.com/read-23842.html

New Post(0)