Method, system and device for generating HTML page and medium

By reading file data in the backend program and interacting with the database, the problem of physical file loss in containerized deployment and load balancing scenarios is solved, and the rapid generation of physical files is achieved, which improves the response speed and user experience of the data visualization system, and enhances data security.

CN120336661APending Publication Date: 2025-07-18INSPUR GENERSOFT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510493622.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-18
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

In containerized deployment scenarios, physical files are easily lost after restarting the service, and physical files cannot be quickly generated when the first request is forwarded to a new server in the load balancing scenario, resulting in a decrease in the response speed and user experience of the data visualization system.

Method used

By reading file data in the backend program and interacting with the database using SQL statements, ensuring data persistence and quickly generating physical files from the database when container restarts or server switches, a multi-dimensional encryption mechanism is used to improve data security and reliability.

Benefits of technology

In containerized deployment and load balancing scenarios, physical files can be quickly generated without manual saving or complex configuration, which improves the response speed and user experience of the data visualization system, while improving data security and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120336661A_ABST
    Figure CN120336661A_ABST
Patent Text Reader

Abstract

The invention provides an HTML (Hypertext Markup Language) page generation method, system and device and a medium, and belongs to the field of computer software. The method comprises the following steps: a data storage process: reading file data by a back-end program according to a path and a name of a physical file, and connecting a database; the method comprises the following steps of: creating an SQL (Structured Query Language) statement for inserting data, and executing the SQL statement, namely firstly judging whether data of the physical file exists in a database, if not, inserting file data, and if so, performing data updating operation, and a page generation process: reading the data of the physical file stored in the database, and generating the corresponding physical file according to an application scene. In a containerized deployment scene and a load balancing scene, the generated physical file does not need to be stored manually or through other complex configurations. After a containerized deployment scene restarts a service or in a load balancing scene, when the request is forwarded to the new server, the corresponding physical file can be quickly generated, and the response speed and the user experience are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of computer software, and particularly relates to a method, system, device and medium for generating an HTML page. Background Art

[0002] In the field of data visualization products, more and more applications are deployed in a containerized manner, which has the advantages of high resource utilization rate, strong deployment flexibility, high scalability, etc. However, containers were designed to be stateless services from the beginning, which means they should not save any persistent data inside the container. Containers are temporary, and when a container is deleted or restarted, the data inside the container will be lost. At the same time, many applications are also deployed in a load balancing manner. Load balancing distributes user requests to multiple servers for processing, avoiding the overload of a single server, and thus significantly improving the overall performance and throughput of the system. In this scenario, to ensure that each instance or container can access physical files, special attention needs to be paid to the persistence problem of physical files.

[0003] Currently, in order to avoid the loss of physical files for containerized applications after restarting the service, the following methods are adopted: 1. Use a data volume (Volume) or other persistent storage mechanisms to mount the data directory inside the container to the file system of the host machine. 2. In Kubernetes, PersistentVolume (PV) and PersistentVolumeClaim (PVC) can be used to manage persistent storage to ensure that data will not be lost even after a Pod is restarted or deleted. 3. For Docker containers, a data volume (Volume) or a data volume container (Data Volume Container) can be used to persist data.

[0004] Although these solutions can persist physical files, they usually have the following defects: 1. Data is saved in the writable layer of the container: By default, the data of a Docker container is saved in the writable layer of the container. When the container is deleted, this writable layer will also be deleted, resulting in data loss. 2. Data volumes are not used: If a data volume is not used to mount the data directory inside the container to the file system of the host machine during container deployment, then after the container is restarted, the data inside it will be lost. 3. For Docker containers, if only the container is restarted (rather than a Pod or the entire Docker daemon process), and a data volume or a similar mechanism is used to persist data, then the data usually will not be lost. But if these mechanisms are not used, the data will be lost. 4. The configuration is complex and requires relatively complex configuration on Docker or Kubernetes containers. Summary of the Invention

[0005] The purpose of the embodiments of the present invention is to provide a method, system, device and medium for generating HTML pages, which are used to solve all or at least part of the problem of physical file loss after restarting the service in the containerized deployment scenario, or the technical problem that no physical file is generated when the access request to the html is first forwarded to a new server in the load balancing scenario, existing in the above-mentioned prior art.

[0006] In the first aspect, an embodiment of the present application provides a method for generating an HTML page, including: A data storage process and a page generation process, wherein the data storage process includes: The backend program reads file data according to the path and name of the physical file. For binary files, they are read as byte arrays; Connect to the database; Create an SQL statement for inserting data and execute the SQL statement. Executing the SQL statement includes first judging whether there is data of the physical file in the database. If not, insert the file data. If so, perform an operation to update the data; Among them, during the entire data storage process, a try-catch block is used to handle the occurring exception situations; Among them, the page generation process includes: Read the data of the physical file saved in the database and generate the corresponding physical file according to the actual application scenario. The application scenario includes the scenario where the physical file is lost when restarting the service in the containerized deployment scenario, and the scenario where there is no physical file on the server when the load balancer forwards the request to a new server.

[0007] Optionally, reading the data of the physical file saved in the database and generating the corresponding physical file includes: Establish a database connection and write a query statement to obtain the file stream data from the database by executing the query statement. The database connection library is used to establish a connection with the database; Preview the current page and judge whether the physical page exists on the server requested by the client. If not, create a page folder according to the file path and file name to generate an HTML page, and write the file stream data obtained from the database into the file output stream; if it exists, judge whether the last operation time of the page is the same as the page time saved in the database. If it is the same, preview the HTML page on the server; if not, delete the original HTML page, generate a new HTML page and write the file stream data.

[0008] Optionally, when previewing the current page, first pass through an interceptor to judge whether the URL of the HTML page to be accessed conforms to a preset specification.

[0009] Optionally, the process of establishing a database connection includes: Loading the database driver to be connected and constructing a database connection URL; Calling the DriverManager.getConnection() function to establish a database connection, and after using the database connection, closing the connection to release resources.

[0010] Optionally, during the process of connecting to the database in the data storage process, it is necessary to ensure that the database URL format is correct, which at least includes the protocol, host name, port number, and database name.

[0011] Optionally, after inserting the file data into the database, encrypt the file data, and the encryption process includes: Chunking the file according to the file type and data content characteristics, and inserting random-length metadata markers; Obtaining the current system timestamp and extracting the millisecond and microsecond parts, as well as obtaining the server hardware fingerprint, and splicing the millisecond part of the timestamp with the server hardware fingerprint to obtain a spliced string; Using the HMAC-SHA3 algorithm to perform a hash operation on the spliced string to generate a first-dimensional key; Obtaining the user's biometric data, generating a random salt value, and using the scrypt algorithm to combine the biometric hash value with the random salt value to generate a second-dimensional key; Obtaining the database shard ID and the geographical location information of the server, and splicing the database shard ID with the geographical location hash value; Using the Argon2 algorithm to perform a hash operation on the spliced string to generate a third-dimensional key; Obtaining the memory state of historical encryption operations and using the Keccak algorithm to perform a hash operation on the memory state to generate a fourth-dimensional key; Combining the generated first-dimensional key, second-dimensional key, third-dimensional key, and fourth-dimensional key in sequence into a mixed key matrix; Using the keys in the mixed key matrix to encrypt each data block, reordering the encrypted data blocks according to the Hilbert curve, and inserting pseudo data blocks for data block reorganization to form a target encrypted data stream.

[0012] Optionally, after obtaining the target encrypted data stream, the method for generating the HTML page further includes: Using the Shamir secret sharing scheme to divide the key of each dimension into multiple key shards, and storing the multiple key shards in different locations; During decryption, key shards are collected from different storage locations, and the hybrid key matrix is restored using the Shamir secret sharing scheme; Remove the pseudo-data blocks in the target encrypted data stream and restore the order of the encrypted data blocks in reverse order according to the Hilbert curve; Use the multi-dimensional keys in the hybrid key matrix to decrypt block by block, and recombine the decrypted data blocks into the original file.

[0013] In a second aspect, an embodiment of the present application further provides a system for generating an HTML page, including: A data storage module for reading file data according to the path and name of a physical file through a backend program, where, for a binary file, it is read as a byte array; connecting to a database; and creating an SQL statement for inserting data and executing the SQL statement, where executing the SQL statement includes first determining whether there is data of the physical file in the database, if not, inserting the file data, and if so, performing an operation to update the data; where, during the entire data storage process, a try-catch block is used to handle the exceptions that occur; A page generation module for reading the data of the physical file saved in the database and generating a corresponding physical file according to the actual application scenario, where the application scenario includes a scenario where the physical file is lost when restarting the service in a containerized deployment scenario, and a scenario where the physical file does not exist on the server when the load balancer forwards a request to a new server.

[0014] In a third aspect, an embodiment of the present application further provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the program, the steps of the above-mentioned method for generating an HTML page are implemented.

[0015] In a fourth aspect, an embodiment of the present application further provides a storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned method for generating an HTML page are implemented.

[0016] From the above technical solutions, it can be seen that the present invention has the following advantages: In the method, system, device, and medium for generating an HTML page provided by the present application, in a containerized deployment scenario and a load balancing scenario, there is no need to manually save the generated physical file or perform other complex configurations to save the physical file. After restarting the service in the containerized deployment scenario, or when the request is first forwarded to a new server in the load balancing scenario, the corresponding physical file can be quickly generated, improving the response speed and user experience of the data visualization system. Description of the Drawings

[0017] To more clearly illustrate the technical solution of the present invention, the accompanying drawings required in the description will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.

[0018] Figure 1 It is a flowchart of a method for generating an HTML page provided by an embodiment of the present invention; Figure 2 It is a data storage flowchart provided by an embodiment of the present invention; Figure 3 It is a flowchart for generating a page provided by an embodiment of the present invention; Figure 4 It is an encryption process of file data provided by an embodiment of the present invention; Figure 5 It is a decryption process of file data provided by an embodiment of the present invention; Figure 6 It is a schematic structural diagram of a system for generating an HTML page provided by an embodiment of the present invention; Figure 7 It is a schematic hardware structure diagram of an electronic device provided by an embodiment of the present invention. Detailed implementation manners

[0019] In the following detailed description, various embodiments of the present disclosure will be described more fully. The present disclosure may have various embodiments and adjustments and changes can be made therein. However, it should be understood that there is no intention to limit the various embodiments of the present disclosure to the specific embodiments disclosed herein, but the present disclosure should be understood to cover all adjustments, equivalents, and / or alternative solutions falling within the spirit and scope of the various embodiments of the present disclosure.

[0020] In the following, the term "comprise" or "may comprise" that may be used in various embodiments of the present disclosure indicates the presence of the disclosed function or operation, and does not limit the addition of one or more functions or operations. In addition, as used in various embodiments of the present disclosure, the terms "comprise", "have" and their cognates are only intended to indicate a specific feature, number, step, operation or combination of the foregoing items, and should not be construed as precluding the existence or addition of one or more other features, numbers, steps, operations or combinations of the foregoing items.

[0021] In various embodiments of the present disclosure, the expression "or" or "at least one of A or / and B" includes any combination or all combinations of the listed words. For example, the expression "A or B" or "at least one of A or / and B" may include A, may include B, or may include both A and B.

[0022] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0023] Refer to Figure 1 The figure shows a flowchart of a method for generating an HTML page in a specific embodiment, including the following execution steps: Step 100: Data storage process.

[0024] Specifically, when executing step 100, the following steps can be specifically executed: S1000: The backend program reads the file data according to the path and name of the physical file. Among them, for binary files, they are read as byte arrays.

[0025] S1001: Connect to the database.

[0026] It should be noted that during the process of connecting to the database in the data storage process, it is necessary to ensure that the database URL format is correct, which at least includes the protocol, host name, port number, and database name.

[0027] S1002: Create an SQL statement for inserting data and execute the SQL statement. Among them, executing the SQL statement includes first judging whether the data of the physical file exists in the database. If it does not exist, the file data is inserted. If it exists, the data is updated.

[0028] Among them, during the entire data storage process, a try-catch block is used to handle the exceptions that occur; In a specific embodiment, refer to Figure 2 The figure shows a data storage flowchart provided by the embodiment of the present invention, whose main function is to save the data of the html physical file generated when saving the page into the database, including the following steps: 1. The backend program reads the data of the file according to the path and name of the file. For binary files, they are usually read as byte arrays.

[0029] 2. Connect to the database. Use technologies such as JDBC (Java Database Connectivity) or JPA (Java Persistence API) to connect to the database and create a database connection object. During the connection process, ensure that the database URL format is correct, including the protocol (such as jdbc:mysql), hostname, port number (if non-default), database name, etc. The port number is usually an integer and is used to specify the port that the database server listens on. For example, the default port for MySQL is 3306, and the default port for PostgreSQL is 5432. If the database server uses a non-default port, it needs to be specified explicitly in the URL.

[0030] 3. Create or prepare SQL statements. Prepare the basic information of the page, including: page path, name, last modification time, physical file data, etc., and create an SQL statement for inserting data. For binary data, specific data types (such as BLOB) need to be used for storage, and for text data, data types such as VARCHAR, TEXT, etc. can be used.

[0031] 4. Execute the SQL statement: First, check if there is data for the physical file in the database. If not, insert the data; if there is data, perform an operation to update the data. 5. Handle possible exceptions: Throughout the process, try-catch blocks should be used to handle possible exceptions (such as file not found, etc.); For example: try { / / 1. Read the file content into the input stream / / 2. Execute the insert operation } catch (FileNotFoundException e) { System.err.println("File not found exception: " + e.getMessage()); } catch (SQLException e) { System.err.println("SQL exception: " + e.getMessage()); } catch (IOException e) { System.err.println("IO exception: " + e.getMessage()); }.

[0032] Step 101: Page generation process.

[0033] Specifically, when performing step 101, the following steps can be specifically executed: S1010: Read the data of the physical file saved in the database, and generate a corresponding physical file according to the actual application scenario, where the application scenario includes the scenario where the physical file is lost when restarting the service in the containerized deployment scenario, and the scenario where the physical file does not exist on the server when the load balancer forwards the request to a new server.

[0034] Specifically, when performing step S1010, the following problems can be specifically executed: S1: Establish a database connection, and write a query statement to obtain file stream data from the database by executing the query statement, where a database connection library is used to establish a connection with the database; Exemplarily, the process of establishing a database connection includes: loading the database driver to be connected, and constructing a database connection URL; calling the DriverManager.getConnection() function to establish a database connection, and after using the database connection, closing the connection to release resources.

[0035] S2: Preview the current page, and determine whether the physical page exists on the server requested by the client. If not, create a page folder according to the file path and file name to generate an HTML page, and write the file stream data obtained from the database into the file output stream; if it exists, determine whether the last operation time of the page is the same as the page time saved in the database. If they are the same, preview the HTML page on the server; if they are different, delete the original HTML page, generate a new HTML page and write the file stream data.

[0036] It should be noted that when previewing the current page, an interceptor is pre - passed to determine whether the URL of the HTML page to be accessed conforms to the preset specification.

[0037] In a specific embodiment, refer to Figure 3 As shown, it is a flowchart for generating a page provided by an embodiment of the present invention. Its main function is to read the data of the physical file saved in the database, generate a corresponding physical file according to the actual application scenario, and meet the scenario where the physical file is lost when restarting the service in the containerized deployment scenario, and the scenario where the physical file does not exist on the server when the load balancer forwards the request to a new server. It includes the following steps: 1. Establish a database connection: Use a database connection library (such as JDBC, etc.) to establish a connection with the database.

[0038] 1.1 Load the database driver: Different databases have different driver class names. For example, for MySQL: com.mysql.cj.jdbc.Driver.

[0039] 1.2 Establish a database connection: Use the DriverManager.getConnection() method to establish a database connection.

[0040] 1.3 Close the connection: After using the database connection, the connection must be closed to release resources.

[0041] 2. Write a query statement: Write an SQL query statement as needed to retrieve file stream data from the database.

[0042] 3. Execute the query and obtain the file stream: Execute the SQL query statement to obtain file stream data from the database. File stream data is usually stored in a field of the BLOB (Binary Large Object) type. For example: The BLOB exists in the filecontent field. Use the SQL statement to obtain the filecontent value, and then define a byte array to store the file stream in this byte array, byte fileByte [] = fileDataList.getFileContent().

[0043] 4. Generate a physical file: When previewing an html page, first pass through an interceptor to determine whether the URL of the html page to be accessed conforms to the project specifications. For example: Whether the URL starts with / apps / ** / ** / pages and ends with.html. The second step is to determine whether the physical file (physical page) exists on the server requested by the client. Method: Obtain the path and name of the physical file from the database, and the backend program determines whether the file exists on the server according to the file path, that is: Files.exists(filePath). If it does not exist, create a physical file (create a page folder) according to the file path and name, and write the data in the BLOB object to the file output stream. If the file exists, the backend program determines whether the last operation time of the file is the same as the time when the file is saved in the database. If they are the same, directly read the physical file on the server (that is, preview the Html page on the server). If they are not the same, first delete the file on the server (that is, delete the old html page), then create a new file (new html page) to process the file stream data, and write data to the html.

[0044] 5. Close the resources: After completing the file writing, close the file output stream.

[0045] In some embodiments, refer to Figure 4 As shown, after inserting the file data into the database, encrypt the file data. The encryption process includes: S400: Chunk the file according to the file type and data content characteristics, and insert metadata tags with random lengths.

[0046] Exemplarily, automatically adjust the chunk size according to the file type and content characteristics (e.g., 256 - 1024 bytes) and insert metadata tags with random lengths (such as: <RAND:8|32> represents 8 - 32 random characters).

[0047] By chunking and inserting metadata tags with random lengths, the complexity of the data can be increased, making it difficult for unauthorized users to identify and extract useful information. The metadata tags can contain verification information (such as hash values) for detecting whether the data has been tampered with during transmission or storage. Chunking enables parallel transmission or storage of the data, thereby improving the overall efficiency. Moreover, according to the size and type of the data chunks, storage or transmission resources can be more effectively allocated to avoid overloading of certain parts. Through intelligent chunking, redundant parts in the data can be identified and removed, saving storage space.

[0048] S401: Obtain the current system timestamp and extract the millisecond and microsecond parts, and obtain the server hardware fingerprint, and splice the millisecond part of the timestamp with the server hardware fingerprint to obtain the spliced string.

[0049] Exemplarily, obtain the current system timestamp and extract the millisecond and microsecond parts (e.g., 4567 in 1638271234567). Obtain the server hardware fingerprint (such as CPU serial number, motherboard UUID, etc.). Splice the millisecond part of the timestamp with the hardware fingerprint.

[0050] The spliced string combines the millisecond part of the timestamp and the server hardware fingerprint, and has a high degree of uniqueness. Even at different times or on different servers, it is very difficult to generate the same spliced string. Moreover, by introducing the server hardware fingerprint, the difficulty for attackers to forge or tamper with the spliced string is increased, so the security of the spliced string is enhanced. Furthermore, since the spliced string contains time information and hardware information, it is convenient for tracing and positioning when problems occur in the system. For example, in log records, the time point when the problem occurred and the relevant server hardware information can be quickly found through the spliced string, thereby accelerating the problem-solving process.

[0051] S402: Use the HMAC - SHA3 algorithm to perform a hash operation on the spliced string to generate the first - dimension key.

[0052] It should be understood that the first - dimension key is a dynamic key based on the timestamp and the hardware fingerprint.

[0053] S403: Obtain the user's biometric data, generate a random salt value, and use the scrypt algorithm to combine the biometric hash value with the random salt value to generate a second-dimensional key.

[0054] Exemplarily, user biometric hash = "fingerprint_hash_abc123"; random salt value = "random_salt_xyz789"; second-dimensional key = scrypt(user biometric hash, random salt value), that is, a strong hash key based on the user's biometric and random salt value.

[0055] S404: Obtain the database shard ID and the geographical location information of the server, and splice the database shard ID with the geographical location hash value.

[0056] S405: Use the Argon2 algorithm to perform a hash operation on the spliced string to generate a third-dimensional key.

[0057] Exemplarily, database shard ID = "shard_001"; geographical location hash = "location_hash_987654"; spliced string = database shard ID + geographical location hash; third-dimensional key = Argon2(spliced string), that is, a context key based on the database shard and geographical location.

[0058] S406: Obtain the memory state of the historical encryption operation, and use the Keccak algorithm to perform a hash operation on the memory state to generate a fourth-dimensional key.

[0059] Exemplarily, the last encrypted memory state = "memory_state_xyz456"; fourth-dimensional key = Keccak(last encrypted memory state), that is, an environmental key based on the memory state of the last encryption operation.

[0060] S407: Combine the generated first-dimensional key, second-dimensional key, third-dimensional key, and fourth-dimensional key in sequence to form a mixed key matrix.

[0061] S408: Use the keys in the mixed key matrix to encrypt each data block, reorder the encrypted data blocks according to the Hilbert curve, and insert pseudo data blocks for data block reorganization to form a target encrypted data stream.

[0062] Through this multi-dimensional key generation method, the key matrix not only has a high degree of randomness and dynamics, but also can effectively resist various attack means (such as brute force cracking, side-channel attacks, etc.). At the same time, the key generation of each dimension depends on different input sources, further enhancing security.

[0063] In some embodiments, as shown in Figure 5 After obtaining the target encrypted data stream, the following steps are further performed: S500: Use the Shamir secret sharing scheme to divide the key of each dimension into multiple key shards, set a recovery threshold, and store the multiple key shards in different locations.

[0064] Exemplarily, for example, divide the key of each dimension into 15 shards, where 5 shards are stored in the main database, 5 shards are stored in the blockchain, and the remaining shards are stored in the hardware security module. The recovery threshold is set to 9 shards, that is, at least 9 shards are required to recover the key.

[0065] Through the processing of S500, risks can be dispersed. After the key is stored in shards, even if an attacker obtains some shards, if the threshold value is not reached, the complete key cannot be recovered. Moreover, even if a certain storage location is breached, the attacker cannot obtain enough shards to recover the key. Even if some shards are lost or damaged, as long as the remaining shards reach the threshold value, the key can still be recovered. Storing the shards in different locations (such as databases, blockchains, hardware security modules) ensures the robustness of key management.

[0066] S501: During decryption, collect the key shards from different storage locations and use the Shamir secret sharing scheme to recover the mixed key matrix.

[0067] S502: Remove the pseudo data blocks in the target encrypted data stream and restore the order of the encrypted data blocks in reverse order according to the Hilbert curve.

[0068] S503: Decrypt each block using the multi-dimensional keys in the mixed key matrix and recombine the decrypted data blocks into the original file.

[0069] Exemplarily, # Recover the key matrix recovered_shares = collect_shares_from_storage() key_matrix = shamir_recover(recovered_shares) # Decrypt the data blocks decrypted_chunks = [] for index, chunk in encrypted_chunks: algo_index = (key_matrix[0][index % 4]^ key_matrix[3][-1]) % 4 algorithm = algorithms[algo_index] nonce = HKDF(key_matrix[2], str(index)) cipher = algorithm(key=key_matrix[index % 4][:key_length], nonce=nonce) decrypted_chunk = cipher.decrypt(chunk) decrypted_chunks.append(decrypted_chunk) # Recombine the original data original_data = b"".join(decrypted_chunks)。

[0070] In this embodiment, in the containerized deployment scenario and the load balancing scenario, there is no need to manually save the generated physical files or perform other complex configurations to save physical files. After restarting the service in the containerized deployment scenario, or when the request is first forwarded to a new server in the load balancing scenario, the corresponding physical files can be quickly generated, improving the response speed and user experience of the data visualization system.

[0071] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution is prior or posterior. The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.

[0072] As Figure 6 shown, the following is an embodiment of the HTML page generation system provided by the embodiments of the present disclosure. It belongs to the same inventive concept as the HTML page generation method of the above embodiments. For the details not described in detail in the embodiment of the HTML page generation system, reference can be made to the embodiments of the above HTML page generation method.

[0073] The HTML page generation system includes: A data storage module, configured to read file data according to the path and name of the physical file through a backend program, where, for binary files, they are read as byte arrays; connect to the database; and create an SQL statement for inserting data and execute the SQL statement. Executing the SQL statement includes first determining whether there is data of the physical file in the database. If not, insert the file data. If so, perform an operation to update the data. During the entire data storage process, a try-catch block is used to handle the exceptions that occur; A page generation module, configured to read data of physical files saved in a database and generate corresponding physical files according to actual application scenarios, where the application scenarios include scenarios where physical files are lost when restarting services in a containerized deployment scenario, and scenarios where physical files do not exist on a server when a load balancer forwards requests to a new server.

[0074] Figure 7 It is a schematic hardware structure diagram of an electronic device for implementing various embodiments of the present invention.

[0075] The method for generating an HTML page provided by an embodiment of the present application can be applied to an electronic device. Those skilled in the art can understand that the structure of the electronic device involved in the embodiments of the present invention does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements. In the embodiments of the present invention, the electronic device includes, but is not limited to, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown in the figure, their connections and relationships, and their functions are only examples and are not intended to limit the implementation of the embodiments of the present application described and / or claimed herein.

[0076] The electronic device may include a processor, an external memory interface, an internal memory, a universal serial bus (USB) interface, a charging management module, a power management module, a battery, a wireless communication module, an audio module, a speaker, a microphone, a sensor module, a key, a camera, a display screen, and a SIM card interface, etc.

[0077] It can be understood that the structure schematically shown in the embodiments of the present application does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than those shown in the figure, or combine certain components, or split certain components, or have different component arrangements. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0078] The processor may include one or more processing units. For example, the processor may include a central processing unit (CPU), an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.

[0079] Among them, the processor may be the nerve center and command center of the electronic device. The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of fetching and executing instructions.

[0080] A memory may also be provided in the processor for storing instructions and data. In some embodiments, the memory in the processor is a cache memory. This memory can store the instructions or data that the processor has just used or recycled. If the processor needs to use the instruction or data again, it can directly call it from this memory. This avoids repeated accesses, reduces the waiting time of the processor, and thus improves the system efficiency.

[0081] The external memory interface can be used to connect an external memory card, such as a MicroSD card, to expand the storage capacity of the electronic device. The external memory card communicates with the processor through the external memory interface to implement the data storage function. For example, files such as music and videos are saved in the external memory card.

[0082] The internal memory can be used to store computer-executable program code, and the computer-executable program code includes instructions. The processor executes various functional applications and data processing of the electronic device by running the instructions stored in the internal memory. The internal memory may include a program storage area and a data storage area. The internal memory may include a high-speed random access memory and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0083] The wireless communication function of the electronic device can be implemented through an antenna, a wireless communication module, a modem processor, a baseband processor, etc.

[0084] The wireless communication module can provide solutions for wireless communications applied to electronic devices, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite systems (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc.

[0085] The electronic device can implement audio functions through an audio module, speakers, receivers, microphones, headphone jacks, and application processors, etc.

[0086] The electronic device can implement shooting functions through an ISP, camera, video codec, GPU, display screen, and application processor, etc.

[0087] The electronic device can implement display functions through a GPU, display screen, and application processor, etc.

[0088] The GPU is a microprocessor for image processing, connecting the display screen and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor may include one or more GPUs that execute program instructions to generate or change display information.

[0089] The display screen is used to display images, videos, etc. The display screen includes a display panel.

[0090] In the storage medium provided in this application, there is a program product capable of implementing the method for generating an HTML page.

[0091] The method for generating an HTML page includes: a data storage process and a page generation process. Among them, the data storage process includes: the backend program reads file data according to the path and name of the physical file. Among them, for binary files, they are read as byte arrays; connect to the database; create an SQL statement for inserting data and execute the SQL statement. Among them, executing the SQL statement includes first judging whether there is data of the physical file in the database. If not, insert the file data. If so, perform an operation to update the data. Among them, during the entire data storage process, a try-catch block is used to handle the exceptions that occur. Among them, the page generation process includes: reading the data of the physical file saved in the database and generating the corresponding physical file according to the actual application scenario. Among them, the application scenario includes the scenario where the physical file is lost when restarting the service in the containerized deployment scenario, and the scenario where there is no physical file on the server when the load balancer forwards the request to a new server.

[0092] In some possible implementation manners, the subject name of the present disclosure, the method and system for generating an HTML page, can be implemented in the form of a program product, which includes program code. When the program product runs on a terminal device, the program code is used to cause the terminal device to execute the steps according to various exemplary embodiments of the present disclosure described in the above "Exemplary Method" section of this specification.

[0093] The storage medium of the present disclosure can adopt any combination of one or more readable media. The readable media can be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0094] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for generating an HTML page, characterized in that, Including: A data storage process and a page generation process. Among them, the data storage process includes: The backend program reads the file data according to the path and name of the physical file. For binary files, they are read as byte arrays; Connect to the database; Create an SQL statement for inserting data and execute the SQL statement. Among them, executing the SQL statement includes first judging whether the data of the physical file exists in the database. If not, insert the file data. If it exists, perform an operation to update the data; Among them, during the entire data storage process, a try-catch block is used to handle the occurring exception situations; Among them, the page generation process includes: Read the data of the physical file saved in the database and generate the corresponding physical file according to the actual application scenarios. Among them, the application scenarios include the scenario where the physical file is lost when restarting the service in the containerized deployment scenario, and the scenario where the physical file does not exist on the server when the load balancer forwards the request to a new server.

2. The method for generating an HTML page according to claim 1, wherein Reading the data of the physical file saved in the database and generating the corresponding physical file includes: Establish a database connection and write a query statement to obtain the file stream data from the database by executing the query statement. Among them, a database connection library is used to establish a connection with the database; Preview the current page and judge whether the physical page requested by the client exists on the server. If not, create a page folder according to the file path and file name to generate an HTML page, and write the file stream data obtained from the database into the file output stream. If it exists, judge whether the last operation time of the page is the same as the page time saved in the database. If they are the same, preview the HTML page on the server. If they are not the same, delete the original HTML page, generate a new HTML page and write the file stream data.

3. The method for generating an HTML page according to claim 2, wherein, When previewing the current page, first pass through an interceptor to judge whether the URL of the HTML page to be accessed conforms to the preset specification.

4. The method for generating an HTML page according to claim 2, wherein The process of establishing a database connection includes: Load the database driver to be connected and construct the database connection URL; Call the DriverManager.getConnection() function to establish a database connection, and after using the database connection, close the connection to release resources.

5. The method for generating an HTML page according to claim 1, wherein During the process of connecting to the database in the data storage process, it is necessary to ensure that the database URL format is correct, which at least includes the protocol, host name, port number, and database name.

6. The method for generating an HTML page according to claim 1, wherein After inserting the file data into the database, encrypt the file data. The encryption process includes: Chunk the file according to the file type and data content characteristics and insert random-length metadata markers; Obtain the current system timestamp and extract the millisecond and microsecond parts, and obtain the server hardware fingerprint, and splice the millisecond part of the timestamp with the server hardware fingerprint to obtain the spliced string; Use the HMAC-SHA3 algorithm to perform a hash operation on the spliced string to generate the first-dimensional key; Obtain the user's biometric data, generate a random salt value, and use the scrypt algorithm to combine the biometric hash value with the random salt value to generate a second-dimensional key; Obtain the database shard ID and the geographical location information of the server, and splice the database shard ID with the geographical location hash value; Use the Argon2 algorithm to perform a hash operation on the spliced string to generate a third-dimensional key; Obtain the memory state of the historical encryption operation, and use the Keccak algorithm to perform a hash operation on the memory state to generate a fourth-dimensional key; Combine the generated first-dimensional key, second-dimensional key, third-dimensional key, and fourth-dimensional key in sequence to form a mixed key matrix; Use the keys in the mixed key matrix to encrypt each data block, reorder the encrypted data blocks according to the Hilbert curve, and insert pseudo data blocks for data block reorganization to form a target encrypted data stream.

7. The method for generating an HTML page according to claim 6, wherein After obtaining the target encrypted data stream, the method for generating the HTML page further includes: Use the Shamir secret sharing scheme to divide the key of each dimension into multiple key shards, set a recovery threshold, and store the multiple key shards in different locations; During decryption, collect the key shards from different storage locations and use the Shamir secret sharing scheme to recover the mixed key matrix; Remove the pseudo data blocks in the target encrypted data stream and restore the order of the encrypted data blocks in reverse order according to the Hilbert curve; Use the multi-dimensional keys in the mixed key matrix to decrypt block by block and recombine the decrypted data blocks into the original file.

8. A system for generating an HTML page, characterized in that, Includes: A data storage module, which is used to read file data according to the path and name of the physical file through a backend program. Among them, for binary files, they are read as byte arrays; connect to the database; and create an SQL statement for inserting data and execute the SQL statement. Executing the SQL statement includes first judging whether there is data of the physical file in the database. If not, insert the file data. If so, perform an update data operation; among them, during the entire data storage process, a try-catch block is used to handle the exceptions that occur; A page generation module, which is used to read the data of the physical file saved in the database and generate the corresponding physical file according to the actual application scenario. Among them, the application scenario includes the scenario where the physical file is lost when restarting the service in the containerized deployment scenario, and the scenario where the physical file does not exist on the server when the load balancer forwards the request to a new server.

9. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein, When the processor executes the program, it implements the steps of the method for generating the HTML page according to any one of claims 1 to 7.

10. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method for generating the HTML page according to any one of claims 1 to 7.