CN114115941A - Resource sending method, page rendering method, apparatus, electronic device and medium - Google Patents
Resource sending method, page rendering method, apparatus, electronic device and medium Download PDFInfo
- Publication number
- CN114115941A CN114115941A CN202111332792.9A CN202111332792A CN114115941A CN 114115941 A CN114115941 A CN 114115941A CN 202111332792 A CN202111332792 A CN 202111332792A CN 114115941 A CN114115941 A CN 114115941A
- Authority
- CN
- China
- Prior art keywords
- resource
- markup language
- hypertext markup
- language document
- target
- 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
Links
- 238000000034 method Methods 0.000 title claims description 69
- 238000009877 rendering Methods 0.000 title claims description 31
- 230000003068 static effect Effects 0.000 claims description 247
- 230000004044 response Effects 0.000 claims description 110
- 230000005540 biological transmission Effects 0.000 claims description 14
- 238000004806 packaging method and process Methods 0.000 claims description 10
- 238000004590 computer program Methods 0.000 claims description 9
- 238000012795 verification Methods 0.000 claims description 4
- 238000004458 analytical method Methods 0.000 claims description 3
- 238000010586 diagram Methods 0.000 description 17
- 230000006870 function Effects 0.000 description 8
- 238000004891 communication Methods 0.000 description 7
- 230000003287 optical effect Effects 0.000 description 4
- 238000012545 processing Methods 0.000 description 4
- 230000000694 effects Effects 0.000 description 3
- 238000012544 monitoring process Methods 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000004422 calculation algorithm Methods 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 239000003795 chemical substances by application Substances 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/957—Browsing optimisation, e.g. caching or content distillation
- G06F16/9574—Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/958—Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/71—Version control; Configuration management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Data Mining & Analysis (AREA)
- Computer Security & Cryptography (AREA)
- Information Transfer Between Computers (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the disclosure discloses a resource sending method, a page rendering device, electronic equipment and a medium. One embodiment of the method comprises: responding to a first hypertext markup language document resource acquisition request intercepted to be sent to a target server side by a target client side, and determining whether hypertext markup language document resources exist in a target cache or not; in response to determining that the hypertext markup language document resource exists in the target cache, obtaining the hypertext markup language document resource from the target cache; sending the hypertext markup language document resource serving as a request response of a first hypertext markup language document resource acquisition request to a target client; in response to intercepting a first static resource acquisition request to be sent to a target server side by a target client side, acquiring static resources from a target cache; and sending the static resource to the target client. The implementation method can reduce the resource request time of the target client to a greater extent and improve the page rendering efficiency.
Description
Technical Field
The embodiment of the disclosure relates to the technical field of computers, in particular to a resource sending method, a page rendering device, electronic equipment and a medium.
Background
At present, a client often needs to perform page rendering according to obtained static resources so as to obtain a rendered page. For non-primary client acquisition of static resources, the method generally adopted is as follows: firstly, a client sends a hypertext markup language document resource request to a remote server, and the remote server returns the hypertext markup language document resource to the client as a response. And then, the client analyzes the hypertext markup language document resource to obtain the static resource information to be loaded. And finally, the client sends a resource acquisition request aiming at the information of the static resource to be loaded to the remote server, and the remote server returns the static resource to be loaded to the client as a response.
However, when the above-mentioned manner is adopted to acquire static resources, the following technical problems often exist:
when the client sends a request to the remote server, the client needs to wait for the response of the remote server, and the problem that the network request is time-consuming exists. Further, the speed of rendering the page by the client is reduced.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
Some embodiments of the present disclosure propose a resource sending method, a page rendering method, an apparatus, an electronic device, and a medium, to solve the technical problems mentioned in the above background.
In a first aspect, some embodiments of the present disclosure provide a resource sending method, including: responding to a first hypertext markup language document resource acquisition request intercepted to be sent to a target server side by a target client side, and determining whether hypertext markup language document resources exist in a target cache or not; in response to determining that the hypertext markup language document resource exists in the target cache, obtaining the hypertext markup language document resource from the target cache; sending the hypertext markup language document resource serving as a request response of the first hypertext markup language document resource acquisition request to the target client; responding to a first static resource acquisition request intercepted to be sent to the target server side by the target client side, and acquiring static resources from the target cache, wherein the static resources are resources corresponding to all static resource information in a first static resource information list, and the first static resource information list is a list obtained by analyzing the received hypertext markup language document resources by the target client side; and sending the static resource to the target client.
Optionally, the method further includes: in response to determining that the hypertext markup language document resource does not exist in the target cache, sending a second hypertext markup language document resource acquisition request to the target server; and in response to receiving the hypertext markup language document resource associated with the second hypertext markup language document resource acquisition request sent by the target server, sending the hypertext markup language document resource associated with the second hypertext markup language document resource acquisition request to the target client, and loading the hypertext markup language document resource associated with the second hypertext markup language document resource acquisition request to the target cache.
Optionally, the method further includes: and outputting information representing network request abnormity in response to not receiving the hypertext markup language document resource associated with the second hypertext markup language document resource acquisition request sent by the target server.
Optionally, after the obtaining the html document resource from the target cache in response to determining that the html document resource exists in the target cache, the method further includes: sending a verification network request for verifying whether the hypertext markup language document resource is consistent with the hypertext markup language document resource currently stored by the target server to the target server; responding to the received target identification information which is sent by the target server and represents that the hypertext markup language document resource is different from the hypertext markup language document resource stored at the target server at present, and acquiring the hypertext markup language document resource and the corresponding static resource sent by the target server; and generating a message for representing the hypertext markup language document resource to be updated acquired by the target client, and sending the hypertext markup language document resource and the corresponding static resource sent by the target server to the target cache so that the target cache replaces the currently stored hypertext markup language document resource.
Optionally, the static resource stored in the target cache is a packed and separated resource, and the static resource is generated by the following steps: acquiring unpacked and separated resources; according to a first naming format, packaging each tool file in the unpacked and separated resources to obtain each packaged first file; packaging other files in the unpacked and separated resources according to a second naming format to obtain second packaged files, wherein the other files are files of the unpacked and separated resources from which the tool files are removed; and generating the static resource according to the packed first files and the packed second files.
Optionally, the target server implements deployment of hypertext markup language document resources by: acquiring a first resource file set corresponding to hypertext markup language document resources to be deployed; determining a second resource file set corresponding to the hypertext markup language document resource currently stored by the target server; for each first resource file in the first resource file set, performing the following file replacement steps: determining whether a second resource file with the same file name as the first resource file exists in the second resource file set; determining a second resource file with the same file name as the first resource file as a target resource file in response to determining that a second resource file with the same file name as the first resource file exists in the second resource file set; determining whether the hash value of the target resource file is the same as the hash value of the first resource file; and replacing the target resource files in the second resource file set with the first resource file in response to determining that the hash value of the target resource file is different from the hash value of the first resource file. In response to receiving that the target server completes replacement of a second resource file, sending an entry file resource in the hypertext markup language document resource to be deployed to the target server; responding to the target server to finish the receiving of the entry file resource, and restarting the target service in the target server; and in response to determining that the target service in the target service terminal is restarted, removing outdated files in the hypertext markup language document resource currently stored by the target service terminal to complete deployment of the hypertext markup language document resource of the target service terminal.
In a second aspect, some embodiments of the present disclosure provide a page rendering method, including: sending a first hypertext markup language document resource acquisition request to a target server, wherein the hypertext markup language document resource acquisition request is sent to the target server at least once before the first hypertext markup language document resource acquisition request is sent; in response to receiving a hypertext markup language document resource aiming at the first hypertext markup language document resource acquisition request, analyzing the hypertext markup language document resource to obtain a first static resource information list; sending a first static resource acquisition request to the target server, wherein a static resource is a resource corresponding to each piece of static resource information in the first static resource information list; and in response to receiving the static resource aiming at the first static resource acquisition request, executing a first target script according to the static resource so as to render a page.
In a third aspect, some embodiments of the present disclosure provide a resource transmitting apparatus, including: the determining unit is configured to respond to a first hypertext markup language document resource obtaining request intercepted to be sent to a target server side by a target client side, and determine whether hypertext markup language document resources exist in a target cache or not; a first obtaining unit configured to obtain the hypertext markup language document resource from the target cache in response to determining that the hypertext markup language document resource exists in the target cache; a first sending unit configured to send the hypertext markup language document resource to the target client as a request response of the first hypertext markup language document resource acquisition request; a second obtaining unit, configured to obtain, in response to intercepting a first static resource obtaining request to be sent by the target client to the target server, a static resource from the target cache, where the static resource is a resource corresponding to each piece of static resource information in a first static resource information list, and the first static resource information list is a list obtained by analyzing the received hypertext markup language document resource by the target client; a second sending unit configured to send the static resource to the target client.
Optionally, the apparatus further comprises: in response to determining that the hypertext markup language document resource does not exist in the target cache, sending a second hypertext markup language document resource acquisition request to the target server; and in response to receiving the hypertext markup language document resource associated with the second hypertext markup language document resource acquisition request sent by the target server, sending the hypertext markup language document resource associated with the second hypertext markup language document resource acquisition request to the target client, and loading the hypertext markup language document resource associated with the second hypertext markup language document resource acquisition request to the target cache.
Optionally, the apparatus further comprises: and outputting information representing network request abnormity in response to not receiving the hypertext markup language document resource associated with the second hypertext markup language document resource acquisition request sent by the target server.
Optionally, the apparatus further comprises: sending a verification network request for verifying whether the hypertext markup language document resource is consistent with the hypertext markup language document resource currently stored by the target server to the target server; responding to the received target identification information which is sent by the target server and represents that the hypertext markup language document resource is different from the hypertext markup language document resource stored at the target server at present, and acquiring the hypertext markup language document resource and the corresponding static resource sent by the target server; and generating a message for representing the hypertext markup language document resource to be updated acquired by the target client, and sending the hypertext markup language document resource and the corresponding static resource sent by the target server to the target cache so that the target cache replaces the currently stored hypertext markup language document resource.
Optionally, the static resource stored in the target cache is a packed and separated resource, and the static resource is generated by the following steps: acquiring unpacked and separated resources; according to a first naming format, packaging each tool file in the unpacked and separated resources to obtain each packaged first file; packaging other files in the unpacked and separated resources according to a second naming format to obtain second packaged files, wherein the other files are files of the unpacked and separated resources from which the tool files are removed; and generating the static resource according to the packed first files and the packed second files.
Optionally, the target server implements deployment of hypertext markup language document resources by: acquiring a first resource file set corresponding to hypertext markup language document resources to be deployed; determining a second resource file set corresponding to the hypertext markup language document resource currently stored by the target server; for each first resource file in the first resource file set, performing the following file replacement steps: determining whether a second resource file with the same file name as the first resource file exists in the second resource file set; determining a second resource file with the same file name as the first resource file as a target resource file in response to determining that a second resource file with the same file name as the first resource file exists in the second resource file set; determining whether the hash value of the target resource file is the same as the hash value of the first resource file; and replacing the target resource files in the second resource file set with the first resource file in response to determining that the hash value of the target resource file is different from the hash value of the first resource file. In response to receiving that the target server completes replacement of a second resource file, sending an entry file resource in the hypertext markup language document resource to be deployed to the target server; responding to the target server to finish the receiving of the entry file resource, and restarting the target service in the target server; and in response to determining that the target service in the target service terminal is restarted, removing outdated files in the hypertext markup language document resource currently stored by the target service terminal to complete deployment of the hypertext markup language document resource of the target service terminal.
In a fourth aspect, some embodiments of the present disclosure provide a page rendering apparatus, including: a third sending unit, configured to send a first html document resource acquisition request to a target server, wherein the first html document resource acquisition request has been sent at least once to the target server before being sent; the analysis unit is configured to respond to a received hypertext markup language document resource aiming at the first hypertext markup language document resource acquisition request, analyze the hypertext markup language document resource and obtain a first static resource information list; a fourth sending unit, configured to send a first static resource acquisition request to the target server, where a static resource is a resource corresponding to each static resource information in the first static resource information list; and the execution unit is configured to respond to the static resource which is received aiming at the first static resource acquisition request, and execute a first target script according to the static resource so as to render a page.
Optionally, the apparatus further comprises: responding to the monitored message representing that the acquired hypertext markup language document resource is to be updated, and sending a third hypertext markup language document resource acquisition request to the target server; in response to receiving updated hypertext markup language document resources aiming at the third hypertext markup language document resource acquisition request, analyzing the updated hypertext markup language document resources to obtain a second static resource information list; sending a second static resource acquisition request aiming at the updated static resource to the target server, wherein the updated static resource is a resource corresponding to each static resource information in the second static resource information list; and in response to receiving the updated static resource aiming at the second static resource acquisition request, executing a second target script according to the updated static resource to render a page.
In a fifth aspect, some embodiments of the present disclosure provide an electronic device, comprising: one or more processors; a storage device having one or more programs stored thereon, which when executed by one or more processors, cause the one or more processors to implement the method as described in any of the implementations of the first or second aspects.
In a sixth aspect, some embodiments of the disclosure provide a computer readable medium having a computer program stored thereon, where the program, when executed by a processor, implements a method as described in any of the implementations of the first or second aspects.
The above embodiments of the present disclosure have the following beneficial effects: the resource sending method of some embodiments of the present disclosure can reduce the resource request time of the target client to a greater extent. Specifically, the reason for the long resource request time of the target client is that: when the client sends a request to the remote server, the client needs to wait for the response of the remote server, and the problem that the network request is time-consuming exists. Based on this, the resource sending method according to some embodiments of the present disclosure may determine whether the hypertext markup language document resource exists in the target cache when the first hypertext markup language document resource acquisition request to be sent by the target client to the target server is intercepted. And then, when determining that the hypertext markup language document resource exists in the target cache, acquiring the hypertext markup language document resource from the target cache for subsequent transmission to the target client. And then, the hypertext markup language document resource is used as a request response of the first hypertext markup language document resource acquisition request and is sent to the target client. Under the condition that the target server does not need to wait for the response, the target client can be effectively enabled to obtain hypertext markup language document resources needed by the rendered page. Through the operation, the time of the target client side for requesting the hypertext markup language document resource is greatly reduced, and the page rendering efficiency is improved laterally. And then, when a first static resource acquisition request to be sent to the target server side by the target client side is intercepted, the static resource is acquired from the target cache for subsequent sending to the target client side. The static resource is a resource corresponding to each piece of static resource information in a first static resource information list, and the first static resource information list is a list obtained by analyzing the received hypertext markup language document resource by the target client. And finally, sending the static resource to the target client. Here, the target client can be efficiently made to acquire the static resources required for rendering the page without waiting for the target server to respond. Through the operation, the time of the target client side for requesting the static resources is greatly reduced, and the efficiency of page rendering is improved laterally.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale.
Fig. 1 is a schematic diagram of one application scenario of a resource transmission method according to some embodiments of the present disclosure;
fig. 2 is a flow diagram of some embodiments of a resource transmitting method according to the present disclosure;
FIG. 3 is a flow diagram of further embodiments of a method of resource transmission according to the present disclosure;
FIG. 4 is a schematic diagram of one application scenario of a page rendering method according to some embodiments of the present disclosure;
FIG. 5 is a flow diagram of some embodiments of a page rendering method according to the present disclosure;
FIG. 6 is a flow diagram of further embodiments of a page rendering method according to the present disclosure;
fig. 7 is a schematic structural diagram of some embodiments of a resource transmitting apparatus according to the present disclosure;
FIG. 8 is a schematic block diagram of some embodiments of a page rendering apparatus according to the present disclosure;
FIG. 9 is a schematic structural diagram of an electronic device suitable for use in implementing some embodiments of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings. The embodiments and features of the embodiments in the present disclosure may be combined with each other without conflict.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 is a schematic diagram of an application scenario of a resource transmission method according to some embodiments of the present disclosure.
In the application scenario of fig. 1, in response to intercepting a first html document resource acquisition request to be sent by the target client 102 to the target server 103, the electronic device 101 may first determine whether a html document resource 1041 exists in the target cache 104. Then, in response to determining that the hypertext markup language document resource 1041 exists in the target cache 104, the electronic device 101 may obtain the hypertext markup language document resource 1041 from the target cache 104. Next, the electronic device 101 may send the hypertext markup language document resource 1041 to the target client 102 as a request response of the first hypertext markup language document resource obtaining request. Further, in response to intercepting a first static resource obtaining request to be sent from the target client 102 to the target server 103, the electronic device 101 may obtain the static resource 1042 from the target cache 104. The static resource 1042 is a resource corresponding to each static resource information in a first static resource information list, and the first static resource information list is a list obtained by analyzing the received hypertext markup language document resource 1041 by the target client 102. Finally, the static resource 1042 is sent to the target ue 103.
The electronic device 101 may be hardware or software. When the electronic device is hardware, the electronic device may be implemented as a distributed cluster formed by a plurality of servers or terminal devices, or may be implemented as a single server or a single terminal device. When the electronic device is embodied as software, it may be installed in the above-listed hardware devices. It may be implemented, for example, as multiple software or software modules to provide distributed services, or as a single software or software module. And is not particularly limited herein.
Here, it is further explained that the electronic device may be software, for example, a pre-installed interceptor. The ability of the interceptor to intercept requests sent by the target client may be accomplished through the target interface. Such as a Service Worker API.
It should be understood that the number of electronic devices in fig. 1 is merely illustrative. There may be any number of electronic devices, as desired for implementation.
With continued reference to fig. 2, a flow 200 of some embodiments of a resource transmission method according to the present disclosure is shown. The resource sending method comprises the following steps:
In some embodiments, in response to intercepting a first html document resource acquisition request to be sent by a target client to a target server, an executing entity (e.g., the electronic device shown in fig. 1) of the resource sending method may determine whether a html document resource exists in a target cache. The target client is a client of a page to be rendered. The target server is a server of hypertext markup language document resources and static resources to be sent. The first hypertext Markup Language document resource obtaining request may be a request for obtaining a hypertext Markup Language (HTML) document resource from the target server by the target client. The target cache may be generated by a target background task. The target background task may be a task established by the execution subject for storing hypertext markup language document resources and static resources. Here, the execution subject may not occupy the host process resource to establish the target background task. The above hypertext markup language document resources may include, but are not limited to: the client side renders static resource information and service component information required by the page. The service component information may be used for subsequent client rendered page usage.
It should be noted that, before the target client sends the first html document resource acquisition request, the target client has sent at least one html document resource acquisition request. That is, the first html document resource acquisition request is a request that the target client does not send to the target server for the first time in order to acquire the html document resource.
As an example, the execution body may determine whether a hypertext markup language document resource exists in the target cache by sending a query instruction.
In some optional implementations of some embodiments, the target server implements the deployment of the hypertext markup language document resource by:
the method comprises the steps of firstly, obtaining a first resource file set corresponding to hypertext markup language document resources to be deployed. The hypertext markup language document resource to be deployed is composed of various resource files. That is, the above hypertext markup language document resource to be deployed may be composed of a first resource file set.
And secondly, determining a second resource file set corresponding to the hypertext markup language document resource currently stored by the target server. The hypertext markup language document resource currently stored by the target server is composed of various resource files. That is, the hypertext markup language document resource currently stored by the target server may be composed of the second resource file set.
Thirdly, for each first resource file in the first resource file set, executing the following file replacement steps:
the first substep is to determine whether a second resource file having the same file name as the first resource file exists in the second resource file set.
A second substep of determining a second resource file having the same file name as the first resource file as a target resource file in response to determining that a second resource file having the same file name as the first resource file exists in the second resource file set.
The third substep, confirm whether the hash value of the above-mentioned goal resource file is the same as the hash value of the above-mentioned first resource file.
Here, the hash value of the resource file may be the MD5 value of the resource file. The hash value of the resource file may be obtained according to the MD5(MD5 Message-Digest Algorithm) information Digest Algorithm.
And a fourth substep of replacing the target resource files in the second set of resource files with the first resource file in response to determining that the hash value of the target resource file is different from the hash value of the first resource file.
And fourthly, in response to the fact that the target server side completes replacement of the second resource file, sending the entry file resource in the hypertext markup language document resource to be deployed to the target server side. The entry file resource may be a resource of a page corresponding to the entry file. The entry file resource in the static resource required for page rendering may be a file entry resource (index).
And fifthly, responding to the target server to finish the receiving of the entry file resource, and restarting the target service in the target server.
Here, the target service may be a nginx service. The restart target service is used for ensuring that all requests for the old files which are processed by the original nginx service are processed and completed, and preventing errors caused by deleting the old files when the requests are not processed and completed.
Sixthly, in response to the fact that the target service in the target service end is restarted, removing outdated files in the hypertext markup language document resources currently stored by the target service end to complete deployment of the hypertext markup language document resources of the target service end.
By way of example, obsolete files in the hypertext markup language document resource currently stored by the target server may be removed by the following steps:
and substep 1, determining a third resource file set corresponding to the hypertext markup language document resource currently stored by the current target server.
And substep 2, determining at least one third resource file in the third resource file set, which is different from the first resource file set. And the third resource file in the at least one third resource file is an outdated file.
And substep 3, deleting the at least one third resource file from the third resource file set to remove obsolete files in the hypertext markup language document resources currently stored by the target server.
In some embodiments, in response to determining that the html document resource exists in the target cache, the executing entity may obtain the html document resource from the target cache in a wired or wireless manner.
In some embodiments, the execution subject may send the html document resource to the target client in a wired or wireless manner as a request response of the first html document resource obtaining request.
In some embodiments, in response to intercepting a first static resource acquisition request to be sent by the target client to the target server, the execution main body may acquire a static resource from the target cache. The static resource is a resource corresponding to each piece of static resource information in a first static resource information list, and the first static resource information list is a list obtained by analyzing the received hypertext markup language document resource by the target client. And the resource corresponding to each piece of static resource information in the first static resource information list is a resource required by the target client to render a page.
In some optional implementation manners of some embodiments, the static resource stored in the target cache is a packed and separated resource, and the static resource is generated by the following steps:
in the first step, unpacked and separated resources are obtained.
And secondly, packaging each tool file in the unpacked and separated resources according to the first naming format to obtain each packaged first file.
Here, the first naming format may be a format of "package name + version number". Each of the above-described tool class files is often a less frequent file for the source file. The tool class files may include, but are not limited to, at least one of: source files corresponding to the third party solidified libraries and script source files of the tool classes.
When a file change occurs in each packaged first file, the version number of the changed file may be changed.
And thirdly, packaging the rest files in the unpacked and separated resources according to a second naming format to obtain each packaged second file. And the rest files are the files without the tool files in the unpacked and separated resources.
Here, the remaining files are files having a high update frequency. The second naming format described above may be a block hash (chunkhash) naming format. When the files of the second packaged files change, a new hash value of the changed files is generated.
And fourthly, generating the static resource according to the packed first files and the packed second files.
As an example, the packaged first files and the packaged second files may be combined to obtain the static resource.
In some embodiments, the execution agent may send the static resource to the target client.
In some optional implementations of some embodiments, the foregoing step further includes:
in a first step, in response to determining that the hypertext markup language document resource does not exist in the target cache, the execution subject may send a second hypertext markup language document resource acquisition request to the target server. The second html document resource obtaining request may be a request for obtaining the html document resource from the target server by the execution subject.
And a second step, in response to receiving the html document resource associated with the second html document resource acquisition request sent by the target server, the execution body may send the html document resource associated with the second html document resource acquisition request to the target client, and load the html document resource associated with the second html document resource acquisition request to the target cache.
Optionally, the foregoing steps further include:
in response to not receiving the hypertext markup language document resource associated with the second hypertext markup language document resource acquisition request sent by the target server, the execution subject may output information characterizing network request anomalies.
The above embodiments of the present disclosure have the following beneficial effects: the resource sending method of some embodiments of the present disclosure can reduce the resource request time of the target client to a greater extent. Specifically, the reason for the long resource request time of the target client is that: when the client sends a request to the remote server, the client needs to wait for the response of the remote server, and the problem that the network request is time-consuming exists. Based on this, the resource sending method according to some embodiments of the present disclosure may determine whether the hypertext markup language document resource exists in the target cache when the first hypertext markup language document resource acquisition request to be sent by the target client to the target server is intercepted. And then, when determining that the hypertext markup language document resource exists in the target cache, acquiring the hypertext markup language document resource from the target cache for subsequent transmission to the target client. And then, the hypertext markup language document resource is used as a request response of the first hypertext markup language document resource acquisition request and is sent to the target client. Under the condition that the target server does not need to wait for the response, the target client can be effectively enabled to obtain hypertext markup language document resources needed by the rendered page. Through the operation, the time of the target client side for requesting the hypertext markup language document resource is greatly reduced, and the page rendering efficiency is improved laterally. And then, when a first static resource acquisition request to be sent to the target server side by the target client side is intercepted, the static resource is acquired from the target cache for subsequent sending to the target client side. The static resource is a resource corresponding to each piece of static resource information in a first static resource information list, and the first static resource information list is a list obtained by analyzing the received hypertext markup language document resource by the target client. And finally, sending the static resource to the target client. Here, the target client can be efficiently made to acquire the static resources required for rendering the page without waiting for the target server to respond. Through the operation, the time of the target client side for requesting the static resources is greatly reduced, and the efficiency of page rendering is improved laterally.
With further reference to fig. 3, a flow 300 of further embodiments of a resource transmission method according to the present disclosure is shown. The resource sending method comprises the following steps:
In some embodiments, the specific implementation of steps 301 and 302 and the technical effect thereof can refer to step 201 and 202 in the embodiment corresponding to fig. 2, which are not described herein again.
In some embodiments, an executing agent (e.g., the electronic device shown in FIG. 1) may send a check network request to the target server to check whether the hypertext markup language document resource is consistent with the hypertext markup language document resource currently stored by the target server. Wherein, the current stored hypertext markup language document resource of the target server is the latest resource.
In some embodiments, in response to receiving target identification information, which is sent by the target server and indicates that the hypertext markup language document resource differs from the hypertext markup language document resource currently stored by the target server, the execution subject may obtain the hypertext markup language document resource sent by the target server in a wired manner or a wireless manner. The target identification information may be generated by the target server according to the currently stored hypertext markup language document resource and the hypertext markup language document resource stored in the target cache. For example, the above target identification information may be "200". The corresponding static resource can be a static resource corresponding to a hypertext markup language document resource sent by the target server.
As an example, the target identification information may be generated by:
firstly, the target server side sends an acquisition request of hypertext markup language document resources stored in a target cache to the execution main body.
And secondly, generating target identification information through a target protocol in response to the fact that the hypertext markup language document resource currently stored by the target server is inconsistent with the hypertext markup language document resource stored by the target cache.
In addition, in response to determining that the hypertext markup language document resource currently stored by the target server is consistent with the hypertext markup language document resource stored by the target cache, generating the rest of the identification information through the target protocol. For example, the remaining identification information may be "304". The rest of the identification information may represent that the hypertext markup language document resource is consistent with the hypertext markup language document resource currently stored by the target server.
In some embodiments, the execution subject may generate a message that represents that the html document resource acquired by the target client is to be updated, and send the html document resource sent by the target server and the corresponding static resource to the target cache, so that the target cache replaces the currently stored html document resource.
Here, the purpose of generating the above message is to: the target client creates a monitoring task for monitoring the information related to the hypertext markup language document resource to be updated, which is acquired by the target client. Therefore, the message is generated, so that the target client can monitor that the acquired static resource is updated, and the purpose of updating the acquired static resource in real time is achieved.
In addition, the target cache replaces the currently stored hypertext markup language document resources, so that the acquired hypertext markup language document resources and static resources are the latest when the subsequent target client requests again. That is, the page rendered later by the target client is up-to-date.
In some embodiments, the specific implementation of steps 306 and 308 and the technical effects thereof can refer to steps 203 and 205 in the embodiment corresponding to fig. 2, which are not described herein again.
As can be seen from fig. 3, compared with the description of some embodiments corresponding to fig. 2, the flow 300 of the resource sending method in some embodiments corresponding to fig. 3 highlights a specific step of checking whether the resource of the hypertext markup language document stored in the target cache is updated. Therefore, the scheme described by the embodiments can enable the target client to efficiently acquire the latest hypertext markup language document resource and the latest static resource, so that the page rendered by the target client at the later stage is latest.
FIG. 4 is a schematic diagram of one application scenario of a page rendering method according to some embodiments of the present disclosure.
In the application scenario of fig. 4, client 401 may first send a first hypertext markup language document resource acquisition request to target server 402. Before the client 401 sends the first html document resource acquisition request, it has already sent at least one html document resource acquisition request to the target server 402. Then, in response to receiving the hypertext markup language document resource for the first hypertext markup language document resource acquisition request, the client 401 may parse the hypertext markup language document resource 403 to obtain a first static resource information list 404. Next, the client 401 may send a first static resource obtaining request to the target server 402, where the static resource 405 is a resource corresponding to each static resource information in the first static resource information list 404. Finally, in response to receiving the static resource 405 for the static resource acquisition request, a first target script is executed according to the static resource 405 to render a page 406.
The client 401 may be hardware or software. When the client is hardware, the client can be implemented as a distributed cluster formed by a plurality of servers or terminal devices, or can be implemented as a single server or a single terminal device. When the client is embodied as software, it may be installed in the hardware devices enumerated above. It may be implemented, for example, as multiple software or software modules to provide distributed services, or as a single software or software module. And is not particularly limited herein.
It should be understood that the number of clients in fig. 4 is merely illustrative. There may be any number of clients, as desired for the implementation.
With continued reference to fig. 5, a flow 500 of some embodiments of a page rendering method according to the present disclosure is shown. The page rendering method comprises the following steps:
In some embodiments, an execution subject (e.g., the client shown in fig. 4) of the page rendering method may send the first hypertext markup language document resource acquisition request to the target server in a wired manner or a wireless manner. Before sending the first hypertext markup language document resource acquisition request, at least one hypertext markup language document resource acquisition request is sent to the target server.
In some embodiments, in response to receiving a hypertext markup language document resource for the first hypertext markup language document resource acquisition request, the execution subject may parse the hypertext markup language document resource to obtain a first static resource information list.
Here, the above-mentioned hypertext markup language document resource may be transmitted by an interceptor. The ability of the interceptor to intercept requests sent by the target client may be accomplished through the target interface. Such as a Service Worker API.
As an example, the execution subject may parse the hypertext markup language document resource by predefining parsing rules to obtain a first static resource information list.
In some embodiments, the executing entity may send the first static resource obtaining request to the target server in a wired manner or a wireless manner. And the static resource is a resource corresponding to each piece of static resource information in the first static resource information list.
In some embodiments, in response to receiving the static resource sent by the interceptor for the static resource obtaining request, the execution main body may execute a first target script according to the static resource to render a page. The first target script may be a JS script. The static resource may be sent by the interceptor.
As can be seen from fig. 5, the flow 500 of the page rendering method in some embodiments corresponding to fig. 5 can quickly and efficiently render a page. By the method, the target client can efficiently acquire the static resources required by the rendered page without waiting for the response of the target server. Through the operation, the time of the target client side for requesting the static resources is greatly reduced, and the efficiency of page rendering is improved laterally.
With further reference to fig. 6, a flow 600 of further embodiments of a page rendering method according to the present disclosure is shown. The page rendering method comprises the following steps:
In some embodiments, the specific implementation of steps 601-604 and the technical effect thereof can refer to steps 501-504 in the embodiment corresponding to fig. 5, which are not described herein again.
In some embodiments, in response to listening to a message that characterizes the obtained hypertext markup language document resource to be updated, an executing entity (e.g., the client shown in fig. 4) of the page rendering method may send a third hypertext markup language document resource obtaining request to the target server. The obtained html document resource may be a resource that is sent by the interceptor to the execution subject for the first html document resource obtaining request.
In some embodiments, in response to receiving an updated html document resource for the third html document resource acquisition request, the executing entity may parse the updated html document resource to obtain a second static resource information list.
As an example, the executing entity may analyze the updated hypertext markup language document resource by designing an analysis rule in advance to obtain a second static resource information list.
In some embodiments, the execution subject may send a second static resource obtaining request for the updated static resource to the target server.
In some embodiments, in response to receiving the updated static resource for the second static resource acquisition request, the execution principal may execute a second target script according to the updated static resource to render a page. The second target script may be a JS script. The updated static resource may be sent by the interceptor.
As can be seen from fig. 6, the flow 600 of the page rendering method in some embodiments corresponding to fig. 6 highlights the specific steps of the static resource update, compared to the description of some embodiments corresponding to fig. 5. Therefore, the scheme described by the embodiments can enable the target client to efficiently acquire the latest hypertext markup language document resource and the latest static resource, so that the page rendered by the target client at the later stage is latest.
With further reference to fig. 7, as an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a resource transmission apparatus, which correspond to those shown in fig. 2, and which may be applied in various electronic devices.
As shown in fig. 7, a resource transmission apparatus 700 includes: a determining unit 701, a first acquiring unit 702, a first transmitting unit 703, a second acquiring unit 704 and a second transmitting unit 705. The determining unit 701 is configured to determine whether a hypertext markup language document resource exists in a target cache in response to intercepting a first hypertext markup language document resource acquisition request to be sent by a target client to a target server; a first obtaining unit 702, configured to, in response to determining that the hypertext markup language document resource exists in the target cache, obtain the hypertext markup language document resource from the target cache; a first sending unit 703 configured to send the hypertext markup language document resource to the target client as a request response of the first hypertext markup language document resource acquisition request; a second obtaining unit 704, configured to obtain, in response to intercepting a first static resource obtaining request to be sent by the target client to the target server, a static resource from the target cache, where the static resource is a resource corresponding to each piece of static resource information in a first static resource information list, and the first static resource information list is a list obtained by analyzing the received hypertext markup language document resource by the target client; a second sending unit 705 configured to send the static resource to the target client.
In some optional implementations of some embodiments, the apparatus 700 further includes: a fifth transmitting unit and a sixth transmitting unit (not shown in the figure). Wherein the fifth transmitting unit may be configured to: and sending a second hypertext markup language document resource acquisition request to the target server in response to determining that the hypertext markup language document resource does not exist in the target cache. The sixth transmitting unit may be configured to: and in response to receiving the hypertext markup language document resource associated with the second hypertext markup language document resource acquisition request sent by the target server, sending the hypertext markup language document resource associated with the second hypertext markup language document resource acquisition request to the target client, and loading the hypertext markup language document resource associated with the second hypertext markup language document resource acquisition request to the target cache.
In some optional implementations of some embodiments, the apparatus 700 further includes: an output unit (not shown). Wherein the output unit may be configured to: and outputting information representing network request abnormity in response to not receiving the hypertext markup language document resource associated with the second hypertext markup language document resource acquisition request sent by the target server.
In some optional implementations of some embodiments, the apparatus 700 further includes: a seventh sending unit, a third obtaining unit, and a generating unit (not shown). Wherein the seventh transmitting unit may be configured to: and sending a verification network request for verifying whether the hypertext markup language document resources are consistent with the hypertext markup language document resources currently stored by the target server to the target server. The third acquisition unit may be configured to: and responding to the received target identification information which is sent by the target server and represents that the hypertext markup language document resource is different from the hypertext markup language document resource currently stored by the target server, and acquiring the hypertext markup language document resource and the corresponding static resource sent by the target server. The generation unit may be configured to: and generating a message for representing the hypertext markup language document resource to be updated acquired by the target client, and sending the hypertext markup language document resource and the corresponding static resource sent by the target server to the target cache so that the target cache replaces the currently stored hypertext markup language document resource.
In some optional implementation manners of some embodiments, the static resource stored in the target cache is a packed and separated resource, and the static resource is generated by the following steps: acquiring unpacked and separated resources; according to a first naming format, packaging each tool file in the unpacked and separated resources to obtain each packaged first file; packaging other files in the unpacked and separated resources according to a second naming format to obtain second packaged files, wherein the other files are files of the unpacked and separated resources from which the tool files are removed; and generating the static resource according to the packed first files and the packed second files.
In some optional implementations of some embodiments, the target server implements the deployment of the hypertext markup language document resource by: acquiring a first resource file set corresponding to hypertext markup language document resources to be deployed; determining a second resource file set corresponding to the hypertext markup language document resource currently stored by the target server; for each first resource file in the first resource file set, performing the following file replacement steps: determining whether a second resource file with the same file name as the first resource file exists in the second resource file set; determining a second resource file with the same file name as the first resource file as a target resource file in response to determining that a second resource file with the same file name as the first resource file exists in the second resource file set; determining whether the hash value of the target resource file is the same as the hash value of the first resource file; and replacing the target resource files in the second resource file set with the first resource file in response to determining that the hash value of the target resource file is different from the hash value of the first resource file. In response to receiving that the target server completes replacement of a second resource file, sending an entry file resource in the hypertext markup language document resource to be deployed to the target server; responding to the target server to finish the receiving of the entry file resource, and restarting the target service in the target server; and in response to determining that the target service in the target service terminal is restarted, removing outdated files in the hypertext markup language document resource currently stored by the target service terminal to complete deployment of the hypertext markup language document resource of the target service terminal.
It will be understood that the elements described in the apparatus 700 correspond to various steps in the method described with reference to fig. 2. Thus, the operations, features and resulting advantages described above with respect to the method are also applicable to the apparatus 700 and the units included therein, and will not be described herein again.
With further reference to fig. 8, as an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a resource transmission apparatus, which correspond to those shown in fig. 5, and which may be applied in various electronic devices.
As shown in fig. 8, a resource transmission apparatus 800 includes: third transmitting section 801, analyzing section 802, fourth transmitting section 803, and executing section 804. The third sending unit 801 is configured to send a first html document resource obtaining request to a target server, where the first html document resource obtaining request has been sent to the target server at least once before the first html document resource obtaining request is sent; an analyzing unit 802, configured to, in response to receiving a hypertext markup language document resource for the first hypertext markup language document resource acquisition request, analyze the hypertext markup language document resource to obtain a first static resource information list; a fourth sending unit 803, configured to send a first static resource obtaining request to the target server, where a static resource is a resource corresponding to each static resource information in the first static resource information list; an executing unit 804, configured to, in response to receiving the static resource for the first static resource obtaining request, execute a first target script according to the static resource to render a page.
In some optional implementations of some embodiments, the apparatus 800 further includes: an eighth transmitting unit, a resource analyzing unit, a ninth transmitting unit, and a script executing unit (not shown in the figure). Wherein the eighth transmitting unit may be configured to: and responding to the monitored message representing that the acquired hypertext markup language document resource is to be updated, and sending a third hypertext markup language document resource acquisition request to the target server. The resource resolution unit may be configured to: and analyzing the updated hypertext markup language document resource to obtain a second static resource information list in response to receiving the updated hypertext markup language document resource aiming at the third hypertext markup language document resource acquisition request. The ninth transmitting unit may be configured to: and sending a second static resource acquisition request aiming at the updated static resource to the target server, wherein the updated static resource is a resource corresponding to each static resource information in the second static resource information list. The script execution unit may be configured to: and in response to receiving the updated static resource aiming at the second static resource acquisition request, executing a second target script according to the updated static resource to render a page.
It will be understood that the elements described in the apparatus 800 correspond to various steps in the method described with reference to fig. 5. Thus, the operations, features and resulting advantages described above with respect to the method are also applicable to the apparatus 800 and the units included therein, and are not described herein again.
Referring now to fig. 9, a schematic diagram of an electronic device (e.g., the electronic device of fig. 1) 900 suitable for use in implementing some embodiments of the present disclosure is shown. The electronic device shown in fig. 9 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 9, the electronic device 900 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 901 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)902 or a program loaded from a storage means 908 into a Random Access Memory (RAM) 903. In the RAM 903, various programs and data necessary for the operation of the electronic apparatus 900 are also stored. The processing apparatus 901, the ROM 902, and the RAM 903 are connected to each other through a bus 904. An input/output (I/O) interface 905 is also connected to bus 904.
Generally, the following devices may be connected to the I/O interface 905: input devices 906 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 907 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 908 including, for example, magnetic tape, hard disk, etc.; and a communication device 909. The communication device 909 may allow the electronic apparatus 900 to perform wireless or wired communication with other apparatuses to exchange data. While fig. 9 illustrates an electronic device 900 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided. Each block shown in fig. 9 may represent one device or may represent multiple devices as desired.
In particular, according to some embodiments of the present disclosure, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, some embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In some such embodiments, the computer program may be downloaded and installed from a network through the communication device 909, or installed from the storage device 908, or installed from the ROM 902. The computer program, when executed by the processing apparatus 901, performs the above-described functions defined in the methods of some embodiments of the present disclosure.
It should be noted that the computer readable medium described above in some embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In some embodiments of the disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In some embodiments of the present disclosure, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and 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 computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: responding to a first hypertext markup language document resource acquisition request intercepted to be sent to a target server side by a target client side, and determining whether hypertext markup language document resources exist in a target cache or not; in response to determining that the hypertext markup language document resource exists in the target cache, obtaining the hypertext markup language document resource from the target cache; sending the hypertext markup language document resource serving as a request response of the first hypertext markup language document resource acquisition request to the target client; responding to a first static resource acquisition request intercepted to be sent to the target server side by the target client side, and acquiring static resources from the target cache, wherein the static resources are resources corresponding to all static resource information in a first static resource information list, and the first static resource information list is a list obtained by analyzing the received hypertext markup language document resources by the target client side; and sending the static resource to the target client. Sending a first hypertext markup language document resource acquisition request to a target server, wherein the hypertext markup language document resource acquisition request is sent to the target server at least once before the first hypertext markup language document resource acquisition request is sent; in response to receiving a hypertext markup language document resource aiming at the first hypertext markup language document resource acquisition request, analyzing the hypertext markup language document resource to obtain a first static resource information list; sending a first static resource acquisition request to the target server, wherein a static resource is a resource corresponding to each piece of static resource information in the first static resource information list; and in response to receiving the static resource aiming at the first static resource acquisition request, executing a first target script according to the static resource so as to render a page.
Computer program code for carrying out operations for embodiments of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, 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 computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in some embodiments of the present disclosure may be implemented by software, and may also be implemented by hardware. The described units may also be provided in a processor, and may be described as: a processor includes a determination unit, a first acquisition unit, a first transmission unit, a second acquisition unit, and a second transmission unit. The names of these units do not in some cases form a limitation on the unit itself, and for example, the second sending unit may also be described as a "unit sending the static resource to the target client".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is made without departing from the inventive concept as defined above. For example, the above features and (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure are mutually replaced to form the technical solution.
Claims (12)
1. A method for resource transmission, comprising:
responding to a first hypertext markup language document resource acquisition request intercepted to be sent to a target server side by a target client side, and determining whether hypertext markup language document resources exist in a target cache or not;
in response to determining that the hypertext markup language document resource exists in the target cache, obtaining the hypertext markup language document resource from the target cache;
sending the hypertext markup language document resource serving as a request response of the first hypertext markup language document resource acquisition request to the target client;
responding to a first static resource acquisition request intercepted to be sent to the target server side by the target client side, and acquiring static resources from the target cache, wherein the static resources are resources corresponding to all static resource information in a first static resource information list, and the first static resource information list is a list obtained by analyzing the received hypertext markup language document resources by the target client side;
and sending the static resource to the target client.
2. The method of claim 1, wherein the method further comprises:
in response to determining that the hypertext markup language document resource does not exist in the target cache, sending a second hypertext markup language document resource acquisition request to the target server;
in response to receiving the hypertext markup language document resource associated with the second hypertext markup language document resource acquisition request sent by the target server, sending the hypertext markup language document resource associated with the second hypertext markup language document resource acquisition request to the target client, and loading the hypertext markup language document resource associated with the second hypertext markup language document resource acquisition request to the target cache.
3. The method of claim 2, wherein the method further comprises:
and responding to the hypertext markup language document resource which is sent by the target server and is associated with the second hypertext markup language document resource acquisition request, and outputting information representing network request abnormity.
4. The method of claim 1, wherein after said retrieving the hypertext markup language document resource from the target cache in response to determining that the hypertext markup language document resource exists in the target cache, the method further comprises:
sending a verification network request for verifying whether the hypertext markup language document resource is consistent with the hypertext markup language document resource currently stored by the target server to the target server;
responding to the received target identification information which is sent by the target server and represents that the hypertext markup language document resource is different from the hypertext markup language document resource stored at the target server at present, and acquiring the hypertext markup language document resource and the corresponding static resource sent by the target server;
and generating a message for representing the hypertext markup language document resource to be updated acquired by the target client, and sending the hypertext markup language document resource and the corresponding static resource sent by the target server to the target cache so that the target cache replaces the currently stored hypertext markup language document resource.
5. The method of claim 1, wherein the static resources stored in the target cache are packed separated resources, and the static resources are generated by:
acquiring unpacked and separated resources;
according to a first naming format, packaging each tool type file in the unpacked and separated resources to obtain each packaged first file;
packaging other files in the unpacked and separated resources according to a second naming format to obtain each packaged second file, wherein the other files are files of the unpacked and separated resources without the tool files;
and generating the static resource according to the packed first files and the packed second files.
6. The method of claim 1, wherein the target server enables hypertext markup language document resource deployment by:
acquiring a first resource file set corresponding to hypertext markup language document resources to be deployed;
determining a second resource file set corresponding to hypertext markup language document resources currently stored by the target server;
for each first resource file in the first set of resource files, performing the following file replacement steps:
determining whether a second resource file with the same file name as the first resource file exists in the second resource file set;
in response to determining that a second resource file having the same file name as the first resource file exists in the second resource file set, determining a second resource file having the same file name as the first resource file as a target resource file;
determining whether the hash value of the target resource file is the same as the hash value of the first resource file;
replacing target resource files in the second resource file set with the first resource file in response to determining that the hash value of the target resource file is different from the hash value of the first resource file;
in response to receiving that the target server completes replacement of a second resource file, sending an entry file resource in the hypertext markup language document resource to be deployed to the target server;
responding to the target server to finish the receiving of the entry file resource, and restarting the target service in the target server;
and in response to the fact that the target service in the target service end is restarted, removing outdated files in the hypertext markup language document resources currently stored by the target service end to complete deployment of the hypertext markup language document resources of the target service end.
7. A page rendering method, comprising:
sending a first hypertext markup language document resource acquisition request to a target server, wherein the hypertext markup language document resource acquisition request is sent to the target server at least once before the first hypertext markup language document resource acquisition request is sent;
in response to receiving a hypertext markup language document resource aiming at the first hypertext markup language document resource acquisition request, analyzing the hypertext markup language document resource to obtain a first static resource information list;
sending a first static resource acquisition request to the target server, wherein a static resource is a resource corresponding to each static resource information in the first static resource information list;
in response to receiving the static resource for the first static resource acquisition request, executing a first target script according to the static resource to render a page.
8. The method of claim 7, wherein the method further comprises:
responding to the monitored message representing that the acquired hypertext markup language document resource is to be updated, and sending a third hypertext markup language document resource acquisition request to the target server;
in response to receiving updated hypertext markup language document resources of the third hypertext markup language document resource acquisition request, analyzing the updated hypertext markup language document resources to obtain a second static resource information list;
sending a second static resource acquisition request aiming at the updated static resource to the target server, wherein the updated static resource is a resource corresponding to each static resource information in the second static resource information list;
in response to receiving the updated static resource for the second static resource acquisition request, executing a second target script according to the updated static resource to render a page.
9. A resource transmitting apparatus, comprising:
the determining unit is configured to respond to a first hypertext markup language document resource obtaining request intercepted to be sent to a target server side by a target client side, and determine whether hypertext markup language document resources exist in a target cache or not;
a first obtaining unit configured to obtain the hypertext markup language document resource from the target cache in response to determining that the hypertext markup language document resource exists in the target cache;
a first sending unit configured to send the hypertext markup language document resource to the target client as a request response of the first hypertext markup language document resource acquisition request;
a second obtaining unit, configured to obtain, in response to intercepting a first static resource obtaining request to be sent by the target client to the target server, a static resource from the target cache, where the static resource is a resource corresponding to each piece of static resource information in a first static resource information list, and the first static resource information list is a list obtained by analyzing the received hypertext markup language document resource by the target client;
a second sending unit configured to send the static resource to the target client.
10. A page rendering apparatus, comprising:
a third sending unit configured to send a first hypertext markup language document resource acquisition request to a target server, wherein the hypertext markup language document resource acquisition request has been sent to the target server at least once before the first hypertext markup language document resource acquisition request is sent;
the analysis unit is configured to respond to a received hypertext markup language document resource aiming at the first hypertext markup language document resource acquisition request, analyze the hypertext markup language document resource and obtain a first static resource information list;
a fourth sending unit, configured to send a first static resource acquisition request to the target server, where a static resource is a resource corresponding to each static resource information in the first static resource information list;
an execution unit configured to, in response to receiving the static resource for the first static resource acquisition request, execute a first target script in accordance with the static resource to render a page.
11. An electronic device, comprising:
one or more processors;
a storage device having one or more programs stored thereon,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-8.
12. A computer-readable medium, on which a computer program is stored, wherein the program, when executed by a processor, implements the method of any one of claims 1-8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111332792.9A CN114115941A (en) | 2021-11-11 | 2021-11-11 | Resource sending method, page rendering method, apparatus, electronic device and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111332792.9A CN114115941A (en) | 2021-11-11 | 2021-11-11 | Resource sending method, page rendering method, apparatus, electronic device and medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114115941A true CN114115941A (en) | 2022-03-01 |
Family
ID=80378539
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111332792.9A Pending CN114115941A (en) | 2021-11-11 | 2021-11-11 | Resource sending method, page rendering method, apparatus, electronic device and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114115941A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115242775A (en) * | 2022-07-04 | 2022-10-25 | 中国银联股份有限公司 | Resource file acquisition method, device, equipment, medium and product |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110287432A (en) * | 2019-06-28 | 2019-09-27 | 北京金山安全软件有限公司 | Network information processing method and device and electronic equipment |
CN111475180A (en) * | 2019-01-24 | 2020-07-31 | 北京京东尚科信息技术有限公司 | Method and system for updating client cache |
CN111708600A (en) * | 2020-08-20 | 2020-09-25 | 腾讯科技(深圳)有限公司 | Page display method, device, equipment and computer readable storage medium |
CN112015485A (en) * | 2020-08-14 | 2020-12-01 | 北京达佳互联信息技术有限公司 | Page display method and device, electronic equipment and storage medium |
-
2021
- 2021-11-11 CN CN202111332792.9A patent/CN114115941A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111475180A (en) * | 2019-01-24 | 2020-07-31 | 北京京东尚科信息技术有限公司 | Method and system for updating client cache |
CN110287432A (en) * | 2019-06-28 | 2019-09-27 | 北京金山安全软件有限公司 | Network information processing method and device and electronic equipment |
CN112015485A (en) * | 2020-08-14 | 2020-12-01 | 北京达佳互联信息技术有限公司 | Page display method and device, electronic equipment and storage medium |
CN111708600A (en) * | 2020-08-20 | 2020-09-25 | 腾讯科技(深圳)有限公司 | Page display method, device, equipment and computer readable storage medium |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115242775A (en) * | 2022-07-04 | 2022-10-25 | 中国银联股份有限公司 | Resource file acquisition method, device, equipment, medium and product |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112363879B (en) | Cache server performance test method, device, equipment and medium | |
CN112748962A (en) | Application loading method and device, electronic equipment and computer readable medium | |
CN110909521A (en) | Synchronous processing method and device for online document information and electronic equipment | |
CN109918191B (en) | Method and device for preventing frequency of service request | |
CN113760536A (en) | Data caching method and device, electronic equipment and computer readable medium | |
CN112416632B (en) | Event communication method and device, electronic equipment and computer readable medium | |
CN113779004A (en) | A method and device for data verification | |
CN111783005B (en) | Method, device and system for displaying web page, computer system and medium | |
CN113595927A (en) | Method and device for processing mirror flow in bypass mode | |
CN114461247A (en) | Hot update method, device, electronic equipment and computer readable medium | |
CN114115941A (en) | Resource sending method, page rendering method, apparatus, electronic device and medium | |
CN111309366B (en) | Method, device, medium and electronic equipment for managing registration core | |
CN116627530A (en) | Page link jump method, device, electronic equipment and computer readable medium | |
CN113553206B (en) | Data event execution method and device, electronic equipment and computer readable medium | |
CN111338928A (en) | Chrome-based browser testing method and device | |
CN113746661B (en) | A business processing method and device | |
CN111460020B (en) | Method, device, electronic equipment and medium for resolving message | |
CN113449215B (en) | Picture loading method and device | |
CN114785770A (en) | Mirror layer file sending method and device, electronic equipment and computer readable medium | |
CN113132447A (en) | Reverse proxy method and system | |
CN111580890A (en) | Method, apparatus, electronic device, and computer-readable medium for processing features | |
CN118035594B (en) | Method, apparatus, electronic device and computer readable medium for accessing production document | |
CN113778969B (en) | A log processing method and device | |
CN113342837B (en) | Data transmission method, device, electronic equipment and computer readable medium | |
CN114428805A (en) | Page display method, device, equipment and computer readable medium |
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 |