Implementation method of front-end and back-end separation of architecture, architecture system and request processing method
By introducing the intermediate entry layer and the front end of the VUE architecture in the monomer structure system, the front end of the single structure system only supports the IE browser, and the multi -browser support and the front -end separation of the front and rear ends have improved. Expansion.
Patent Information
- Application Number
- CN202211105649.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-07
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2042-09-07
AI Technical Summary
The front end of the existing monolithic system only supports IE browser, which cannot meet the business's needs for the system to support multiple browsers.
By setting up the intermediate entry layer in the existing architecture, the back end of the unit architecture is encapsulated, and the front end of the single architecture is the front end of the Vue architecture to achieve the front and back end of the architecture.
The front-end page is developed under the VUE architecture, supports multiple browsers, and separates the front-end and back-end without changing the back-end architecture, shortening the front-end business transformation cycle.
Smart Images

Figure CN116319950B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an implementation method for separating the front-end and back-end of an architecture, an architecture system, and a request processing method. Background Art
[0002] At present, the architecture of many organizations is a monolithic system, which is generally composed of a reverse proxy server, a database, and an application. All business modules are packaged and run in one application. The front-end page of the monolithic system is a monolithic JSP page, which only supports IE browsers and cannot meet the business requirements for the system to support multiple browsers. Summary of the invention
[0003] In view of the above situation, the embodiments of the present application propose an implementation method for separating the front-end and back-end of the architecture, an architecture system, and a request processing method. The implementation method for separating the front-end and back-end of the architecture is to add a layer of encapsulation on the basis of the existing architecture, which is specifically used to receive the json request of the front-end, so that the front-end page can be developed and modified using the VUE framework, thereby achieving the purpose of supporting multiple browsers.
[0004] In a first aspect, an embodiment of the present application provides a method for implementing front-end and back-end separation of an architecture, the method comprising:
[0005] Setting an intermediate access layer, embedding the original architecture, wherein the original architecture includes a monolithic architecture front end and a monolithic architecture back end;
[0006] Converting the monolithic architecture front end into a VUE architecture front end, and encapsulating the monolithic architecture back end with the intermediate access layer to obtain a separated service back end;
[0007] Performing architecture information configuration on the separated service backend, and unifying the architecture specifications of the VUE architecture frontend and the separated service backend;
[0008] The front-end request processing logic is defined so that the front-end request is processed in sequence by the VUE architecture front-end, the middle access layer and the monolithic architecture back-end to achieve the separation of the front-end and back-end of the architecture.
[0009] In a second aspect, the embodiment of the present application further provides a front-end and back-end separation architecture, the front-end and back-end separation architecture comprising: a VUE architecture front-end, and a separated service back-end;
[0010] The separated service backend includes: an intermediate access layer and a monolithic architecture backend;
[0011] The intermediate access layer includes a filter layer and an interface layer; the filter layer is placed in front of the monomer architecture back end; and the interface layer encapsulates the filter layer and the monomer architecture back end.
[0012] In a third aspect, an embodiment of the present application further provides a request processing method, which is applied to the above-mentioned front-end and back-end separation architecture;
[0013] The method comprises:
[0014] Receive the front-end request through the VUE architecture front-end, and send the received front-end request to the filtering layer;
[0015] Through the filtering layer, the front-end request is authenticated, and the authenticated front-end request is sent to the interface layer;
[0016] Through the interface layer, the received front-end request is processed as an input parameter, the corresponding target class and target method are determined based on the Java reflection mechanism, the target class is instantiated, and the service of the monolithic architecture backend is called to execute the determined target method to generate feedback information of the front-end request, and the feedback information is returned to the VUE architecture front-end.
[0017] In a fourth aspect, an embodiment of the present application further provides an electronic device, comprising: a processor; and a memory arranged to store computer executable instructions, wherein the executable instructions, when executed, cause the processor to perform any of the above methods.
[0018] In a fifth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores one or more programs, and when the one or more programs are executed by an electronic device including multiple application programs, the electronic device executes any of the above methods.
[0019] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:
[0020] This application sets an intermediate access layer in the original architecture, uses the intermediate access layer to encapsulate the monolithic architecture backend, obtains a separated service backend, and converts the monolithic architecture frontend into a VUE architecture frontend; then configures the architecture information for the separated service backend, unifies the architecture specifications of the VUE architecture frontend and the separated service backend, and defines the frontend request processing logic, so that the frontend request is processed in turn by the VUE architecture frontend, the intermediate access layer, and the monolithic architecture backend, thereby realizing the separation of the frontend and backend of the architecture, and the frontend page is developed in the VUE architecture, which can enable the system to support multiple browsers. This application realizes the separation of the frontend and backend architectures without changing the overall background architecture, and under the premise of ensuring that the normal business development is not affected during the frontend page transformation, so that the business system can support multiple browsers. The code of this application scheme is small intrusive, the adjustment amount is small and concentrated, and it is easy to deploy, which greatly shortens the frontend business transformation cycle. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0022] Figure 1 A schematic diagram showing the structure of a single-frame system according to the prior art of the present application is shown;
[0023] Figure 2 A flow chart showing a method for implementing front-end and back-end separation of an architecture according to an embodiment of the present application;
[0024] Figure 3 A schematic diagram showing the structure of a front-end and back-end separation architecture system according to an embodiment of the present application is shown;
[0025] Figure 4 A schematic diagram of the structure of a front-end and back-end separation architecture system according to another embodiment of the present application is shown;
[0026] Figure 5 A schematic diagram showing a process flow of a request processing method according to an embodiment of the present application is shown;
[0027] Figure 6 This is a schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0028] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0029] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0030] Figure 1 A schematic diagram of a monolithic architecture system according to the prior art of the present application is shown. Figure 1It can be seen that the monolithic architecture system 100 includes a monolithic architecture front end 110 and a monolithic architecture back end 120. Among them, the monolithic architecture front end 110 only supports JSP page development, that is, it only supports the IE browser, and the monolithic architecture back end 120 is usually a framework based on the SSH architecture. The monolithic architecture system of the prior art has many advantages. For example, when the business is simple, development, testing, deployment, and expansion are all simple. However, the monolithic architecture system also has many disadvantages, such as slow compilation, slow startup, code conflicts, etc., and its front end only supports the IE browser. The target country is promoting the information technology application innovation industry (referred to as "IT innovation" for short). Such a single browser cannot meet the IT innovation's requirement for the system to support multiple browsers.
[0031] The monolithic architecture back end 120 is divided into many business modules from a business perspective, such as a list module, a policy module, an endorsement module, and so on. In the case where the monolithic architecture back end 120 is a framework based on the SSH architecture, the monolithic architecture back end 120 includes a persistence layer, a DAO layer, a business layer, and a WEB layer from the overall logic from the bottom to the front end.
[0032] Figure 2 The flowchart showing the implementation method of separating the front and back ends of the architecture according to an embodiment of the present application is from Figure 2 It can be seen that the present application at least includes steps S210 to S240:
[0033] Step S210: Set up an intermediate access layer and embed the original architecture, where the original architecture includes a monolithic architecture front end and a monolithic architecture back end.
[0034] The original architecture described here can be any one of the existing monolithic architectures. Here, taking Figure 1 the monolithic architecture system in the prior art shown as an example, from Figure 1 It can be seen that the monolithic architecture system 100 includes a monolithic architecture front end 110 and a monolithic architecture back end 120, where the monolithic architecture back end 120 is a background server based on the SSH architecture. The monolithic architecture back end 120 contains many business modules. Taking the insurance industry as an example, the multiple business modules can include: a list module, a policy module, an endorsement module, and so on.
[0035] First, set up an intermediate access layer. The function of this intermediate access layer is to intercept requests from the front end and perform preprocessing and transformation.
[0036] Step S220: Convert the monolithic architecture front end into a VUE architecture front end, and encapsulate the monolithic architecture back end using the intermediate access layer to obtain a separated service back end.
[0037] The monolithic architecture backend 120 is encapsulated by using an intermediate layer. During the encapsulation process, the overall architecture of the monolithic architecture backend 120 is changed. Taking the monolithic architecture backend 120 as an example, its overall logic from the bottom to the front end includes a persistence layer, a DAO layer, a business layer, and a WEB layer, and its overall logic does not need to be changed.
[0038] The middle access layer can use but is not limited to Servlet. Servlet (Server Applet) is the abbreviation of Java Servlet, also known as a small service program or service connector. It is a server-side program written in Java and has the characteristics of being independent of platforms and protocols. Its main function is to interactively browse and generate data and generate dynamic Web content.
[0039] The middle access layer exchanges data with each layer in the monolithic architecture backend 120 , and can exchange data with each layer of the monolithic architecture backend 120 .
[0040] Meanwhile, the monolithic architecture front end 110 can be converted into a VUE architecture front end. Specifically, the VUE architecture front end includes a VUE architecture front end page and a VUE architecture front end application layer. In the implementation operation, the VUE architecture front end page is developed based on the VUE architecture front end application layer.
[0041] Figure 3 A schematic diagram of the structure of a front-end and back-end separation architecture system according to an embodiment of the present application is shown. Figure 3 It can be seen that the front-end and back-end separation architecture system 300 includes a VUE architecture front-end 310 and a separated service back-end 320; the VUE architecture front-end 310 includes a VUE architecture front-end page 311 and a VUE architecture front-end application layer 312, and the separated service back-end 320 includes an intermediate access layer 321 and a monolithic architecture back-end 322.
[0042] from Figure 3 It can be seen that the separated service backend 320 is obtained by encapsulating the monolithic architecture backend 322 using the intermediate access layer 321. The "encapsulation" mentioned here does not mean that the monolithic architecture backend 322 is loaded by the intermediate access layer 321 physically, but that the data interaction between the intermediate access layer 321 and the monolithic architecture backend 322 can be realized. To put it more simply, the request from the front end first passes through the intermediate access layer 321 and then reaches the monolithic architecture backend 322.
[0043] It should be noted that the monolithic architecture backend 322 and Figure 1 The structure of the monolithic backend 120 shown is consistent, such as a monolithic service backend of an SSH architecture, and a Struts2 architecture is specifically preferred.
[0044] Step S230: Configuring architecture information for the separated service backend, and unifying architecture specifications of the VUE architecture frontend and the separated service backend.
[0045] The following description takes the monolithic architecture backend 322 in the separated service backend 320 as the Struts2 architecture. Specifically, first, some corresponding configurations need to be performed on the monolithic architecture backend 322.
[0046] By analyzing multiple systems in the prior art, it can be seen that front-end requests usually include general requests, file uploads, file downloads, DWR requests, other special requests, etc. General requests include but are not limited to Get requests, Post requests, etc.; file uploads include but are not limited to list Excel imports, etc.; file downloads include but are not limited to error information Excel downloads, etc.; DWR requests include but are not limited to product selection, etc.
[0047] For these common requests, the original configuration information of the original monolithic architecture backend 322 (monolithic structure backend 120) can be directly used without additional related configuration.
[0048] As for other special requests, they may be requests for special scenarios. For this, the method that needs to be jumped can be customized according to the request path. That is, this application supports extensible custom configuration, and personalized function points can be individually configured and processed in a customized manner.
[0049] For these special requests, a special request configuration file can be added, which includes a target class and a target method for processing special requests, wherein the target method can process the input parameters of the special request; configure the special request format, and the special request uniform resource locator = class full path#method name.
[0050] In this embodiment, the keyword of the front-end and back-end separation architecture system 300 is set to newFrame, and the configuration of the special request configuration file can be simply described as the following steps:
[0051] Step 1: Add a configuration file (remembered as a special request configuration file): / config / newFrameSpecialUrl.properties. This configuration file is used for special processing of special requests (special urls) in the front-end and back-end separation architecture newFrame. For the url in this configuration file, the configured target method will be executed instead of the existing subsequent logic of the front-end and back-end separation architecture system 300.
[0052] Step 2: Requirements for special request processing methods: The target method must support input parameters; such as HttpServletRequestrequest, HttpServletResponse response.
[0053] Step 3: Configuration format: special url = class full path # method name, such as: / policy / queryFwManager = com.sinosoft.prpins.policy.web.PolicyAction#queryFwManager.
[0054] In addition, it is necessary to unify the architecture specifications of the VUE architecture front end 310 and the separated service back end 320, including the request path identifier, request content type, and response format. For example, for the request path identifier, a url unified identifier can be defined, and then the url unified identifier can be added to the request path identifier.
[0055] Specifically, the unified architecture specification includes: request path identifier, request content type, and response format; wherein the request content type includes: Dwr request identifier, and Dwr request parameters; the response format includes: business logic judgment parameters, and business information parameters.
[0056] More specifically, in some embodiments of the present application, a unified URL identifier of the front-end and back-end separation architecture is set: / newFrame, such as http: / / localhost:9527 / agriins / new Frame / common / process Code Input.
[0057] Set the unified request content type: Content-Type: application / x-www-form-urlencoded; charset = UTF-8.
[0058] Set the Dwr request identifier: / dwr, such as http: / / localhost:9527 / agriins / newFrame / dwr / dwrInvokeData Action / get Class Code.
[0059] Set the unified parameters of Dwr request: dwrParam: such as dwrParam: " or dwrParam: {}.
[0060] Set a unified response format. The response format includes but is not limited to the following parameters.
[0061] status (not involved in business logic judgment): response code, 0-success, -1-abnormal.
[0062] statusText (not involved in business logic judgment): response text (abnormal situation: during development, specific abnormal information can be responded to for easy analysis; after production, the unified response is "system abnormality" to prevent sensitive information leakage; normal situation: "success").
[0063] data: business information.
[0064] data.dwrData: dwr request type unified response information node.
[0065] data.renderText: information returned in the original renderText format.
[0066] data.invokeData: information directly returned by the original Action method.
[0067] Step S240: define the front-end request processing logic so that the front-end request is processed in sequence by the VUE architecture front-end, the intermediate access layer and the monolithic architecture back-end to achieve separation of the front-end and back-end of the architecture.
[0068] Finally, the request logic of the front-end request is defined, so that the front-end request is not sent directly from the front-end to the monolithic architecture back-end, but passes through the intermediate access layer 321 before reaching the monolithic architecture back-end 322 for processing and feedback. After the setting of the intermediate access layer 321, the front-end and back-end of the monolithic architecture system can be separated. After separation, the front-end adopts the VUE architecture front-end, thereby realizing that the business system supports multiple browsers.
[0069] It can be seen that, under the condition that the code of the monolithic architecture system remains unchanged, by adding a front-end and back-end separation architecture front-end page middle access layer to process the json request sent by the front-end page, after the transformation, the original monolithic architecture system can not only support the continued use of the old system, but also support the use of the front-end and back-end separation architecture front-end page. Moreover, this method is a plug-in solution, which has no impact on the old system, the front-end and back-end separation architecture transformation is small, the new and old parallel have no impact, and it supports the continuous development of new back-end requirements and the one-click switch between the new and old systems.
[0070] from Figure 2It can be seen from the method shown that the present application sets an intermediate access layer in the original architecture, uses the intermediate access layer to encapsulate the monomer architecture backend, obtains a separated service backend, and converts the monomer architecture frontend into a VUE architecture frontend; then configures the architecture information for the separated service backend, unifies the architecture specifications of the VUE architecture frontend and the separated service backend, and defines the frontend request processing logic, so that the frontend request is processed in turn by the VUE architecture frontend, the intermediate access layer, and the monomer architecture backend, thereby realizing the separation of the front and back ends of the architecture, and the front-end page is developed in the VUE architecture, which can realize the system support for multiple browsers. The present application realizes the separation of the front-end and back-end architectures without changing the overall background architecture, and under the premise of ensuring that the normal business development is not affected during the front-end page transformation, so that the business system can support multiple browsers. The code of the present application scheme is small intrusive, the adjustment amount is small and concentrated, and it is easy to deploy, which greatly shortens the front-end business transformation cycle.
[0071] In some embodiments of the present application, in the above method, the intermediate access layer is used to encapsulate the monolithic architecture backend to obtain a separated service backend, including: setting a filtering layer and an interface layer in the intermediate access layer; placing the filtering layer in front of each logical layer of the monolithic architecture backend; and using the interface layer to encapsulate the filtering layer and the monolithic architecture backend.
[0072] In some embodiments of the present application, a filtering layer and an interface layer are specifically provided in the intermediate access layer. The main function of the filtering layer is to be used for authority verification, and the function of the interface layer is to be used for specific processing of front-end requests. Figure 4 A schematic diagram of the structure of a front-end and back-end separation architecture system according to another embodiment of the present application is shown. Figure 4 It can be seen that the front-end and back-end separation architecture system 300 includes a VUE architecture front-end 310 and a separated service back-end 320; the VUE architecture front-end 310 includes a VUE architecture front-end page 311 and a VUE architecture front-end application layer 312, and the separated service back-end 320 includes an intermediate access layer 321 and a single architecture back-end 322; the intermediate access layer 321 includes a filtering layer 321-1 and an interface layer 321-2.
[0073] Among them, the filter layer 321-1 can be placed in front of each logical layer of the monolithic architecture backend 322, and the interface layer 321-2 is used to encapsulate the filter layer 321-1 and each logical layer of the monolithic architecture backend 322. The "encapsulation" mentioned here does not mean that the filter layer 321-1 and each logical layer of the monolithic architecture backend 322 are loaded by the interface layer 321-2 physically, but that the data interaction between the interface layer 321-2, the filter layer 321-1 and the monolithic architecture backend 322 can be realized.
[0074] In some embodiments of the present application, in the above method, the definition of the front-end request processing logic includes: defining the filtering layer for performing authority verification on the front-end request, and sending the verified front-end request to the interface layer; defining the interface layer for performing input parameter processing on the received front-end request, determining the corresponding target class and target method based on the Java reflection mechanism, and instantiating the target class, and calling the service of the monolithic architecture backend, executing the determined target method to generate feedback information of the front-end request, and returning the feedback information to the VUE architecture front end.
[0075] exist Figure 4 Based on the front-end and back-end separation architecture system shown, the specific logic of the front-end request is: receive the front-end request, then perform permission verification on it, organize the front-end requests that pass the verification, and organize the input parameters; then obtain the target class (Action) and target method of the front-end request based on the Java reflection mechanism according to the Uniform Resource Locator (URL) of the front-end request; then instantiate the target class, initialize the properties of the target class, and finally execute the target method, organize and organize the return parameters to generate feedback information, then delete temporary files (if any), and finally return the feedback information to the VUE architecture front end.
[0076] In some embodiments of the present application, the implementation method of the front-end and back-end separation of the architecture of the present application can also be integrated into a Jar package, recorded as newframe.jar package, which can be called by a single architecture system with non-separated front-end and back-end.
[0077] The steps during the call can be briefly described as follows:
[0078] Introduce newframe.jar into the project: For other jar package introduction methods, refer to the existing technology.
[0079] Secondly, create the configuration file as needed: / config / newFrameSpecialUrl.properties. If there are no special circumstances in the system, there is no need to create this file.
[0080] Third, adjust the web.xml configuration.
[0081] Fourth, adjust Struts2Action.java.
[0082] Fifth, configure the Action as a bean as needed. The servlet core logic supports reading the bean in spring to instantiate the Action (referred to as method 1), or instantiating it through the Action constructor (referred to as method 2). Among them, method 1 has a small impact and does not require adjustment of the code in the Action class; method 2 requires the Action to be modified to provide a constructor that supports request and response input parameters.
[0083] Sixth, other abnormal descriptions:
[0084] 1. The url is empty. Please confirm: Check whether the url: / newFrame contains a path.
[0085] 2. The special request configuration is incorrect. Please check whether [xxx] in the configuration file [ / config / newFrameSpecialUrl.properties] is configured correctly.
[0086] 3. Special request initialization exception, target method not found. Please check whether the [xxx] target method in the configuration file [ / config / newFrameSpecialUrl.properties] exists and contains request and response parameters.
[0087] 4. Please confirm whether the URL format is correct. Check the format after the URL: / newFrame. Currently, only ordinary request 2 layers such as / xxx / yyy or dwr request 3 layers such as / dwr / xxx / yyy are supported. If there are other situations, please handle them as special requests.
[0088] 5. Please confirm whether the dwr request contains the dwrParam parameter.
[0089] Figure 5 A schematic diagram of a request processing method according to an embodiment of the present application is shown. Figure 4 The front-end and back-end separation architecture system 300 shown is implemented from Figure 5 It can be seen that the request processing method of this application includes:
[0090] Step S510: receiving a front-end request through the VUE architecture front-end, and sending the received front-end request to the filtering layer.
[0091] Step S520: Performing authority verification on the front-end request through the filtering layer, and sending the verified front-end request to the interface layer.
[0092] Step S530: Through the interface layer, the received front-end request is processed as an input parameter, the corresponding target class and target method are determined based on the Java reflection mechanism, the target class is instantiated, and the service of the monolithic architecture backend is called to execute the determined target method to generate feedback information of the front-end request, and the feedback information is returned to the VUE architecture front-end.
[0093] The logic of the request processing method is consistent with the processing logic of the front-end and back-end separation architecture system 300 defined above, and will not be repeated here.
[0094] Figure 6 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Figure 6 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.
[0095] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0096] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0097] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it. At the logical level, the aforementioned front-end and back-end separation of the architecture is implemented or the request processing method is implemented. The processor executes the program stored in the memory and is specifically used to execute the aforementioned method.
[0098] The implementation method of the front-end and back-end separation of the above-mentioned architecture and the method of request processing can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0099] The electronic device can also execute the aforementioned method for implementing the front-end and back-end separation of the architecture and the method for request processing, and realize the functions of the method for implementing the front-end and back-end separation of the architecture and the method for request processing, which will not be repeated in the embodiments of the present application.
[0100] An embodiment of the present application also proposes a computer-readable storage medium, which stores one or more programs, and the one or more programs include instructions. When the instructions are executed by an electronic device including multiple applications, the electronic device can execute the aforementioned implementation method of separating the front-end and back-end of the architecture and the request processing method.
[0101] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0102] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0103] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0104] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0105] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0106] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0107] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0108] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity or device including the element.
[0109] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0110] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A method for implementing the separation of front-end and back-end architecture, characterized in that: The method comprises: Setting an intermediate access layer, embedding the original architecture, the original architecture includes a monolithic architecture front end and a monolithic architecture back end; the intermediate access layer adopts Servlet, and the monolithic architecture back end is a Struts2 architecture; Converting the monolithic architecture front end into a VUE architecture front end, and encapsulating the monolithic architecture back end with the intermediate access layer to obtain a separated service back end; Performing architecture information configuration on the separated service backend, and unifying the architecture specifications of the VUE architecture frontend and the separated service backend; Define the front-end request processing logic so that the front-end request is processed in sequence by the VUE architecture front-end, the middle access layer and the monolithic architecture back-end to achieve the separation of the front-end and back-end of the architecture; The method of encapsulating the monolithic architecture backend using the intermediate access layer to obtain a separated service backend includes: A filtering layer and an interface layer are arranged in the intermediate access layer; Placing the filtering layer in front of each logic layer at the back end of the monolithic architecture; Encapsulating the filter layer and the monomer architecture backend using the interface layer; The step of configuring the architecture information of the separated service backend includes: Add a special request configuration file, which is used for special processing of special requests in the front-end and back-end separation architecture system. For the URL in the special request configuration file, the configured target method is executed without executing the existing subsequent logic of the front-end and back-end separation architecture system; the special request configuration file includes a target class and a target method for processing special requests, wherein the target method can process the input parameters of the special request; A special request format is configured, wherein the special request uniform resource locator = class full path#method name.
2. The method according to claim 1, characterized in that Defining the front-end request processing logic includes: The filter layer is defined to verify the authority of the front-end request, and send the verified front-end request to the interface layer; The interface layer is defined to process the input parameters of the received front-end request, determine the corresponding target class and target method based on the Java reflection mechanism, instantiate the target class, call the service of the monolithic architecture backend, execute the determined target method, generate feedback information of the front-end request, and return the feedback information to the VUE architecture front end.
3. The method according to claim 1, characterized in that The architecture specification for unifying the VUE architecture front end and the separated service back end includes: Setting the VUE architecture front end and the separated service back end to a unified architecture specification, wherein the unified architecture specification includes: a request path identifier, a request content type, and a response format; Wherein, the request content type includes: Dwr request identifier and Dwr request parameter; The response format includes: business logic judgment parameters and business information parameters.
4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: The method according to any one of claims 1 to 3 is integrated into a Jar package for calling.
5. A front-end and back-end separation architecture system, characterized in that: The front-end and back-end separation architecture system includes: a VUE architecture front-end and a separated service back-end; The separated service backend includes: an intermediate access layer and a monolithic architecture backend; the intermediate access layer adopts Servlet, and the monolithic architecture backend is a Struts2 architecture; Wherein, the intermediate access layer includes a filter layer and an interface layer; the filter layer is placed in front of the monomer architecture back end; the interface layer encapsulates the filter layer and the monomer architecture back end; The configuration of architecture information for the separated service backend includes: Add a special request configuration file, which is used for special processing of special requests in the front-end and back-end separation architecture system. For the URL in the special request configuration file, the configured target method is executed without executing the existing subsequent logic of the front-end and back-end separation architecture system; the special request configuration file includes a target class and a target method for processing special requests, wherein the target method can process the input parameters of the special request; A special request format is configured, wherein the special request uniform resource locator = class full path#method name.
6. A request processing method, characterized in that: The method is applied to the front-end and back-end separation architecture system described in claim 5; The method comprises: Receive the front-end request through the VUE architecture front-end, and send the received front-end request to the filtering layer; Through the filtering layer, the front-end request is authenticated, and the authenticated front-end request is sent to the interface layer; Through the interface layer, the received front-end request is processed as an input parameter, the corresponding target class and target method are determined based on the Java reflection mechanism, the target class is instantiated, and the service of the monolithic architecture backend is called to execute the determined target method to generate feedback information of the front-end request, and the feedback information is returned to the VUE architecture front-end.
7. An electronic device comprising: processor; as well as A memory arranged to store computer executable instructions, which, when executed, cause the processor to perform the method according to any one of claims 1 to 4 or 6.
8. A computer-readable storage medium storing one or more programs, which, when executed by an electronic device including a plurality of application programs, enables the electronic device to execute the method according to any one of claims 1 to 4 or 6.
Citation Information
Patent Citations
Service system based on micro-service architecture
CN112363704A
Method for realizing separation of front end and rear end, computer equipment and storage medium
CN112463324A