CN115687735A - Single-page application searching method, device and equipment and computer storage medium - Google Patents

Single-page application searching method, device and equipment and computer storage medium Download PDF

Info

Publication number
CN115687735A
CN115687735A CN202211315728.4A CN202211315728A CN115687735A CN 115687735 A CN115687735 A CN 115687735A CN 202211315728 A CN202211315728 A CN 202211315728A CN 115687735 A CN115687735 A CN 115687735A
Authority
CN
China
Prior art keywords
target user
html
resource
page application
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211315728.4A
Other languages
Chinese (zh)
Inventor
林思远
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Construction Bank Corp
CCB Finetech Co Ltd
Original Assignee
China Construction Bank Corp
CCB Finetech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Construction Bank Corp, CCB Finetech Co Ltd filed Critical China Construction Bank Corp
Priority to CN202211315728.4A priority Critical patent/CN115687735A/en
Publication of CN115687735A publication Critical patent/CN115687735A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The application discloses a single-page application searching method, a single-page application searching device, a single-page application searching equipment and a computer storage medium. The single-page application searching method comprises the following steps: receiving a hypertext markup language (HTML) file and a data resource of a single-page application of a target user; analyzing the HTML file to obtain a Document Object Model (DOM) tree, and loading a JavaScript file which the HTML file depends on; executing the JavaScript file, replacing corresponding nodes in the DOM tree with HTML files and data resources of a target user, and generating a first static HTML resource; calling an anchor point parser, and replacing an anchor point link in the first static HTML resource with a non-anchor point link to obtain a second static HTML resource; and sending the second static HTML resource to the gateway. Therefore, the web crawler can comprehensively capture the content of the single-page application, and the search engine can effectively retrieve the related content of the single-page application.

Description

Single-page application searching method, device and equipment and computer storage medium
Technical Field
The present application relates to the field of computer applications, and in particular, to a method, an apparatus, a device, a storage medium, and a computer program product for searching a single-page application.
Background
Typically, single-page applications interact with the user by dynamically rewriting the contents of portions of the current page, rather than the traditional reloading of a server to load an entire new page.
Thus, crawlers of search engines do not have high support for content crawling of such applications, resulting in search engines being unable to retrieve relevant content for a single page application.
Disclosure of Invention
The embodiment of the application provides a single-page application searching method, a single-page application searching device, single-page application searching equipment, a single-page application searching storage medium and a computer program product, and can optimize a server searching end device, so that an existing search engine crawler can effectively crawl resources and contents of multi-user single-page applications in a cloud.
In a first aspect, an embodiment of the present application provides a method for searching a single-page application, where the method includes:
receiving a hypertext markup language (HTML) file and a data resource of a single-page application of a target user, which are sent by a target user agent server;
analyzing the HTML file by calling an HTML analyzer to obtain a Document Object Model (DOM) tree, and loading a JavaScript file which the HTML file depends on;
executing a JavaScript file by calling a JavaScript engine, replacing corresponding nodes in the DOM tree with HTML files and data resources of a target user, and generating a first static HTML resource;
replacing the anchor point link in the first static HTML resource with a non-anchor point link by calling an anchor point resolver to obtain a second static HTML resource;
and sending the second static HTML resource to the gateway.
In some embodiments, before receiving the HTML file and the data resource of the single-page application of the target user sent by the target user agent server, the method further comprises:
receiving a request of a gateway for accessing a user application resource;
marking the request by calling a user routing component to obtain a marking request for requesting a link pointing to the resource from a target user agent server;
inquiring whether the rendering result of the target user is included in a rendering result cache region of the target user;
and sending a marking request to the target user proxy server under the condition that the rendering result of the target user is not included in the rendering result cache region of the target user.
In some embodiments, where the target user rendering results cache region includes target user rendering results, the method further comprises:
and sending the target user rendering result in the target user rendering result cache region to the gateway.
In some embodiments, prior to parsing the HTML file by invoking the HTML parser, the method further comprises:
checking the target user agent server request link by calling a content filter;
in the case where the target user agent server requests that the link not include a target link, the HTML file is parsed by invoking an HTML parser.
In some embodiments, prior to parsing the HTML file by invoking the HTML parser, the method further comprises:
and filtering the target resource pointed by the link requested by the target user agent server through a content filter, wherein the filtered content comprises pictures, videos and Cascading Style Sheet (CSS) files.
In some embodiments, after sending the second static HTML resource to the gateway, the method further comprises:
and writing the first static HTML resource into a rendering result cache region of the corresponding target user.
In some embodiments, after writing the first static HTML resource into the rendering results cache of the corresponding target user, the method further includes:
and detecting the target user rendering result cache storage time in the target user rendering result cache region, and deleting the target user rendering result cache if the storage time is greater than a preset threshold value.
In a second aspect, an embodiment of the present application provides an apparatus for searching a single-page application, where the apparatus includes:
the server-side renderer is used for receiving the hypertext markup language HTML file and the data resource of the single-page application of the target user, which are sent by the target user agent server;
the HTML parser is used for parsing the HTML file to obtain a Document Object Model (DOM) tree and loading a JavaScript file which the HTML file depends on;
the JavaScript engine is used for executing the JavaScript file, replacing the corresponding nodes in the DOM tree with HTML files and data resources of the target user and generating first static HTML resources;
the anchor point resolver is used for replacing the anchor point link in the first static HTML resource with a non-anchor point link to obtain a second static HTML resource;
and the server-side renderer is used for sending the second static HTML resource to the gateway.
In some embodiments, the server-side renderer is further configured to receive a request for accessing a user application resource by the gateway, tag the request by invoking the user routing component, obtain a tag request for requesting a link to the resource from the target user agent server, query whether a rendering result of the target user is included in the rendering result cache of the target user, and send the tag request to the target user agent server if the rendering result of the target user is not included in the rendering result cache of the target user.
In some embodiments, the apparatus further comprises:
and the content filter is used for checking the target user agent server request link, and analyzing the HTML file by calling the HTML analyzer under the condition that the target user agent server request link does not comprise the target link.
In some embodiments, the content filter is further configured to filter a target resource pointed to by the target user agent server request link, and the filtered content includes pictures, videos, and Cascading Style Sheet (CSS) files.
In some embodiments, the server-side renderer is further configured to write the first static HTML resource into a rendering result cache of the corresponding target user.
In some embodiments, the apparatus further comprises:
and the timing cleaner is used for detecting the target user rendering result cache storage time in the target user rendering result cache region, and deleting the target user rendering result cache if the storage time is greater than a preset threshold value.
In a third aspect, an embodiment of the present application provides a single-page application search device, where the electronic device includes: a processor and a memory storing computer program instructions;
the steps of the single page application search method as in any embodiment of the first aspect are implemented when the processor executes the computer program instructions.
In a fourth aspect, the present application provides a computer storage medium, on which computer program instructions are stored, and when executed by a processor, the computer program instructions implement the steps of the single-page application search method in any embodiment of the first aspect.
In a fifth aspect, the present application provides a computer program product, and when executed by a processor of an electronic device, the instructions of the computer program product cause the electronic device to perform the steps of the single-page application search method as in any one of the embodiments of the first aspect.
The method, the device, the equipment and the computer storage medium for searching the single-page application can receive the HTML file and the data resource of the single-page application of the target user sent by the target user proxy server, analyze the HTML file to obtain a Document Object Model (DOM) tree, load a JavaScript file depended by the HTML file, call a JavaScript engine to execute the JavaScript file, replace the corresponding nodes in the DOM tree with the HTML file and the data resource of the target user and replace anchor points with non-anchor points, and finally send the processed HTML resource to a gateway. Therefore, the corresponding nodes in the DOM tree are replaced by HTML files and data resources of the target user, and anchor links which cannot be identified by the web crawler are replaced by non-anchor links which can be identified by the web crawler, so that the web crawler can comprehensively grab the contents of the single-page application, and the search engine can effectively retrieve the related contents of the single-page application.
Drawings
FIG. 1 is a schematic diagram of a system according to an embodiment of the present application;
fig. 2 is a schematic diagram of an apparatus according to an embodiment of the present disclosure.
FIG. 3 is a flowchart illustrating a method for searching a single-page application according to an embodiment of the present disclosure;
FIG. 4 is a flowchart illustrating another method for searching a single-page application according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a single-page application search device according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Features of various aspects and exemplary embodiments of the present application will be described in detail below, and in order to make objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely illustrative of, and not restrictive on, the present application. It will be apparent to one skilled in the art that the present application may be practiced without some of these specific details. The following description of the embodiments is merely intended to provide a better understanding of the present application by illustrating examples thereof.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising 8230; \8230;" comprises 8230; "does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
According to the technical scheme, the data acquisition, storage, use, processing and the like meet relevant regulations of national laws and regulations.
The single-page application is a network application program model, interacts with a user by dynamically rewriting partial content of a current page, and avoids interrupting user experience due to switching among multiple pages instead of reloading a whole new page by a traditional server.
Thus, crawlers of search engines do not have high support for content crawling of such applications, resulting in search engines not being able to retrieve relevant content for a single-page application.
In addition, in a mode of sharing resources by multiple tenants, the performance of crawling the content of the application is also insufficient, and the normal yield of the related content of the single-page application by the search engine is influenced. Here, the tenant refers to an enterprise or an individual who invests in hardware cloud equipment and cloud management services in order to meet the demand for informatization. The tenants are collectively referred to as users in the embodiment of the application.
In order to solve the problems of the prior art, embodiments of the present application provide a method, an apparatus, a device, a medium, and a product for searching a single-page application. The method can be applied to a cloud service search scenario, and a system for the cloud service search scenario is described below with reference to fig. 1.
In the multi-user resource sharing mode, application resources of users are deployed in independent tenant environments, and access of the resources is controlled by proxy servers of the users. The proxy server is responsible for proxying the application resources of the user. In this embodiment, the proxy server may be a WEB server.
FIG. 1 is a schematic diagram of a system according to an embodiment of the present application. As shown in fig. 1, the system comprises a gateway, a device and a plurality of user agent servers, only two of which are schematically shown in fig. 1, namely a user 1 agent server and a user 2 agent server.
When a user side requests to enter cloud service through a gateway, the gateway judges whether the request is crawler access or not through identifying a user agent identifier in the request. If the access is crawler access, the gateway forwards the request to the device. The device marks the request, generates a mark request that the user side requests the target proxy server to link the target proxy server and points to the resource, judges whether the rendering result cache of the user side comprises the rendering result of the user side, and sends the rendering result of the user side to the gateway when the rendering result cache of the user side comprises the rendering result of the user side, and the gateway sends the rendering result of the user side to the user side.
And when the rendering result cache of the user side does not comprise the rendering result of the user side, sending a marking request to the user agent server so as to conveniently acquire resources corresponding to the rendering result of the user in the user agent server, processing the resources and then sending the processed resources to the gateway, and sending the processed resources to the user side by the gateway. .
The apparatus in fig. 1 includes multiple components, specifically including a content filter, a server-side renderer, an HTTP proxy, a tenant route, an anchor interpreter, a JavaScript engine, and multiple tenant rendering buffers, as shown in fig. 2. The functions of the components in the device are described with reference to fig. 3, and fig. 3 is a flowchart illustrating a single-page application search method according to an embodiment of the present application.
As shown in fig. 3, the method for searching a single page application may specifically include the following steps:
s310, receiving the hypertext markup language HTML file and the data resource of the single-page application of the target user, which are sent by the target user agent server.
And receiving the HTML file and the data resource of the single-page application of the target user, which are sent to the gateway by the target user agent server through the server-side renderer, wherein the data resource is acquired by calling the HTTP agent component by the server-side renderer.
The target user agent server is set for different users and is used for storing application resources of the corresponding users, and may be a World Wide Web (Web) server. Hyper Text Mark-up Language (HTML) is a Language used by a WEB browser, and a single page of a target user applies an HTML file for information exchange with a gateway.
S320, analyzing the HTML file by calling an HTML analyzer to obtain a Document Object Model (DOM) tree, and loading a JavaScript file depended by the HTML file.
The HTML file is parsed by an HTML parser of the calling device, and a Document Object Model (DOM) tree of the HTML is obtained, wherein the DOM tree is the HTML regarded as a node tree. In the DOM tree, each node of the tree represents an HTML tag or text item within a tag.
And loading the JavaScript file depended by the HTML file when the Document Object Model (DOM) tree is obtained. The JavaScript file has the functions of embedding the dynamic text into the HTML page, responding to the browser event, reading and writing HTML elements and the like, so that the elements in the HTML file can be read through the JavaScript file and the dynamic text can be embedded into the HTML page.
S330, executing the JavaScript file by calling a JavaScript engine, replacing the corresponding nodes in the DOM tree with HTML files and data resources of the target user, and generating a first static HTML resource.
And the JavaScript engine executes the JavaScript file, reads elements in the HTML file, embeds dynamic texts, dynamically generates pages, and replaces corresponding nodes in the DOM tree with HTML files and data resources of a target user to obtain a first static HTML resource.
And the corresponding node is a node in a DOM tree used in the process of executing the JavaScript file by the JavaScript engine.
S340, replacing the anchor point link in the first static HTML resource with a non-anchor point link by calling an anchor point resolver to obtain a second static HTML resource.
The anchor point resolver is used for scanning the first static HTML resources, replacing anchor point links in the jump connection with non-anchor point links, for example, "/#/link" is replaced with "/anchor/link", and obtaining second static HTML resources after replacement.
And S350, sending the second static HTML resource to the gateway.
And sending the second static HTML resource to the gateway for subsequent processing by the gateway.
Therefore, the HTML file and the data resource of the single-page application of the target user sent by the target user agent server are received, the HTML file is analyzed to obtain a Document Object Model (DOM) tree, the JavaScript file depended on by the HTML file is loaded, the JavaScript engine is called to execute the JavaScript file, corresponding nodes in the DOM tree are replaced by the HTML file and the data resource of the target user, the anchor link is replaced by the non-anchor link, and finally, the processed HTML resource is sent to the gateway. By replacing the corresponding nodes in the DOM tree with HTML files and data resources of a target user and replacing anchor links which are not identified by the web crawler with non-anchor links identified by the web crawler, the web crawler can comprehensively grab the contents of the single-page application, and further the search engine can effectively retrieve the related contents of the single-page application.
In some embodiments, as shown in fig. 3, before receiving the HTML file and the data resource of the single-page application of the target user sent by the target user agent server, the method further includes S300.
S300, receiving a request of a gateway for accessing a user application resource, marking the request by calling a user routing component to obtain a marking request for requesting a link to the resource from a target user proxy server, inquiring whether a rendering result of the target user is included in a rendering result cache region of the target user, and sending the marking request to the target user proxy server under the condition that the rendering result cache region of the target user does not include the rendering result of the target user.
Receiving a request used by a gateway for accessing the application resource, marking the request by a user routing component, wherein the request comprises a target user for identifying the request, and marking the request as a marking request of a corresponding target user, and the marking request is used for requesting a link pointing to the resource from a corresponding target user agent server. For the mark request, whether a rendering result of the target user exists in a rendering result cache region of the target user is inquired, namely whether the target user result cache region comprises a request link pointing to the resource is judged, and the mark request for requesting the link pointing to the resource is sent to the target user proxy server under the condition that the request link pointing to the resource is not included.
Therefore, by identifying and marking the application resource access request from the gateway, the corresponding target user agent server can be quickly found and the marking request is sent to the target user agent server, so that the request response time is shortened and the resource acquisition speed is improved.
In some embodiments, the method further comprises S360 before parsing the HTML file by calling the HTML parser.
And S360, checking the target user agent request link by calling a content filter, and analyzing the HTML file by calling an HTML analyzer under the condition that the target user agent server request link does not comprise the target link.
And the content filter checks a target proxy request link of the resource sent by the target user proxy server, and calls an HTML parser to parse the HTML file sent by the target user proxy server under the condition that the target user proxy server request link does not comprise the target link.
Wherein the target link is a dangerous connection or a connection harmful to the target user.
Therefore, the link requested by the target user agent server is checked, so that the target user can be effectively prevented from being damaged, and the safety and the reliability of resource access of the target user are improved.
In some embodiments, the method further comprises S370 before parsing the HTML file by calling the HTML parser.
And S370, filtering the target resource pointed by the link requested by the target agent through a content filter, wherein the filtered content comprises pictures, videos and Cascading Style Sheet (CSS) files.
And filtering the target resource pointed by the link requested by the target user agent server, removing pictures, videos and CSS files contained in the target resource, and analyzing the HTML file by an HTML analyzer.
Therefore, before the HTML parser parses the HTML file, pictures, videos and CSS files which are not parsed by the web crawler in the target resource are filtered, and the parsing efficiency can be improved.
In some embodiments, after sending the second static HTML resource to the gateway, the method may further include S380.
And S380, writing the first static HTML resource into a rendering result cache region corresponding to the target user.
And the sender replaces the corresponding node in the DOM tree with the HTML file and the data resource of the target user to generate a first static HTML resource and sends the first static HTML resource to the corresponding target user rendering result cache region.
Therefore, the first static HTML resources are stored in the corresponding target user rendering result cache region, when the target user searches the same rendering result again, the rendering result cache can be directly called in the target user rendering result cache region, the target user searching events are reduced, and the target user searching efficiency is improved.
In some embodiments, after writing the first static HTML resource into the rendering result cache of the corresponding target user, the method further includes S390.
And S390, detecting the target user rendering result cache storage time in the target user rendering result cache region, and deleting the target user rendering result cache if the storage time is greater than a preset threshold value.
After the first static HTML resource is written into the rendering result cache region corresponding to the target user, the caching storage time of the rendering result of the target user stored in the rendering result cache region of the target user is detected, and if the storage time is larger than a preset threshold value, the caching of the rendering result of the target user with the storage time larger than the preset threshold value is deleted.
Therefore, the target user rendering result cache with overlong storage time is deleted by cleaning the target user rendering result cache at regular time, and the sufficient storage space of the target user rendering result cache can be ensured.
Based on the same inventive concept, the application also provides a device for single-page application search. This is explained in detail with reference to fig. 5.
Fig. 5 is a schematic structural diagram of a single-page application search apparatus according to an embodiment of the present application.
As shown in fig. 5, the single-page application searching apparatus 500 may include:
the server-side renderer is used for receiving the hypertext markup language HTML file and the data resource of the single-page application of the target user, which are sent by the target user agent server;
the HTML parser is used for parsing the HTML file to obtain a Document Object Model (DOM) tree and loading a JavaScript file which the HTML file depends on;
the JavaScript engine is used for executing the JavaScript file, replacing the corresponding nodes in the DOM tree with HTML files and data resources of the target user and generating first static HTML resources;
the anchor point resolver is used for replacing the anchor point link in the first static HTML resource with the non-anchor point link to obtain a second static HTML resource;
and the server-side renderer is used for sending the second static HTML resource to the gateway.
In some embodiments, the server-side renderer is further configured to receive a request for accessing a user application resource by the gateway, tag the request by invoking the user routing component, obtain a tag request for requesting a link to the resource from the target user agent server, query whether a rendering result of the target user is included in the rendering result cache of the target user, and send the tag request to the target user agent server if the rendering result of the target user is not included in the rendering result cache of the target user.
In some embodiments, the apparatus further comprises:
and the content filter is used for checking the target user agent server request link, and analyzing the HTML file by calling the HTML analyzer under the condition that the target user agent server request link does not comprise the target link.
In some embodiments, the content filter is further configured to filter a target resource pointed to by the target user agent server request link, and the filtered content includes pictures, videos, and cascading style sheet CSS files.
In some embodiments, the server-side renderer is further configured to write the first static HTML resource into a rendering result cache of the corresponding target user.
In some embodiments, the apparatus further comprises:
and the timing cleaner is used for detecting the cache storage time of the rendering result of the target user in the cache region of the rendering result of the target user, and deleting the cache of the rendering result of the target user if the storage time is greater than a preset threshold value.
Therefore, the HTML file and the data resource of the single-page application of the target user sent by the target user agent server are received, the HTML file is analyzed to obtain a Document Object Model (DOM) tree, the JavaScript file depended by the HTML file is loaded, the JavaScript engine is called to execute the JavaScript file, corresponding nodes in the DOM tree are replaced by the HTML file and the data resource of the target user, the anchor link is replaced by the non-anchor link, and finally, the processed HTML resource is sent to the gateway. The method and the system can realize the comprehensive capture of the contents of the single-page application by the web crawler, so that the search engine can effectively retrieve the related contents of the single-page application.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
The electronic device 600 may include a processor 601 and a memory 602 that stores computer program instructions.
Specifically, the processor 601 may include a Central Processing Unit (CPU), or an Application Specific Integrated Circuit (ASIC), or may be configured to implement one or more Integrated circuits of the embodiments of the present Application.
Memory 602 may include a mass storage for data or instructions. By way of example, and not limitation, memory 602 may include a Hard Disk Drive (HDD), floppy Disk Drive, flash memory, optical Disk, magneto-optical Disk, tape, or Universal Serial Bus (USB) Drive or a combination of two or more of these. Memory 602 may include removable or non-removable (or fixed) media, where appropriate. The memory 602 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, the memory 602 is a non-volatile solid-state memory.
Memory 602 may include Read Only Memory (ROM), random Access Memory (RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical, or other physical/tangible memory storage devices. Thus, in general, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software comprising computer-executable instructions and when the software is executed (e.g., by one or more processors), it is operable to perform operations described with reference to the methods according to an aspect of the present disclosure. The processor 601 reads and executes the computer program instructions stored in the memory 602 to implement the methods/steps S110 to S160 in the embodiment shown in fig. 1, and achieve the corresponding technical effects achieved by the embodiments shown in fig. 1 to 6 executing the methods/steps thereof, which are not described herein again for brevity.
In some examples, electronic device 600 may also include a communication interface 603 and a bus 610. As shown in fig. 6, the processor 601, the memory 602, and the communication interface 603 are connected via a bus 610 to complete communication therebetween.
The communication interface 603 is mainly used for implementing communication between modules, apparatuses, units and/or devices in the embodiments of the present application.
In addition, in combination with the single-page application search method in the foregoing embodiments, the embodiments of the present application may provide a computer-readable storage medium to implement. The computer readable storage medium having stored thereon computer program instructions; the computer program instructions, when executed by a processor, implement any of the above-described embodiments of the single page application search method.
The present application further provides a computer program product, and when executed by a processor of an electronic device, the instructions in the computer program product cause the electronic device to execute various processes implementing any one of the above-mentioned embodiments of the method for searching a single-page application.
Examples of computer readable storage media include non-transitory computer readable storage media such as portable disks, hard disks, random Access Memories (RAMs), read Only Memories (ROMs), erasable programmable read only memories (EPROMs or flash memories), portable compact disc read only memories (CD-ROMs), optical storage devices, magnetic storage devices, and so forth.
It is to be understood that the present application is not limited to the particular arrangements and instrumentalities described above and shown in the attached drawings. A detailed description of known methods is omitted herein for the sake of brevity. In the above embodiments, several specific steps are described and shown as examples. However, the method processes of the present application are not limited to the specific steps described and illustrated, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps, after comprehending the spirit of the present application.
The functional blocks shown in the above-described structural block diagrams may be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, it may be, for example, an electronic Circuit, an Application Specific Integrated Circuit (ASIC), suitable firmware, plug-in, function card, or the like. When implemented in software, the elements of the present application are the programs or code segments used to perform the required tasks. The program or code segments may be stored in a machine-readable medium or transmitted by a data signal carried in a carrier wave over a transmission medium or a communication link. A "machine-readable medium" may include any medium that can store or transfer information. Examples of a machine-readable medium include electronic circuits, semiconductor Memory devices, read-Only memories (ROMs), flash memories, erasable Read-Only memories (EROMs), floppy disks, compact disk Read-Only memories (CD-ROMs), optical disks, hard disks, optical fiber media, radio Frequency (RF) links, and so forth. The code segments may be downloaded via computer networks such as the internet, intranet, etc.
It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, the present application is not limited to the order of the above-described steps, that is, the steps may be performed in the order mentioned in the embodiments, may be performed in an order different from the order in the embodiments, or may be performed simultaneously.
Aspects of the present application are described above with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, implement the functions/acts specified in the flowchart and/or block diagram block or blocks. Such a processor may be, but is not limited to, a general purpose processor, a special purpose processor, an application specific processor, or a field programmable logic circuit. It will also be understood 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 for performing the specified functions or acts, or combinations of special purpose hardware and computer instructions.
As described above, only the specific embodiments of the present application are provided, and it can be clearly understood by those skilled in the art that, for convenience and simplicity of description, the specific working processes of the system, the module and the unit described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. It should be understood that the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the present application, and these modifications or substitutions should be covered within the scope of the present application.

Claims (10)

1. A method for searching a single-page application, comprising:
receiving a hypertext markup language (HTML) file and a data resource of a single-page application of a target user, which are sent by a target user agent server;
analyzing the HTML file by calling an HTML analyzer to obtain a Document Object Model (DOM) tree, and loading a JavaScript file which the HTML file depends on;
executing the JavaScript file by calling a JavaScript engine, replacing corresponding nodes in a DOM tree with the HTML file of the target user and the data resource, and generating a first static HTML resource;
replacing the anchor point link in the first static HTML resource with a non-anchor point link by calling an anchor point resolver to obtain a second static HTML resource;
and sending the second static HTML resource to a gateway.
2. The single-page application search method as claimed in claim 1, wherein before receiving the HTML file and the data resource of the single-page application of the target user transmitted from the target user agent server, the method further comprises:
receiving a request for accessing a user application resource by a gateway;
marking the request by calling a user routing component to obtain a marking request for requesting a link pointing to the resource from a target user agent server;
inquiring whether the rendering result of the target user is included in a rendering result cache region of the target user;
and sending the marking request to the target user proxy server under the condition that the rendering result of the target user is not included in the rendering result cache region of the target user.
3. The single-page application search method of claim 2, wherein prior to parsing the HTML file by invoking an HTML parser, the method further comprises:
checking the target user agent server request link by calling a content filter;
in the case where the target user agent server request link does not include a target link, parsing the HTML file by invoking an HTML parser.
4. The single page application search method of claim 2 or 3, wherein prior to parsing the HTML file by invoking an HTML parser, the method further comprises:
and filtering the target resource pointed by the link requested by the target user agent server through a content filter, wherein the filtered content comprises pictures, videos and Cascading Style Sheet (CSS) files.
5. The single-page application search method of claim 1, wherein after sending the second static HTML resource to a gateway, the method further comprises:
and writing the first static HTML resource into a rendering result cache region of a corresponding target user.
6. The single-page application search method of claim 5, wherein after writing the first static HTML resource into a rendering results cache of a corresponding target user, the method further comprises:
and detecting the target user rendering result cache storage time in the target user rendering result cache region, and deleting the target user rendering result cache if the storage time is greater than a preset threshold value.
7. An apparatus for searching a single-page application, the apparatus comprising:
the server-side renderer is used for receiving the hypertext markup language HTML file and the data resource of the single-page application of the target user, which are sent by the target user agent server;
the HTML parser is used for parsing the HTML file to obtain a Document Object Model (DOM) tree and loading a JavaScript file which the HTML file depends on;
the JavaScript engine is used for executing the JavaScript file so as to replace the corresponding nodes in the DOM tree with the HTML files of the target user and the data resources and generate first static HTML resources;
the anchor point resolver is used for replacing the anchor point link in the first static HTML resource with a non-anchor point link to obtain a second static HTML resource;
and the server-side renderer is used for sending the second static HTML resource to the gateway.
8. A single page application search device, the device comprising: a processor and a memory storing computer program instructions;
the processor when executing the computer program instructions implements the steps of the single page application search method of any of claims 1 to 6.
9. A computer-readable storage medium, having stored thereon computer program instructions, which, when executed by a processor, implement the steps of the single-page application search method of any one of claims 1 to 6.
10. A computer program product, characterized in that instructions in the computer program product, when executed by a processor of an electronic device, cause the electronic device to perform the steps of the single page application search method according to any of claims 1-6.
CN202211315728.4A 2022-10-26 2022-10-26 Single-page application searching method, device and equipment and computer storage medium Pending CN115687735A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211315728.4A CN115687735A (en) 2022-10-26 2022-10-26 Single-page application searching method, device and equipment and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211315728.4A CN115687735A (en) 2022-10-26 2022-10-26 Single-page application searching method, device and equipment and computer storage medium

Publications (1)

Publication Number Publication Date
CN115687735A true CN115687735A (en) 2023-02-03

Family

ID=85099116

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211315728.4A Pending CN115687735A (en) 2022-10-26 2022-10-26 Single-page application searching method, device and equipment and computer storage medium

Country Status (1)

Country Link
CN (1) CN115687735A (en)

Similar Documents

Publication Publication Date Title
US20180041530A1 (en) Method and system for detecting malicious web addresses
US20090024748A1 (en) Website monitoring and cookie setting
CN106126693B (en) Method and device for sending related data of webpage
CN102789454B (en) The instant storage means of input frame content in a kind of browsing device net page and system
CN111177519B (en) Webpage content acquisition method, device, storage medium and equipment
CN112632358B (en) Resource link obtaining method and device, electronic equipment and storage medium
CN113518077A (en) Malicious web crawler detection method, device, equipment and storage medium
CN104573520A (en) Method and device for detecting permanent type cross site scripting vulnerability
KR20110008179A (en) Generating sitemaps
CN108632219A (en) A kind of website vulnerability detection method, detection service device and system
CN110598135A (en) Network request processing method and device, computer readable medium and electronic equipment
CN112637361A (en) Page proxy method, device, electronic equipment and storage medium
CN103118033B (en) A kind of defend user website to be tampered method and device
CN103902534A (en) Method and device for triggering local operations through webpage program
CN110674427B (en) Method, device, equipment and storage medium for responding to webpage access request
CN105975599B (en) Method and device for monitoring page embedded points of website
JPWO2014156825A1 (en) Log output control device, method and program
CN104615597A (en) Method, device and system for clearing cache file in browser
CN115687735A (en) Single-page application searching method, device and equipment and computer storage medium
CN102694802B (en) Network access information recording method and device
CN111078975B (en) Multi-node incremental data acquisition system and acquisition method
CN110209959B (en) Information processing method and device
JP5860389B2 (en) Web browsing history acquisition system and method, proxy server, and Web browsing history acquisition program
CN111723400A (en) JS sensitive information leakage detection method, device, equipment and medium
CN111753233A (en) Method and device for loading third-party H5 page and computer readable storage 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