Static webpage generation method and device, electronic equipment and storage medium
By using a function-as-a-service approach, the actual resource name is determined by hashing the resource name and a file stream is generated, solving the problem of low efficiency in static webpage generation in the banking sector and achieving more efficient webpage generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INDUSTRIAL AND COMMERCIAL BANK OF CHINA
- Filing Date
- 2023-10-23
- Publication Date
- 2026-06-23
AI Technical Summary
In cloud computing technology, the efficiency of web page generation in the banking sector is low, mainly due to the large size of application server function packages, which leads to low efficiency in generating static web pages.
By using the function-as-a-service approach, the actual resource name is determined by hashing the resource name, and a file stream of the static resource is generated. Finally, the target network address is generated, which the client can use to access the static resource, thus avoiding dependence on the application server's function package.
It improves the efficiency of static webpage generation, reduces dependence on application server function packages, and increases the speed and efficiency of webpage generation.
Smart Images

Figure CN117390332B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cloud computing technology, and in particular to a method, apparatus, electronic device, and storage medium for generating static web pages. Background Technology
[0002] In the field of cloud computing, file resources are deployed on web pages, generating corresponding URLs (Uniform Resource Locators). Users can then conveniently and quickly browse these file resources by logging into the corresponding web page using the URL.
[0003] In related technologies, users deploy file resources through a web server. The web server includes the necessary function packages for deployment, and these function packages deploy the file resources to the browser.
[0004] However, the function packages in application servers are very large, which can affect the efficiency of webpage generation. For application scenarios in the banking sector, due to the large number of customers and the large number of webpages that need to be generated, generating webpages through application servers faces the problem of low efficiency. Summary of the Invention
[0005] This application provides a method, apparatus, electronic device, and storage medium for generating static web pages, which improves the efficiency of static web page generation.
[0006] In a first aspect, this application provides a method for generating static web pages, comprising: receiving a page generation request sent by a client through a browser, the page generation request including multiple hash resource names, the multiple hash resource names being obtained by hashing multiple actual resource names; determining multiple actual resource names based on the multiple hash resource names; obtaining multiple static resources based on the multiple actual resource names; generating file streams corresponding to the multiple static resources; generating a target network address based on the multiple actual resource names and the file streams, and sending the target network address to the client, the target network address being used by the client to access the multiple static resources.
[0007] In one possible implementation, generating the file stream corresponding to the plurality of static resources includes: determining the resource type of each static resource, wherein the resource type is an image type or a non-image type; for any static resource, generating a sub-file stream corresponding to the static resource according to the resource type of the static resource; and concatenating the sub-file streams corresponding to each static resource to obtain the file stream.
[0008] In one possible implementation, the resource type is the image type; generating a sub-file stream corresponding to the static resource according to the resource type of the static resource includes: performing image feature extraction processing on the static resource to obtain the image features of the static resource; determining an image transcoding function; and calling the image transcoding function to perform image transcoding processing on the image features to obtain the sub-file stream corresponding to the static resource.
[0009] In one possible implementation, the resource type is the non-image type; generating a sub-file stream corresponding to the static resource based on the resource type of the static resource includes: determining a resource identification function corresponding to the static resource; and using the resource identification function to identify and extract the content in the static resource to obtain the sub-file stream corresponding to the static resource file.
[0010] In one possible implementation, the page generation request further includes a file path; determining multiple actual resource names based on the multiple hash resource names includes: obtaining a mapping relationship between hash resource names and actual resource names based on the file path; and determining the multiple actual resource names based on the multiple hash resource names and the mapping relationship.
[0011] In one possible implementation, generating a target network address based on the plurality of actual resource names and the file stream includes: for any given actual resource name, extracting resource name suffix information from the actual resource name and determining the resource format corresponding to the actual resource name based on the resource name suffix information; performing format conversion processing on the resource format corresponding to each actual resource name to obtain a target resource format corresponding to each actual resource name, wherein the target resource format is a browser-recognizable format; and generating the target network address based on the target resource format corresponding to each actual resource name and the file stream.
[0012] In one possible implementation, for any given actual resource name, the resource format corresponding to the actual resource name is converted to obtain the target resource format corresponding to the actual resource name. This includes: obtaining multiple preset resource formats recognizable by the browser; determining whether the multiple preset resource formats include the resource format corresponding to the actual resource name; if not, determining the resource category corresponding to the actual resource name, and based on the resource type corresponding to the actual resource name, determining a first resource format among the multiple preset resource formats, and setting the first resource format as the target resource format, wherein the resource category corresponding to the first resource format is the same as the resource category corresponding to the actual resource name.
[0013] In one possible implementation, the method further includes: receiving a static page access request sent by a client, the static page access request including the target network address; obtaining the plurality of static resources according to the target network address; and sending the plurality of static resources to the client so that the client displays the plurality of static resources through a browser.
[0014] Secondly, this application provides a static webpage generation apparatus, comprising: a receiving module for receiving a page generation request sent by a client through a browser, the page generation request including multiple hash resource names, the multiple hash resource names being obtained by hashing multiple actual resource names; a determining module for determining multiple actual resource names based on the multiple hash resource names; an obtaining module for obtaining multiple static resources based on the multiple actual resource names; a generating module for generating file streams corresponding to the multiple static resources; and a sending module for generating a target network address based on the multiple actual resource names and the file streams, and sending the target network address to the client, the target network address being used by the client to access the multiple static resources.
[0015] In one possible implementation, the generation module is specifically configured to determine the resource type of each static resource, wherein the resource type is an image type or a non-image type; the generation module is further configured to generate a sub-file stream corresponding to any static resource based on the resource type of the static resource; the generation module is further configured to concatenate the sub-file streams corresponding to each static resource to obtain the file stream.
[0016] In one possible implementation, the resource type is the image type; the generation module is specifically used to perform image feature extraction processing on the static resource to obtain the image features of the static resource; the generation module is further used to determine the image transcoding function; the generation module is further used to call the image transcoding function to perform image transcoding processing on the image features to obtain the sub-file stream corresponding to the static resource.
[0017] In one possible implementation, the resource type is the non-image type; the generation module is specifically used to determine the resource identification function corresponding to the static resource; the generation module is also specifically used to perform identification and extraction processing on the content in the static resource through the resource identification function to obtain the sub-file stream corresponding to the static resource file.
[0018] In one possible implementation, the page generation request further includes a file path; the apparatus further includes: a corresponding module, configured to obtain a mapping relationship between hash resource names and actual resource names based on the file path; the corresponding module is further configured to determine the plurality of actual resource names based on the plurality of hash resource names and the mapping relationship.
[0019] In one possible implementation, the apparatus further includes: a conversion module, configured to extract resource name suffix information from any given actual resource name, and determine the resource format corresponding to the actual resource name based on the resource name suffix information; the conversion module is further configured to perform format conversion processing on the resource format corresponding to each actual resource name to obtain a target resource format corresponding to each actual resource name, wherein the target resource format is a browser-recognizable format; the conversion module is further configured to generate the target network address based on the target resource format corresponding to each actual resource name and the file stream.
[0020] In one possible implementation, for any given actual resource name; the conversion module is specifically configured to acquire multiple preset resource formats recognizable by the browser; the conversion module is further configured to determine whether the multiple preset resource formats include the resource format corresponding to the actual resource name; the conversion module is further configured to, if not, determine the resource category corresponding to the actual resource name, and based on the resource type corresponding to the actual resource name, determine a first resource format among the multiple preset resource formats, and determine the first resource format as the target resource format, wherein the resource category corresponding to the first resource format is the same as the resource category corresponding to the actual resource name.
[0021] In one possible implementation, the apparatus further includes: a display module, configured to receive a static page access request sent by a client, the static page access request including the target network address; the display module is further configured to obtain the plurality of static resources according to the target network address; the display module is further configured to send the plurality of static resources to the client, so that the client displays the plurality of static resources through a browser.
[0022] Thirdly, this application provides an electronic device, including: a processor, and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the method described in any one of the first aspects.
[0023] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which are executed by a processor as described in any one of the first aspects.
[0024] Fifthly, this application provides a computer program product, including a computer program, which is executed by a processor as described in any one of the first aspects.
[0025] The static webpage generation method, apparatus, electronic device, and storage medium provided in this application include: receiving a page generation request sent by a client through a browser, the page generation request including multiple hash resource names, the multiple hash resource names being obtained by hashing multiple actual resource names; determining multiple actual resource names based on the multiple hash resource names; obtaining multiple static resources based on the multiple actual resource names; generating file streams corresponding to the multiple static resources; generating a target network address based on the multiple actual resource names and the file streams, and sending the target network address to the client, the target network address being used by the client to access the multiple static resources. This solution executes static page generation using a function-as-a-service approach, independent of application servers and unaffected by application server function packages, thereby improving the efficiency of static webpage generation. Attached Figure Description
[0026] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0027] Figure 1 A schematic diagram illustrating an application scenario of a static webpage generation method provided in this application embodiment;
[0028] Figure 2 A flowchart illustrating a method for generating a static webpage provided in an embodiment of this application;
[0029] Figure 3 A flowchart illustrating a method for generating a static webpage provided in an embodiment of this application;
[0030] Figure 4 This is a schematic diagram of a sub-file stream provided in an embodiment of this application;
[0031] Figure 5 This is a schematic diagram illustrating the generation of a target network address provided in an embodiment of this application;
[0032] Figure 6 A schematic diagram of a static webpage generation device provided in an embodiment of this application;
[0033] Figure 7 A schematic diagram of a static webpage generation device provided in an embodiment of this application;
[0034] Figure 8This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0035] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0036] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0037] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with relevant laws, regulations and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0038] It should be noted that the method and apparatus for generating static web pages in this application can be used in the field of cloud computing, or in any field other than cloud computing. The application field of the method and apparatus for generating static web pages in this application is not limited.
[0039] Figure 1 This diagram illustrates an application scenario of a static webpage generation method provided in this application. Using the illustrated scenario as an example: A user sends static resources and a page generation request to a browser via a client. The browser generates a network address based on the static resources and sends the network address back to the client. The user can then click on the network address to view the static resource on the webpage.
[0040] The data transmission method provided in this application is intended to solve the above-mentioned technical problems of the prior art.
[0041] The technical solutions of this application will be described in detail below with reference to specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. In the description of this application, unless otherwise expressly specified and limited, the terms should be broadly understood within the art. The embodiments of this application will now be described with reference to the accompanying drawings.
[0042] Figure 2 The following is a flowchart illustrating a method for generating a static webpage, provided in an embodiment of this application. The method includes the following steps:
[0043] S201. Receive a page generation request sent by the client through a browser. The page generation request includes multiple hash resource names, which are obtained by hashing multiple actual resource names.
[0044] As an example, the execution subject of this embodiment can be a static webpage generation device, which can be implemented in various ways. For example, it can be program software, or a medium storing relevant computer programs, such as a USB flash drive; or, the device can also be a physical device that integrates or installs relevant computer programs, such as a chip, a smart terminal, a computer, a server, etc.
[0045] This application utilizes a function-as-a-service (FAA) approach to generate static pages, where FAA replaces the application server in related technologies with a cloud-based function computing platform. The function computing platform processes the page generation requests initiated by the browser and obtains the network address.
[0046] For example, Function as a Service (FaS) is an event-driven computation execution model that runs in stateless containers. These functions utilize services to manage server logic and state. FaS allows users to create, run, and manage application packages as functions without maintaining the underlying infrastructure. The Function Compute platform dynamically adjusts resource usage based on actual traffic volume, thereby improving processing efficiency.
[0047] Optionally, the hash resource name can be replaced by a unique number.
[0048] S202. Based on the multiple hash resource names, determine multiple actual resource names.
[0049] The actual resource name is the actual name of the static resource.
[0050] For example, the transmission of page generation requests uses hashed resource names. Based on hash encryption, security can be improved, and the actual resource name is determined on the Function Compute platform.
[0051] Optionally, the hash resource name does not include file format suffix information, while the actual resource name does include file format suffix information.
[0052] S203. Obtain multiple static resources based on the multiple actual resource names.
[0053] Static resources include, but are not limited to, resource types such as images.
[0054] For example, the client sends static resources through a browser, and the Function Compute platform determines the static resource corresponding to each actual resource name.
[0055] S204. Generate file streams corresponding to the multiple static resources.
[0056] For example, static resources can be converted into file streams, which provide a way to write bytes to and read bytes from backing storage. File streams can be used for both storage and transmission.
[0057] S205. Based on the multiple actual resource names and the file stream, generate a target network address and send the target network address to the client. The target network address is used by the client to access the multiple static resources.
[0058] The target network address is a unique network address.
[0059] For example, a target network address can access the corresponding pair of file streams simultaneously.
[0060] Optionally, other clients can access multiple static resources corresponding to the target network address.
[0061] Alternatively, the page generation request may include whether to encrypt the target network address. If the target network address is encrypted, a password will be required to access multiple static resources after logging into the target network address.
[0062] The static webpage generation method provided in this application embodiment receives a page generation request sent by a client through a browser. The page generation request includes multiple hash resource names, which are obtained by hashing multiple actual resource names. Based on the multiple hash resource names, multiple actual resource names are determined. Based on the multiple actual resource names, multiple static resources are obtained. A file stream corresponding to the multiple static resources is generated. Based on the multiple actual resource names and the file stream, a target network address is generated and sent to the client. The target network address is used by the client to access the multiple static resources. This solution uses a function-as-a-service approach to generate static pages, independent of application servers and unaffected by application server function packages, thereby improving the efficiency of static webpage generation.
[0063] Based on any of the above embodiments, the following, in conjunction with Figure 3 This section provides a detailed explanation of the process of generating static web pages.
[0064] Figure 3 This is a flowchart illustrating a method for generating a static webpage, as provided in an embodiment of this application. Figure 3 As shown, the method includes:
[0065] S301. Receive a page generation request sent by the client through a browser. The page generation request includes multiple hash resource names, which are obtained by hashing multiple actual resource names.
[0066] It should be noted that the execution process of S301 is the same as that of S201, and will not be repeated here.
[0067] S302, The page generation request also includes a file path; based on the file path, the mapping relationship between the hash resource name and the actual resource name is obtained.
[0068] In a scenario example, after generating a hash resource name based on the actual resource name, a mapping relationship between the actual resource name and the hash resource name is established, and the generated mapping relationship is stored in a file path.
[0069] S303. Determine the multiple actual resource names based on the multiple hash resource names and the mapping relationship.
[0070] In terms of specific scenarios, hash resource names are used to improve security during transmission, and the actual resource name needs to be used when generating the target network address.
[0071] It should be noted that, in addition to hash encryption, other encryption methods are also applicable to this application.
[0072] S304. Obtain multiple static resources based on the multiple actual resource names.
[0073] It should be noted that the execution process of S304 is the same as that of S203, and will not be repeated here.
[0074] S305. Determine the resource type of each static resource, wherein the resource type is an image type or a non-image type.
[0075] Optionally, the suffix information of the actual resource name can be parsed to determine the resource type.
[0076] Alternatively, the page generation request may include the resource type, and the resource type may be extracted from the page generation request.
[0077] S306. For any static resource, generate a sub-file stream corresponding to the static resource according to the resource type of the static resource.
[0078] To illustrate with a scenario example, the process of generating sub-file streams differs depending on the resource type and the corresponding module used.
[0079] One feasible implementation method is that the resource type is the image type; according to the resource type of the static resource, a sub-file stream corresponding to the static resource is generated, including: performing image feature extraction processing on the static resource to obtain the image features of the static resource; determining an image transcoding function; calling the image transcoding function to perform image transcoding processing on the image features to obtain the sub-file stream corresponding to the static resource.
[0080] Optionally, image features include feature vectors for each pixel in the image, and multiple feature vectors can be combined to form a complete static resource.
[0081] In a scenario example, transcoding image features to obtain a sub-file stream only changes the storage format without altering the image content. This sub-file stream can then be transmitted and stored on a webpage.
[0082] One feasible implementation method is that the resource type is the non-image type; according to the resource type of the static resource, a sub-file stream corresponding to the static resource is generated, including: determining the resource identification function corresponding to the static resource; and using the resource identification function to identify and extract the content in the static resource to obtain the sub-file stream corresponding to the static resource file.
[0083] Below, in conjunction with Figure 4 Provide a description of the sub-file stream.
[0084] Figure 4 This is a schematic diagram of a sub-file stream provided in an embodiment of this application. For example... Figure 4 As shown, static resources are identified, and their types are determined by their actual resource names. If the resource type is an image, the features of the static resource are extracted, and these features are transcoded to obtain a sub-file stream. If the resource type is not an image, a resource identification function is used to identify and extract the relevant features to obtain a sub-file stream.
[0085] In this feasible implementation, static resources are converted into sub-file streams that can be displayed on a webpage, thus effectively enabling the deployment of file resources.
[0086] S307. The sub-file streams corresponding to each static resource are concatenated to obtain the file stream.
[0087] In a scenario example, a user-initiated page generation request may include multiple static resources. The user's requirement is to generate a webpage containing multiple static resources. In this case, multiple sub-file streams are concatenated, and the concatenated file stream corresponds to a network address.
[0088] Optionally, the page generation request includes the order of multiple static resources, and the multiple sub-file streams are concatenated according to the order.
[0089] For example, users can define the order in which static resources are arranged, and the generated webpage will then display the static resources in that order.
[0090] S308. For any given actual resource name, extract the resource name suffix information from the actual resource name, and determine the resource format corresponding to the actual resource name based on the resource name suffix information.
[0091] In terms of specific scenarios, file extensions include, but are not limited to, "JPG", "PNG", and "TIF". Each extension corresponds to a different resource format, and each resource format corresponds to a different reading method. The resource can be opened normally using the corresponding reading method.
[0092] S309. Perform format conversion processing on the resource format corresponding to each actual resource name to obtain the target resource format corresponding to each actual resource name, wherein the target resource format is a format that can be recognized by the browser.
[0093] In a scenario example, web pages generated directly from the original resource format will exhibit garbled characters when displaying static resources. Therefore, it is necessary to convert the original resource format into a target resource format that the browser can recognize.
[0094] Optionally, a mapping relationship can be established between resource formats, with each original resource format having a corresponding target resource format.
[0095] One feasible implementation involves, for any given actual resource name, performing a format conversion process on the resource format corresponding to the actual resource name to obtain the target resource format corresponding to the actual resource name. This includes: obtaining multiple preset resource formats recognizable by the browser; determining whether the multiple preset resource formats include the resource format corresponding to the actual resource name; if not, determining the resource category corresponding to the actual resource name, and based on the resource type corresponding to the actual resource name, determining a first resource format among the multiple preset resource formats, and setting the first resource format as the target resource format, wherein the resource category corresponding to the first resource format is the same as the resource category corresponding to the actual resource name.
[0096] In a scenario example, if the preset resource formats do not include the resource format corresponding to the actual resource name, then the resource format corresponding to the actual resource name will be used first. If the preset resource formats do not include the resource format corresponding to the actual resource name, then the first resource format needs to be used as a substitute. Specifically, if the resource format corresponding to the actual resource name is the "JPG" image format, and there is no "JPG" format among the multiple preset resource formats, then the first resource format will be determined from the image formats among the multiple preset resource formats.
[0097] In this feasible implementation, in scenarios where the preset resource format does not include the resource format corresponding to the actual resource name, a first resource format is determined as an alternative, thereby effectively generating static web pages.
[0098] S310. Generate the target network address based on the target resource format corresponding to each actual resource name and the file stream.
[0099] Below, in conjunction with Figure 5 The method for generating the target network address is explained.
[0100] Figure 5 This is a schematic diagram illustrating the generation of a target network address as provided in an embodiment of this application. Figure 5 As shown, the resource format is determined based on the actual resource name, and the resource format is converted to obtain a target resource format that the browser can recognize. Static resources are processed to obtain a file stream that the browser can receive and cache. The target network address generated based on the target resource format and the file stream can be displayed correctly in the browser's webpage.
[0101] One feasible implementation method for generating static web pages further includes: receiving a static page access request sent by a client, the static page access request including the target network address; obtaining the plurality of static resources based on the target network address; and sending the plurality of static resources to the client so that the client displays the plurality of static resources through a browser.
[0102] In a scenario example, for the use case of a target network address, in response to the client's access to the target network address, the static resources corresponding to the target network address are obtained and displayed on the client.
[0103] Optionally, static resources accessed by the client can be cached, with the cached content kept for a preset time so that it can be displayed quickly when the client accesses it again.
[0104] In this feasible implementation, by generating static web pages, resources can be widely disseminated via the network, thus achieving resource sharing.
[0105] Figure 6 This is a schematic diagram of a static webpage generation device provided in an embodiment of this application. Figure 6 As shown, the static webpage generation device 60 may include: a receiving module 61, a determining module 62, an acquiring module 63, a generating module 64, and a sending module 65, wherein...
[0106] The receiving module 61 is used to receive a page generation request sent by the client through a browser. The page generation request includes multiple hash resource names, which are obtained by hashing multiple actual resource names.
[0107] The determining module 62 is used to determine multiple actual resource names based on the multiple hash resource names;
[0108] The acquisition module 63 is used to acquire multiple static resources based on the multiple actual resource names;
[0109] The generation module 64 is used to generate file streams corresponding to the plurality of static resources;
[0110] The sending module 65 is used to generate a target network address based on the plurality of actual resource names and the file stream, and send the target network address to the client. The target network address is used by the client to access the plurality of static resources.
[0111] Optionally, the receiving module 61 can perform... Figure 2 S201 in the embodiment.
[0112] Optionally, module 62 can be executed. Figure 2 S202 in the embodiment.
[0113] Optionally, module 63 can be executed. Figure 2 S203 in the embodiment.
[0114] Optionally, the generation module 64 can be executed. Figure 2 S204 in the embodiment.
[0115] Optionally, the sending module 65 can perform... Figure 2 S205 in the embodiment.
[0116] It should be noted that the static webpage generation apparatus shown in the embodiments of this application can execute the technical solutions shown in the above method embodiments, and its implementation principle and beneficial effects are similar, so they will not be described again here.
[0117] In one possible implementation, the generation module 64 is specifically used for:
[0118] Determine the resource type for each static resource, wherein the resource type is either an image type or a non-image type;
[0119] For any given static resource, generate a sub-file stream corresponding to the static resource based on the resource type of the static resource;
[0120] The sub-file streams corresponding to each static resource are concatenated to obtain the file stream.
[0121] In one possible implementation, the resource type is the image type; the generation module 64 is specifically used for:
[0122] The static resource is subjected to image feature extraction processing to obtain the image features of the static resource;
[0123] Determine the image transcoding function;
[0124] The image transcoding function is called to perform image transcoding on the image features to obtain the sub-file stream corresponding to the static resource.
[0125] In one possible implementation, the resource type is the non-image type; the generation module 64 is specifically used for:
[0126] Determine the resource identification function corresponding to the static resource;
[0127] The resource identification function is used to identify and extract the content of the static resource to obtain the sub-file stream corresponding to the static resource file.
[0128] Figure 7 This is a schematic diagram of a static webpage generation device provided in an embodiment of this application. Figure 6 Based on the illustrated embodiments, as Figure 7 As shown, the static webpage generation device 70 further includes: a corresponding module 66, a conversion module 67, and a display module 68, wherein:
[0129] The corresponding module 66 is used for:
[0130] Based on the file path, obtain the mapping relationship between the hash resource name and the actual resource name;
[0131] The plurality of actual resource names are determined based on the plurality of hash resource names and the mapping relationship.
[0132] The conversion module 67 is used for:
[0133] For any given actual resource name, extract the resource name suffix information from the actual resource name, and determine the resource format corresponding to the actual resource name based on the resource name suffix information;
[0134] The resource format corresponding to each actual resource name is converted to obtain the target resource format corresponding to each actual resource name. The target resource format is a format that can be recognized by the browser.
[0135] The target network address is generated based on the target resource format corresponding to each actual resource name and the file stream.
[0136] In one possible implementation, for any given actual resource name, the conversion module 67 is specifically used for:
[0137] Obtain multiple preset resource formats that the browser can recognize;
[0138] Determine whether the plurality of preset resource formats includes the resource format corresponding to the actual resource name;
[0139] If not, then determine the resource category corresponding to the actual resource name, and based on the resource type corresponding to the actual resource name, determine the first resource format from the plurality of preset resource formats, and determine the first resource format as the target resource format, wherein the resource category corresponding to the first resource format is the same as the resource category corresponding to the actual resource name.
[0140] The display module 68 is used for:
[0141] Receive a static page access request sent by the client, wherein the static page access request includes the target network address;
[0142] Based on the target network address, obtain the plurality of static resources;
[0143] Send the plurality of static resources to the client so that the client can display the plurality of static resources through a browser.
[0144] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application, such as... Figure 8 As shown, the electronic device includes:
[0145] The electronic device includes a processor 291 and a memory 292; it may also include a communication interface 293 and a bus 294. The processor 291, memory 292, and communication interface 293 can communicate with each other via the bus 294. The communication interface 293 can be used for information transmission. The processor 291 can invoke logical instructions stored in the memory 292 to execute the methods of the above embodiments.
[0146] Furthermore, the logic instructions in the aforementioned memory 292 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.
[0147] The memory 292, as a computer-readable storage medium, can be used to store software programs and computer-executable programs, such as program instructions / modules corresponding to the methods in the embodiments of this application. The processor 291 executes functional applications and data processing by running the software programs, instructions, and modules stored in the memory 292, thereby implementing the methods in the above-described method embodiments.
[0148] The memory 292 may include a program storage area and a data storage area. The program storage area may store the operating system and application programs required for at least one function; the data storage area may store data created based on the use of the terminal device. Furthermore, the memory 292 may include high-speed random access memory and may also include non-volatile memory.
[0149] This application provides a non-transitory computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the methods described in the foregoing embodiments.
[0150] This application provides a computer program product, including a computer program that, when executed by a processor, implements the method described in the foregoing embodiments.
[0151] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0152] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.
[0153] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A method for generating static web pages, characterized in that, include: The client receives a page generation request sent through a browser. The page generation request includes multiple hash resource names, which are obtained by hashing multiple actual resource names. Based on the multiple hash resource names, multiple actual resource names are determined; Based on the multiple actual resource names, obtain multiple static resources; Generate file streams corresponding to the multiple static resources; The process of generating file streams corresponding to the plurality of static resources includes: determining the resource type of each static resource, wherein the resource type is an image type or a non-image type; for any static resource, generating a sub-file stream corresponding to the static resource according to the resource type of the static resource; and concatenating the sub-file streams corresponding to each static resource to obtain the file stream. Based on the multiple actual resource names and the file stream, a target network address is generated and sent to the client. The target network address is used by the client to access the multiple static resources.
2. The method according to claim 1, characterized in that, The resource type is the image type; Based on the resource type of the static resource, generate a sub-file stream corresponding to the static resource, including: The static resource is subjected to image feature extraction processing to obtain the image features of the static resource; Determine the image transcoding function; The image transcoding function is called to perform image transcoding on the image features to obtain the sub-file stream corresponding to the static resource.
3. The method according to claim 1, characterized in that, The resource type is the non-image type; Based on the resource type of the static resource, generate a sub-file stream corresponding to the static resource, including: Determine the resource identification function corresponding to the static resource; The resource identification function is used to identify and extract the content of the static resource to obtain the sub-file stream corresponding to the static resource.
4. The method according to claim 1, characterized in that, The page generation request also includes a file path; based on the multiple hash resource names, multiple actual resource names are determined, including: Based on the file path, obtain the mapping relationship between the hash resource name and the actual resource name; The plurality of actual resource names are determined based on the plurality of hash resource names and the mapping relationship.
5. The method according to claim 1, characterized in that, Based on the multiple actual resource names and the file stream, a target network address is generated, including: For any given actual resource name, extract the resource name suffix information from the actual resource name, and determine the resource format corresponding to the actual resource name based on the resource name suffix information; The resource format corresponding to each actual resource name is converted to obtain the target resource format corresponding to each actual resource name. The target resource format is a format that can be recognized by the browser. The target network address is generated based on the target resource format corresponding to each actual resource name and the file stream.
6. The method according to claim 5, characterized in that, For any given actual resource name; The resource format corresponding to the actual resource name is converted to obtain the target resource format corresponding to the actual resource name, including: Obtain multiple preset resource formats that the browser can recognize; Determine whether the plurality of preset resource formats includes the resource format corresponding to the actual resource name; If not, then determine the resource category corresponding to the actual resource name, and based on the resource type corresponding to the actual resource name, determine the first resource format from the plurality of preset resource formats, and determine the first resource format as the target resource format, wherein the resource category corresponding to the first resource format is the same as the resource category corresponding to the actual resource name.
7. The method according to any one of claims 1-6, characterized in that, The method further includes: Receive a static page access request sent by the client, wherein the static page access request includes the target network address; Based on the target network address, obtain the plurality of static resources; Send the plurality of static resources to the client so that the client can display the plurality of static resources through a browser.
8. A device for generating static web pages, characterized in that, include: The receiving module is used to receive a page generation request sent by the client through a browser. The page generation request includes multiple hash resource names, which are obtained by hashing multiple actual resource names. The determination module is used to determine multiple actual resource names based on the multiple hash resource names; The acquisition module is used to acquire multiple static resources based on the multiple actual resource names; The generation module is used to generate file streams corresponding to the multiple static resources; The generation module is specifically used to determine the resource type of each static resource, wherein the resource type is an image type or a non-image type; the generation module is also specifically used to generate a sub-file stream corresponding to any static resource according to the resource type of the static resource; and to concatenate the sub-file streams corresponding to each static resource to obtain the file stream; The sending module is configured to generate a target network address based on the plurality of actual resource names and the file stream, and send the target network address to the client, wherein the target network address is used by the client to access the plurality of static resources.
9. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-7.
11. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method of any one of claims 1-7.