CN116302479A - Static resource request processing method and device - Google Patents

Static resource request processing method and device Download PDF

Info

Publication number
CN116302479A
CN116302479A CN202211724427.7A CN202211724427A CN116302479A CN 116302479 A CN116302479 A CN 116302479A CN 202211724427 A CN202211724427 A CN 202211724427A CN 116302479 A CN116302479 A CN 116302479A
Authority
CN
China
Prior art keywords
resource request
static resource
application server
micro
static
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211724427.7A
Other languages
Chinese (zh)
Inventor
张鑫
叶同坤
孙昊翔
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou DPTech Technologies Co Ltd
Original Assignee
Hangzhou DPTech Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou DPTech Technologies Co Ltd filed Critical Hangzhou DPTech Technologies Co Ltd
Priority to CN202211724427.7A priority Critical patent/CN116302479A/en
Publication of CN116302479A publication Critical patent/CN116302479A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application relates to a static resource request processing method and device for a micro front end framework, electronic equipment and a computer readable medium. The method comprises the following steps: the method comprises the steps that a main application server obtains a resource request from a client; when the resource request is a static resource request, the main application server queries a transfer table based on the static resource request, wherein the static resource request contains a static resource identifier; when the transfer table does not contain the static resource identifier, determining a target sub-application according to the static resource identifier; the main application server obtains return data from the target sub-application based on the static resource request; responding to the resource request of the client through the returned data. The method and the device can solve the problems that the static resources of the sub-application cannot be acquired in the micro front end and the static resource paths cannot be acquired dynamically, reduce the system performance consumption and improve the system stability.

Description

Static resource request processing method and device
Technical Field
The present disclosure relates to the field of computer information processing, and in particular, to a static resource request processing method and apparatus for a micro front end frame, an electronic device, and a computer readable medium.
Background
The micro front end is a technical idea which is provided for applying the micro service idea to the front end and is used for solving the problem that the front end application becomes huge and bulkier and is difficult to maintain. The micro front end has the advantages of loosely coupled code warehouse, independent development and deployment, independent technical stack and the like. Currently, more and more people try to build large website front-end applications using micro front-end technology.
In order to facilitate micro front-end development, the industry generally uses a technology called qiankun, which provides a framework required by basic micro front-end operation and solves the problems of main application loading sub-applications, application isolation, sub-application communication and the like. However, the scheme also has the problems of inconvenient static resource loading of the sub-application, unstable sub-application resource loading and the like when the main application is loaded on the sub-application in actual use.
Thus, there is a need for a new static resource request processing method, apparatus, electronic device, and computer readable medium for a micro front end framework.
The above information disclosed in the background section is only for enhancement of understanding of the background of the application and therefore it may contain information that does not form the prior art that is already known to a person of ordinary skill in the art.
Disclosure of Invention
In view of this, the present application provides a static resource request processing method, apparatus, electronic device, and computer readable medium for a micro front end framework, which can solve the problems that a micro front end neutron application cannot acquire a static resource and a static resource path cannot dynamically acquire the static resource, and can reduce system performance consumption and improve system stability.
Other features and advantages of the present application will be apparent from the following detailed description, or may be learned in part by the practice of the application.
According to an aspect of the present application, a static resource request processing method for a micro front end framework is provided, where the method includes: the method comprises the steps that a main application server obtains a resource request from a client; when the resource request is a static resource request, the main application server queries a transfer table based on the static resource request, wherein the static resource request contains a static resource identifier; when the transfer table does not contain the static resource identifier, determining a target sub-application according to the static resource identifier; the main application server obtains return data from the target sub-application based on the static resource request; responding to the resource request of the client through the returned data.
In an exemplary embodiment of the present application, further comprising: when the resource request is not a static resource request, the main application server forwards the resource request to a micro application server; the main application server obtains the returned data of the micro application server based on the resource request; responding to the resource request of the client through the returned data.
In an exemplary embodiment of the present application, the forwarding, by the host application server, the resource request to a micro-application server includes: the master application server forwards the resource request to the micro application server through an nminix proxy. Instead of obtaining a static resource request, the host application server forwards the request to the micro application server through the nminix proxy.
In an exemplary embodiment of the present application, further comprising: and establishing a transfer table for storing static resource identifiers of the micro application servers in the main application server.
In an exemplary embodiment of the present application, further comprising: setting a timing task in the main application server; based on the timing task, the main application server acquires a static resource identifier of the micro application server; and updating the transfer table through the obtained static resource identifier.
In an exemplary embodiment of the present application, further comprising: when the transfer table contains the static resource identifier, the main application server responds to the static resource request; the primary application server generates return data.
In an exemplary embodiment of the present application, the main application server obtains, based on the static resource request, return data from the target sub-application, including: the main application server initiates a static resource request to the target sub-application; the target sub-application responds to the static resource request; the target sub-application generates return data; and the main application server acquires the returned data.
In an exemplary embodiment of the present application, after the main application server obtains the return data, the method further includes: the primary application server updates the staging table based on the return data.
In an exemplary embodiment of the present application, responding to the resource request of the client by the return data includes: and the main application server fills and displays the returned data.
According to an aspect of the present application, there is provided a static resource request processing apparatus for a micro front end framework, the apparatus including: the request module is used for acquiring a resource request from the client by the main application server; the query module is used for querying a transfer table based on the static resource request by the main application server when the resource request is the static resource request, wherein the static resource request contains a static resource identifier; the target module is used for determining a target sub-application according to the static resource identifier when the transfer table does not contain the static resource identifier; the data module is used for acquiring return data by the target sub-application based on the static resource request by the main application server; and the response module is used for responding to the resource request of the client through the returned data.
According to an aspect of the present application, there is provided an electronic device including: one or more processors; a storage means for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the methods as described above.
According to an aspect of the present application, a computer-readable medium is presented, on which a computer program is stored, which program, when being executed by a processor, implements a method as described above.
According to the static resource request processing method, the static resource request processing device, the electronic equipment and the computer readable medium for the micro front end framework, a resource request from a client is acquired through a main application server; when the resource request is a static resource request, the main application server queries a transfer table based on the static resource request, wherein the static resource request contains a static resource identifier; when the transfer table does not contain the static resource identifier, determining a target sub-application according to the static resource identifier; the main application server obtains return data from the target sub-application based on the static resource request; by means of the mode that the returned data responds to the resource request of the client, the problems that a sub-application in the micro front end cannot acquire static resources and a static resource path cannot be acquired dynamically can be solved, system performance consumption can be reduced, and system stability is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The above and other objects, features and advantages of the present application will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings. The drawings described below are only some embodiments of the present application and other drawings may be obtained from these drawings without inventive effort for a person of ordinary skill in the art.
FIG. 1 is a system block diagram illustrating a static resource request processing method and apparatus for a micro-front-end framework, according to an example embodiment.
FIG. 2 is a flow chart illustrating a method of static resource request processing for a micro front end framework, according to an example embodiment.
Fig. 3 is a flow chart illustrating a static resource request processing method for a micro front end framework according to another exemplary embodiment.
Fig. 4 is a flow chart illustrating a static resource request processing method for a micro front end framework according to another exemplary embodiment.
FIG. 5 is a block diagram illustrating a static resource request processing device for a micro front end framework in accordance with an exemplary embodiment.
Fig. 6 is a block diagram of an electronic device, according to an example embodiment.
Fig. 7 is a block diagram of a computer-readable medium shown according to an example embodiment.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments can be embodied in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art. The same reference numerals in the drawings denote the same or similar parts, and thus a repetitive description thereof will be omitted.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the present application. One skilled in the relevant art will recognize, however, that the aspects of the application can be practiced without one or more of the specific details, or with other methods, components, devices, steps, etc. In other instances, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the application.
The block diagrams depicted in the figures are merely functional entities and do not necessarily correspond to physically separate entities. That is, the functional entities may be implemented in software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
The flow diagrams depicted in the figures are exemplary only, and do not necessarily include all of the elements and operations/steps, nor must they be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the order of actual execution may be changed according to actual situations.
It will be understood that, although the terms first, second, third, etc. may be used herein to describe various components, these components should not be limited by these terms. These terms are used to distinguish one element from another element. Thus, a first component discussed below could be termed a second component without departing from the teachings of the present application concept. As used herein, the term "and/or" includes any one of the associated listed items and all combinations of one or more.
Those skilled in the art will appreciate that the drawings are schematic representations of example embodiments, and that the modules or flows in the drawings are not necessarily required to practice the present application, and therefore, should not be taken to limit the scope of the present application.
The applicant finds that when the main application loads the sub-application, the static resources of the sub-application cannot be loaded. The essential reason for this is that the correct publicPath is not used when the resources are loaded by weback. After compiling, packaging and deploying all the sub-applications, when the main application loads the sub-applications, the sub-applications load their own static resources, because the corresponding static resource files refer to the relative paths, the situation that the sub-application resources splice the domain (domain name) of the main application with respect to the paths can occur, that is, the sub-applications can search the resources under the domain of the main application, which results in loading failure.
The existing technology capable of solving the problem that static resources cannot be acquired by the micro front end is as follows: the proxy agent is configured by weback to forward static resources for normally loading sub-applications by the main application. But this way path acquisition is difficult. Once the static resource file is packaged, the static resource path inside cannot be modified by dynamically modifying the publicPath, and the configuration of the absolute path of the static resource requires that the IP of the micro application server is known in advance, so that the IP is fixed, and the binding cannot be dynamically acquired. Moreover, it is unstable and consumes a lot of performance. The process needs to use the main application server Nginx and the micro application server at the same time, if one network has a problem, the situation that delay or acquisition cannot be achieved occurs, and the whole process has high requirements on performance and high consumption.
In view of this, the present application proposes a static resource request processing method for a micro front end framework. The technology solves the problems of inconvenient loading of sub-application static resources and unstable loading of sub-application resources in the prior art by means of a server back-end interface and a mapping table.
The method and the device for the data processing of the micro-application server establish a micro-application static resource transfer table in the main application server to store the static resources of the micro-application and respond when the client browser requests the static resource data, replace the process that the client browser forwards traffic to the micro-application server and the micro-application server responds to the data. The following describes the content of the present application in detail with the aid of specific examples.
FIG. 1 is a system block diagram illustrating a static resource request processing method, apparatus for a micro-front-end framework, according to an example embodiment.
As shown in fig. 1, the system architecture 10 may include terminal devices 101, 102, 103, a network 104, and a host application server 105, micro application servers 106, 107, 108. The network 104 is a medium used to provide a communication link between the micro application servers 106, 107, 108 and the main application server 105; the network 104 is also a medium used to provide communication links between the terminal devices 101, 102, 103 and the host application server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the host application server 105 via the network 104 using the terminal devices 101, 102, 103 to receive or send messages or the like. Various communication client applications, such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc., may be installed on the terminal devices 101, 102, 103.
The terminal devices 101, 102, 103 may be a variety of electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The host application server 105 may be a server providing various services, such as a background management server providing support for data service-like websites browsed by users using the terminal devices 101, 102, 103. The background management server can analyze and process the received data such as the product inquiry request and the like, and feed back the processing result (such as static resources) to the terminal equipment.
The master application server 105 may for example obtain resource requests from the terminal devices 101, 102, 103; the master application server 105 may, for example, query a transfer table based on the static resource request when the resource request is a static resource request, the static resource request including a static resource identification; the main application server 105 may determine a target sub-application according to the static resource identifier, for example, when the static resource identifier is not included in the transfer table; the main application server 105 may obtain return data by the target sub-application, e.g. based on the static resource request; the master application server 105 may respond to the resource request of the terminal device 101, 102, 103, e.g. by means of the return data.
The host application server 105 may also forward the resource request to the micro application server 106 or 107 or 108, for example, when the resource request is not a static resource request; the master application server 105 may also obtain return data from the micro application server 106 or 107 or 108, for example, at the resource request; the master application server 105 may also respond to the resource request of the terminal device 101, 102, 103, e.g. by means of said return data.
The host application server 105 may also respond to the static resource request, for example, when the static resource identification is contained in the staging table; the host application server 105 may also, for example, generate return data.
The main application server 105 and the micro application servers 106, 107, 108 may each be one entity server or may be composed of a plurality of servers, for example.
FIG. 2 is a flow chart illustrating a method of static resource request processing for a micro front end framework, according to an example embodiment. The static resource request processing method 20 for the micro front end framework at least includes steps S202 to S210.
As shown in fig. 2, in S202, the master application server acquires a resource request from a client.
In one embodiment, further comprising: and establishing a transfer table for storing static resource identifiers of the micro application servers in the main application server.
More specifically, a timing task may be set in the primary application server; based on the timing task, the main application server acquires a static resource identifier of the micro application server; and updating the transfer table through the obtained static resource identifier.
In a specific practical application, a static resource transfer table of the micro application can be created and used for storing the acquired static resources of the micro application. The micro-application static resource staging table may also be updated periodically. And setting a timer on the main application server, initiating a request to the micro application server at regular time, and comparing the acquired data with the data in the micro application static resource transfer table by the main application server after the micro application server responds to the request, and updating the micro application static resource transfer table.
In S204, when the resource request is a static resource request, the master application server queries a transfer table based on the static resource request, where the static resource request includes a static resource identifier.
In one embodiment, the master application server forwards the resource request to a micro-application server when the resource request is not a static resource request; the main application server obtains the returned data of the micro application server based on the resource request; responding to the resource request of the client through the returned data.
In S206, when the transit table does not include the static resource identifier, determining a target sub-application according to the static resource identifier.
In one embodiment, further comprising: when the transfer table contains the static resource identifier, the main application server responds to the static resource request; the primary application server generates return data.
In S208, the main application server obtains return data from the target sub-application based on the static resource request. The main application server initiates a static resource request to the target sub-application; the target sub-application responds to the static resource request; the target sub-application generates return data; and the main application server acquires the returned data.
In one embodiment, further comprising: the primary application server updates the staging table based on the return data.
In S210, the resource request of the client is responded to by the return data. And the main application server fills and displays the returned data.
According to the static resource request processing method for the micro front end framework, a resource request from a client is acquired through a main application server; when the resource request is a static resource request, the main application server queries a transfer table based on the static resource request, wherein the static resource request contains a static resource identifier; when the transfer table does not contain the static resource identifier, determining a target sub-application according to the static resource identifier; the main application server obtains return data from the target sub-application based on the static resource request; by means of the mode that the returned data responds to the resource request of the client, the problems that a sub-application in the micro front end cannot acquire static resources and a static resource path cannot be acquired dynamically can be solved, system performance consumption can be reduced, and system stability is improved.
According to the static resource request processing method for the micro front end framework, the micro application static resource transfer table is created, so that a client can dynamically acquire a micro application static resource path. By creating the micro-application static resource transfer table, the client can stably, low-consumption and high-efficiency acquire the micro-application static resource.
It should be clearly understood that this application describes how to make and use particular examples, but the principles of this application are not limited to any details of these examples. Rather, these principles can be applied to many other embodiments based on the teachings of the present disclosure.
Fig. 3 is a flow chart illustrating a static resource request processing method for a micro front end framework according to another exemplary embodiment. The flow 30 shown in fig. 3 is a detailed description of the processing steps of the flow shown in fig. 2 when the resource request is not a static resource request.
In one embodiment, url-loader and publicPath of weback may be configured to directly specify the resource prefix, i.e., add the IP of the sub-application deployment server, to make it an absolute path. Proxy forwarding may also be provided, and when the host application resource path includes a static_monitor, the proxy forwards to the target address, that is, the address of the micro application, to obtain the resource. The problem of loading static resources by sub-applications in the micro front end can also be solved through configuration of the weback on url-loader and publicPath and proxy forwarding.
As shown in fig. 3, in S302, a client browser initiates a request.
In S304, the master application server nginnx proxy forwards the traffic to the server of the corresponding micro application through the value of the interface prefix splice.
In S306, the micro application server returns data in response to the request.
In S308, the nginnx agent returns the acquired data to the server.
In S410, the server fills in the fetched data.
Fig. 4 is a flow chart illustrating a static resource request processing method for a micro front end framework according to another exemplary embodiment. The flow 40 shown in fig. 4 is a detailed description of the flow shown in fig. 2.
As shown in fig. 4, in S402, the client browser initiates a request.
In S404, it is determined whether or not a static resource is a requesting sub-application. The master application server determines whether the request is a request for a static resource type of the micro-application
A micro-application static resource staging table may also be created at the host application server for storing micro-application static resources and responding to requests from clients. And the master application server initiates a static resource updating request to the corresponding micro application server at regular time, so that the micro application static resource transfer table is updated at regular time. So that the client can respond to the latest data in time when requesting the static resources of the micro application.
In S406, the host application server queries whether the transfer table has corresponding data.
In S408, the master application server queries the micro-application static resource transfer table, and if there is data, the master application responds to the request and returns the data.
In S410, the main application initiates a request to the sub-application. The main application server initiates a request to the corresponding sub-application, then stores the acquired data into a micro-application static resource transfer table, and returns the data in response to the request of the client.
In S412, the sub-application returns data in response to the request.
In S414, the child application acquires data updates to the staging table.
In S416, the host application server fills in the fetched data.
When the client browser initiates a request to request the static resources of the micro-application, the main application server queries the transfer table of the static resources of the micro-application, and if the data exists, the request is directly responded, and the data is returned. And if the data does not exist, a method for calling the main application server to request the micro-application static resource initiates a request to the micro-application server, and after the micro-application server responds to the request, the main application server compares the acquired data with the data in the micro-application static resource transfer table, updates the micro-application static resource transfer table, responds to the request of the client, and returns the data.
In the static resource request processing method for the micro front end framework, a micro application static resource transfer table is created, and the problem of dynamic acquisition of a static resource path is solved. The micro-application static resources are stored in the micro-application static resource transfer table, and the main application server responds to the request of the client to the micro-application static resources, so that the performance consumption is reduced, and the stability is improved.
Those skilled in the art will appreciate that all or part of the steps implementing the above described embodiments are implemented as a computer program executed by a CPU. When executed by a CPU, performs the functions defined by the above methods provided herein. The program may be stored in a computer readable storage medium, which may be a read-only memory, a magnetic disk or an optical disk, etc.
Furthermore, it should be noted that the above-described figures are merely illustrative of the processes involved in the method according to the exemplary embodiments of the present application, and are not intended to be limiting. It will be readily appreciated that the processes shown in the above figures do not indicate or limit the temporal order of these processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, for example, among a plurality of modules.
The following are device embodiments of the present application, which may be used to perform method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
FIG. 5 is a block diagram illustrating a static resource request processing device for a micro front end framework in accordance with an exemplary embodiment. As shown in fig. 5, the static resource request processing device 50 for the micro front end framework includes: a request module 502, a query module 504, a target module 506, a data module 508, and a response module 510.
The request module 502 is configured to obtain a resource request from a client by a main application server;
the query module 504 is configured to query a transfer table based on the static resource request by the main application server when the resource request is the static resource request, where the static resource request includes a static resource identifier;
the target module 506 is configured to determine, when the static resource identifier is not included in the transfer table, a target sub-application according to the static resource identifier;
the data module 508 is configured to obtain, by the main application server, return data from the target sub-application based on the static resource request;
the response module 510 is configured to respond to the resource request of the client by the returned data.
According to the static resource request processing device for the micro front end framework, a resource request from a client is acquired through a main application server; when the resource request is a static resource request, the main application server queries a transfer table based on the static resource request, wherein the static resource request contains a static resource identifier; when the transfer table does not contain the static resource identifier, determining a target sub-application according to the static resource identifier; the main application server obtains return data from the target sub-application based on the static resource request; by means of the mode that the returned data responds to the resource request of the client, the problems that a sub-application in the micro front end cannot acquire static resources and a static resource path cannot be acquired dynamically can be solved, system performance consumption can be reduced, and system stability is improved.
Fig. 6 is a block diagram of an electronic device, according to an example embodiment.
An electronic device 600 according to this embodiment of the present application is described below with reference to fig. 6. The electronic device 600 shown in fig. 6 is merely an example, and should not be construed as limiting the functionality and scope of use of embodiments of the present application.
As shown in fig. 6, the electronic device 600 is in the form of a general purpose computing device. Components of electronic device 600 may include, but are not limited to: at least one processing unit 610, at least one memory unit 620, a bus 630 connecting the different system components (including the memory unit 620 and the processing unit 610), a display unit 640, etc.
Wherein the storage unit stores program code that is executable by the processing unit 610 such that the processing unit 610 performs steps described in the present specification according to various exemplary embodiments of the present application. For example, the processing unit 610 may perform the steps as shown in fig. 2, 3, and 4.
The memory unit 620 may include readable media in the form of volatile memory units, such as Random Access Memory (RAM) 6201 and/or cache memory unit 6202, and may further include Read Only Memory (ROM) 6203.
The storage unit 620 may also include a program/utility 6204 having a set (at least one) of program modules 6205, such program modules 6205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment.
Bus 630 may be a local bus representing one or more of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or using any of a variety of bus architectures.
The electronic device 600 may also communicate with one or more external devices 600' (e.g., keyboard, pointing device, bluetooth device, etc.), devices that enable a user to interact with the electronic device 600, and/or any devices (e.g., routers, modems, etc.) that the electronic device 600 can communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 650. Also, electronic device 600 may communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet, through network adapter 660. The network adapter 660 may communicate with other modules of the electronic device 600 over the bus 630. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with electronic device 600, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, as shown in fig. 7, the technical solution according to the embodiments of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, and includes several instructions to cause a computing device (may be a personal computer, a server, or a network device, etc.) to perform the above-described method according to the embodiments of the present application.
In general, the method and the device solve the problems that the static resources cannot be acquired by the micro-front-end neutron application and the static resource paths cannot be acquired dynamically, reduce the performance consumption and improve the stability. The present disclosure is directed to a process of storing static resources of a micro application and responding when a client browser requests static resource data by creating a micro application static resource transfer table at a main application server, forwarding traffic to the micro application server instead of nginx, and responding the data by the micro application server. Specifically, a micro-application static resource transfer table is created for storing the acquired static resources of the micro-application. And updating the micro-application static resource transfer table at regular time. And setting a timer on the main application server, initiating a request to the micro application server at regular time, and comparing the acquired data with the data in the micro application static resource transfer table by the main application server after the micro application server responds to the request, and updating the micro application static resource transfer table. When a client browser initiates a request to request the static resources of the micro-application, a main application server inquires a transfer table of the static resources of the micro-application, and if data exists, the request is directly responded, and the data is returned. And if the data does not exist, a method for calling the main application server to request the micro-application static resource initiates a request to the micro-application server, and after the micro-application server responds to the request, the main application server compares the acquired data with the data in the micro-application static resource transfer table, updates the micro-application static resource transfer table, responds to the request of the client, and returns the data. The process of obtaining the micro-application static resource by the client mainly comprises the following steps: 1. and creating a micro-application static resource transfer table in the main application server, wherein the micro-application static resource transfer table is used for storing micro-application static resources and responding to the request of the client. 2. And the master application server initiates a static resource updating request to the corresponding micro application server at regular time, so that the micro application static resource transfer table is updated at regular time. So that the client can respond to the latest data in time when requesting the static resources of the micro application. 3. The client browser initiates the request. 4. A determination is made by the host application server as to whether the request is a request for a static resource type of the micro-application. 5. If not, the main application server Nginx proxy forwards the flow to the corresponding micro application server, the micro application server responds to the request, returns data, and the Nginx receives the data returned by the micro service browser and returns the data to the client browser. 6. If yes, the main application server inquires the micro-application static resource transfer table, and if the micro-application static resource transfer table has data, the main application server responds to the request and returns the data. 7. If no data exists, the main application server initiates a request to the corresponding micro application server, then the acquired data is stored in the micro application static resource transfer table, and the data is returned in response to the request of the client. 8. And 5, 6, and 7, the client browser fills and displays the acquired data after acquiring the data.
The software product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, with readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A readable storage medium may also be any readable medium that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
The computer-readable medium carries one or more programs, which when executed by one of the devices, cause the computer-readable medium to perform the functions of: the method comprises the steps that a main application server obtains a resource request from a client; when the resource request is a static resource request, the main application server queries a transfer table based on the static resource request, wherein the static resource request contains a static resource identifier; when the transfer table does not contain the static resource identifier, determining a target sub-application according to the static resource identifier; the main application server obtains return data from the target sub-application based on the static resource request; responding to the resource request of the client through the returned data.
Those skilled in the art will appreciate that the modules may be distributed throughout several devices as described in the embodiments, and that corresponding variations may be implemented in one or more devices that are unique to the embodiments. The modules of the above embodiments may be combined into one module, or may be further split into a plurality of sub-modules.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or in combination with the necessary hardware. Thus, the technical solutions according to the embodiments of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, and include several instructions to cause a computing device (may be a personal computer, a server, a mobile terminal, or a network device, etc.) to perform the methods according to the embodiments of the present application.
Exemplary embodiments of the present application are specifically illustrated and described above. It is to be understood that this application is not limited to the details of construction, arrangement or method of implementation described herein; on the contrary, the application is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.

Claims (10)

1. A static resource request processing method for a micro front end framework, comprising:
the method comprises the steps that a main application server obtains a resource request from a client;
when the resource request is a static resource request, the main application server queries a transfer table based on the static resource request, wherein the static resource request contains a static resource identifier;
when the transfer table does not contain the static resource identifier, determining a target sub-application according to the static resource identifier;
the main application server obtains return data from the target sub-application based on the static resource request;
responding to the resource request of the client through the returned data.
2. The method as recited in claim 1, further comprising:
when the resource request is not a static resource request, the main application server forwards the resource request to a micro application server;
the main application server obtains the returned data of the micro application server based on the resource request;
responding to the resource request of the client through the returned data.
3. The method of claim 2, wherein the host application server forwarding the resource request to a micro application server comprises:
the master application server forwards the resource request to the micro application server through an nminix proxy.
4. The method as recited in claim 1, further comprising:
and establishing a transfer table for storing static resource identifiers of the micro application servers in the main application server.
5. The method as recited in claim 4, further comprising:
setting a timing task in the main application server;
based on the timing task, the main application server acquires a static resource identifier of the micro application server;
and updating the transfer table through the obtained static resource identifier.
6. The method as recited in claim 1, further comprising:
when the transfer table contains the static resource identifier, the main application server responds to the static resource request;
the primary application server generates return data.
7. The method of claim 1, wherein the primary application server obtaining return data by the target sub-application based on the static resource request, comprises:
the main application server initiates a static resource request to the target sub-application;
the target sub-application responds to the static resource request;
the target sub-application generates return data;
and the main application server acquires the returned data.
8. The method of claim 7, wherein after the primary application server obtains the return data, further comprising:
the primary application server updates the staging table based on the return data.
9. The method of claim 1 or 2, wherein responding to the resource request of the client with the return data comprises:
and the main application server fills and displays the returned data.
10. A static resource request processing device for a micro front end framework, comprising:
the request module is used for acquiring a resource request from the client by the main application server;
the query module is used for querying a transfer table based on the static resource request by the main application server when the resource request is the static resource request, wherein the static resource request contains a static resource identifier;
the target module is used for determining a target sub-application according to the static resource identifier when the transfer table does not contain the static resource identifier;
the data module is used for acquiring return data by the target sub-application based on the static resource request by the main application server;
and the response module is used for responding to the resource request of the client through the returned data.
CN202211724427.7A 2022-12-27 2022-12-27 Static resource request processing method and device Pending CN116302479A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211724427.7A CN116302479A (en) 2022-12-27 2022-12-27 Static resource request processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211724427.7A CN116302479A (en) 2022-12-27 2022-12-27 Static resource request processing method and device

Publications (1)

Publication Number Publication Date
CN116302479A true CN116302479A (en) 2023-06-23

Family

ID=86798517

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211724427.7A Pending CN116302479A (en) 2022-12-27 2022-12-27 Static resource request processing method and device

Country Status (1)

Country Link
CN (1) CN116302479A (en)

Similar Documents

Publication Publication Date Title
CN109976667B (en) Mirror image management method, device and system
CN111614738B (en) Service access method, device, equipment and storage medium based on Kubernetes cluster
US10599736B2 (en) System and method of sensing and responding to service discoveries
CN113010827B (en) Page rendering method and device, electronic equipment and storage medium
CN112507005B (en) Method and device for processing message
CN110830374A (en) Method and device for gray level release based on SDK
CN113760324A (en) Method and device for constructing micro front-end application
CN110795649A (en) Target page display method, device and system and electronic equipment
CN110888639A (en) Business code compiling and packaging method and device
US20130325960A1 (en) Client-side sharing of event information
CN111694639A (en) Method and device for updating address of process container and electronic equipment
CN114443076A (en) Mirror image construction method, device, equipment and storage medium
CN111783005B (en) Method, device and system for displaying web page, computer system and medium
CN112804366B (en) Method and device for resolving domain name
CN110795135A (en) Method and device for realizing injection-resolution configuration
CN111010453B (en) Service request processing method, system, electronic device and computer readable medium
CN111800511A (en) Processing method, system, equipment and readable storage medium for synchronous login state
WO2023083071A1 (en) View interaction method and apparatus, electronic device, and computer readable medium
CN109981546B (en) Method and device for acquiring remote call relation between application modules
CN114449040B (en) Configuration issuing method and device based on cloud platform
CN113722007B (en) Configuration method, device and system of VPN branch equipment
CN113708955B (en) Equipment configuration method, device and system
CN116302479A (en) Static resource request processing method and device
CN111460020B (en) Method, device, electronic equipment and medium for resolving message
CN112929453A (en) Method and device for sharing session data

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination