A method and system for loading page resources
By pre-parsing and storing the rule configuration files and parameter loading files of target resources, business logic control of all fields in the web page is solved, and the problems of incomplete business logic control and low accuracy in the existing technology are solved, and the accuracy of business logic control is improved.
Patent Information
- Application Number
- CN202111295187.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-03
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2041-11-03
AI Technical Summary
The prior art cannot realize business logic control of all fields in web pages, resulting in poor accuracy of business logic control.
The verification rules are obtained by pre-parsing the rule configuration file corresponding to the target resource and stored in the cache. When the page requests the target resource, it obtains the verification rules contained in the data entity corresponding to the target resource from the cache, and obtains the parameter set corresponding to each data entity from the cache or using the parameter loading file, and verifies the parameter set corresponding to the data entity according to the verification rules contained in the data entity. If all verification results are passed, the target resource will be fed back to the page for loading and display.
It realizes complete business logic control of all fields in the web page, and improves the accuracy of business logic control.
Smart Images

Figure CN114003844B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a method and system for loading page resources. Background Art
[0002] When a user accesses a specified resource (such as a button or hyperlink) through a web page, it is necessary to determine whether the user can access the specified resource under a specific business stage and business status, that is, to perform business logic control on the specified resource.
[0003] At present, the way to perform business logic control on the designated resources accessed by users is to use page scripts to perform business logic control on the fields on the web page. However, this method can only perform business logic control on the fields on the web page, but cannot perform business logic control on the fields not included in the web page, and cannot achieve complete business logic control, which leads to poor accuracy of business logic control. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a method and system for loading page resources to solve the problems existing in the existing business logic control method, such as the inability to achieve complete business logic control and poor accuracy.
[0005] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:
[0006] A first aspect of an embodiment of the present invention discloses a method for loading a page resource, the method comprising:
[0007] When receiving an instruction sent by a page for requesting a target resource, obtaining from a cache the verification rules contained in a data entity corresponding to the target resource, wherein the verification rules are obtained by parsing a preset rule configuration file and are pre-stored in the cache, and each of the data entities contains at least one of the verification rules;
[0008] Obtaining a parameter set corresponding to each of the data entities, wherein the parameter set is obtained from the cache or from a database based on a preset parameter loading file;
[0009] For each of the data entities, using the verification rule contained in the data entity, verify the parameter set corresponding to the data entity to obtain a verification result;
[0010] If all the verification results indicate that the verification is passed, the target resource is fed back to the page, so that the page loads and displays the target resource.
[0011] Preferably, when receiving the instruction sent by the page for requesting the target resource, obtaining the verification rule contained in the data entity corresponding to the target resource from the cache includes:
[0012] When receiving the instruction for requesting the target resource sent by the page, the uniform resource locator URL of the target resource is used to obtain the verification rules contained in the data entity corresponding to the target resource from the cache.
[0013] Preferably, the process of parsing a preset rule configuration file to obtain the verification rule and storing it in the cache includes:
[0014] Parsing a preset rule configuration file corresponding to a target resource, obtaining a data entity corresponding to the target resource, and obtaining a verification rule contained in the data entity;
[0015] The verification rules obtained by parsing the rule configuration file are stored in a cache.
[0016] Preferably, the obtaining of a parameter set corresponding to each of the data entities includes:
[0017] For each of the data entities, determining whether a parameter set corresponding to the data entity exists in the cache;
[0018] If it exists, obtaining a parameter set corresponding to the data entity from the cache;
[0019] If it does not exist, based on a preset parameter loading file corresponding to the data entity, the parameter set corresponding to the data entity is obtained from the database and stored in the cache, and the parameter loading file is used to define the specific content and acquisition method of the parameter set corresponding to the data entity.
[0020] Preferably, the verification rule is a parameter verification rule or a script verification rule.
[0021] Preferably, the parameter set includes page parameters and / or database parameters.
[0022] Preferably, for each of the data entities, when the type of the data entity is a script verification entity, the script verification entity includes a script verification rule.
[0023] Preferably, for each of the data entities, using the verification rule contained in the data entity to verify the parameter set corresponding to the data entity to obtain a verification result includes:
[0024] For each of the data entities, if the verification rule contained in the data entity is a parameter verification rule, the first specified parameter in the parameter set corresponding to the data entity is verified in combination with the parameter verification rule and a regular expression to obtain a verification result, where the first specified parameter is a parameter specified by the parameter verification rule;
[0025] If the verification rule contained in the data entity is a script verification rule, the second specified parameter in the parameter set corresponding to the data entity is verified in combination with the script verification rule and the corresponding preset script execution program to obtain a verification result, and the second specified parameter is one or more parameters specified by the script verification rule.
[0026] A second aspect of an embodiment of the present invention discloses a system for loading page resources, the system comprising:
[0027] A first acquisition unit is used to acquire, from a cache, a verification rule contained in a data entity corresponding to the target resource when receiving an instruction sent by a page for requesting the target resource, wherein the verification rule is obtained by parsing a preset rule configuration file and is pre-stored in the cache, and each of the data entities contains at least one of the verification rules;
[0028] A second acquisition unit, configured to acquire a parameter set corresponding to each of the data entities, wherein the parameter set is acquired from the cache or from a database based on a preset parameter loading file;
[0029] A verification unit, configured to verify, for each of the data entities, the parameter set corresponding to the data entity using the verification rule contained in the data entity to obtain a verification result;
[0030] A feedback unit is used to feed back the target resource to the page if all the verification results indicate that the verification is passed, so that the page loads and displays the target resource.
[0031] Preferably, the first acquisition unit is specifically used for: upon receiving an instruction sent by a page for requesting a target resource, using a uniform resource locator URL of the target resource to acquire from a cache the verification rules contained in a data entity corresponding to the target resource.
[0032] A method and system for loading page resources based on the above-mentioned embodiment of the present invention is provided. The method is as follows: when receiving an instruction sent by a page for requesting a target resource, obtaining the verification rules contained in the data entity corresponding to the target resource from the cache; obtaining the parameter set corresponding to each data entity; for each data entity, using the verification rules contained in the data entity, verifying the parameter set corresponding to the data entity to obtain a verification result; if all verification results indicate that the verification is passed, feeding back the target resource to the page, so that the page loads and displays the target resource. In this scheme, the rule configuration file corresponding to the target resource is pre-parsed to obtain the verification rules and stored in the cache. When the page requests the target resource, the verification rules contained in the data entity corresponding to the target resource are obtained from the cache, and the parameter set corresponding to each data entity is obtained from the cache or by using the parameter loading file. The parameter set corresponding to the data entity is verified according to the verification rules contained in the data entity to obtain a verification result. When all verification results indicate that the verification is passed, the target resource is fed back to the page for loading and display. By pre-setting the rule configuration file and the parameter loading file, all parameter fields that need to be controlled by business logic are defined, and complete business logic control is achieved and the accuracy of business logic control is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0034] Figure 1 A flow chart of a method for loading page resources provided by an embodiment of the present invention;
[0035] Figure 2 A tree diagram of verification rules obtained by parsing a rule configuration file provided in an embodiment of the present invention;
[0036] Figure 3 A flow chart of verifying a parameter set of each data entity provided by an embodiment of the present invention;
[0037] Figure 4 A structural block diagram of a page resource loading system provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0038] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0039] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.
[0040] It should be noted that the method and system for loading page resources provided by the present invention can be used in the field of mobile Internet. The above is only an example and does not limit the application field of the method and system for loading page resources provided by the present invention.
[0041] As can be seen from the background technology, currently, the business logic control of the fields on the web page is usually performed using a page script program. However, this method can only perform business logic control on the fields on the web page, and cannot perform business logic control on the fields not included in the web page, and cannot achieve complete business logic control, which leads to poor accuracy of business logic control.
[0042] Therefore, an embodiment of the present invention provides a method and system for loading page resources, which pre-parses a rule configuration file corresponding to a target resource to obtain verification rules and stores them in a cache. When a page requests a target resource, the verification rules contained in the data entity corresponding to the target resource are obtained from the cache, and the parameter set corresponding to each data entity is obtained from the cache or by using a parameter loading file. The parameter set corresponding to the data entity is verified according to the verification rules contained in the data entity to obtain a verification result. When all verification results indicate that the verification is passed, the target resource is fed back to the page for loading and display. By pre-setting a rule configuration file and a parameter loading file, all parameter fields that require business logic control are defined to achieve complete business logic control and improve the accuracy of business logic control.
[0043] It should be noted that the page resource loading method mentioned in the embodiment of the present invention can be used to load resources such as buttons and hyperlinks.
[0044] See also Figure 1, shows a flow chart of a method for loading page resources provided by an embodiment of the present invention, the loading method comprising:
[0045] Step S101: when receiving an instruction sent by a page for requesting a target resource, obtaining a verification rule included in a data entity corresponding to the target resource from a cache.
[0046] It should be noted that for all resources that need to be controlled by business logic (such as buttons), a corresponding rule configuration file is pre-configured for each resource that needs to be controlled by business logic, and a corresponding relationship between the uniform resource locator (URL) of the resource and the rule configuration file is constructed. That is, for each resource that needs to be controlled by business logic, the corresponding rule configuration file can be obtained through the URL of the resource.
[0047] It should be further explained that URLs can also be used to locate resources. The rule configuration file defines the data entity corresponding to the resource (that is, the data entity that the resource needs to check) and the verification rules contained in the data entity. The rule configuration file corresponding to each resource is parsed to obtain the corresponding verification rules, and the verification rules obtained by parsing the rule configuration file are stored in the cache. Each data entity contains at least one verification rule.
[0048] In some specific embodiments, the verification rule is a parameter verification rule or a script verification rule.
[0049] As can be seen from the above content, the rule configuration file contains multiple verification rules. To better understand the content of the verification rules, the following Table 1 is used as an example. It should be noted that Table 1 is only used for example. Table 1 shows the information contained in a verification rule, and the resource shown in Table 1 is a button.
[0050] Table 1:
[0051]
[0052] As shown in Table 1, button information is usually defined in the form of a URL, and the button information can be used to indicate one or more resources to which the verification rule applies, that is, one verification rule can be applicable to multiple resources; data entities are either a collection of page parameters or database entities; parameter verification rules are verification rules for a single parameter field (that is, the field in the data entity), which are usually configured using regular expressions; script verification rules: For complex business logic, you can configure script verification rules and verify the parameters by calling the preset script execution program.
[0053] As shown in Table 1, the configured parameter verification rules or script verification rules are verification rules subordinate to the data entity.
[0054] It should be noted that the parameters mentioned above are mainly divided into two types: page parameters and database parameters; among them, page parameters are information submitted by users from a page (such as a website page), or information recorded by the page based on user operations; database parameters are existing information loaded from the database based on the information submitted by the user, such as querying the cardholder's name and other information of a bank card based on the user's transaction card number.
[0055] When configuring a rule configuration file corresponding to a resource, each verification rule included in the rule configuration file is configured in a manner such as Table 1 above.
[0056] It is understandable that for resources that do not require business logic control, the corresponding rule configuration file does not need to be configured, that is, any page can load and request the resources that do not require business logic control. For example, the resources refreshed by the transaction page are resources that do not require business logic control.
[0057] After configuring the rule configuration files corresponding to each resource, you need to parse each rule configuration file to obtain the verification rules and store them in the cache. Figure 2 , an example is given to illustrate the process of parsing the rule configuration file to obtain the verification rules.
[0058] Parse the rule configuration file of a resource, and obtain a rule set containing multiple verification rules such as Figure 2 The verification rules in the configuration rule file are stored in a tree MAP structure, and the key of the resource is the URL of the resource. That is, the verification rules in the rule configuration file of the resource can be obtained through the URL of the resource.
[0059] like Figure 2 "Button" is the URL of the resource, "Datas" is the collection of all data entities defined in the rule configuration file, which contains multiple data entities that need to be checked for the resource (i.e. "Data1", "Data2" and "JSData"). The key of each data entity is the entity name; each data entity contains one or more validation rules, such as "Data1" contains two parameter validation rules (i.e. Figure 2 The key of the parameter validation rule is the name of the parameter field to be validated.
[0060] It can be understood that "JSData" is a data entity of type script validation entity, and each script validation entity contains only one script validation rule (that is, Figure 2 The key of the script validation rule is the name of the script validation entity.
[0061] After parsing the rule configuration file for each resource, you can get Figure 2 As shown in the tree diagram, all the verification rules contained in each rule configuration file are stored in the cache.
[0062] As described above, in some specific embodiments, for each data entity, when the type of the data entity is a script verification entity, the script verification entity includes a script verification rule.
[0063] In the specific implementation of step S101, when an instruction for requesting a target resource sent by a page is received, the URL of the target resource is used to obtain the verification rules contained in the data entity corresponding to the target resource from the cache.
[0064] It can be understood that the target resource is the resource that needs to be controlled by business logic.
[0065] In some specific embodiments, the process of storing the verification rules corresponding to the target resource in the cache is: parsing the preset rule configuration file corresponding to the target resource, obtaining the data entity corresponding to the target resource, and obtaining the verification rules contained in the data entity; storing the verification rules obtained by parsing the rule configuration file corresponding to the target resource in the cache; the specific storage method can be found in the above content and will not be repeated here.
[0066] Step S102: Obtain a parameter set corresponding to each data entity.
[0067] It should be noted that for the data entity that needs to be checked by the resource (including the target resource), the parameter loading file of the data entity is pre-configured. The parameter loading file defines the specific content and acquisition method of the parameter set corresponding to the data entity. In other words, the parameter loading file defines: when checking the data entity, which parameters (such as database parameters) need to be obtained and the parameter acquisition method. In other words, the parameter loading file is used to define the parameters and parameter acquisition methods required for business logic parameter verification of resources.
[0068] It should be further explained that, for the same type of parameters used by different resources, it is only necessary to define the parameter loading file (including the parameter acquisition method) once.
[0069] The contents of the parameter loading file are shown in Table 2, where Table 2 is only used for illustration and is not intended to be a specific limitation.
[0070] Table 2:
[0071] Field Name meaning dataName Data entity name DaoBean Data access Method Data query method paraType Parameter Type paraNames Parameter aliases
[0072] In Table 2, the data entity name is: the variable name used by the data entity in the cache and verification rules; the data access class and data query method are used to locate the specific method when querying parameters such as database parameters; the parameter type is used to specify the parameter type for data query; the parameter alias is the alias of the data query parameter in the passing process variable.
[0073] In the process of implementing step S102, the parameter set corresponding to each data entity of the target resource is obtained from the cache or obtained from the database based on a preset parameter loading file. Specifically, for each data entity of the target resource, it is determined whether the parameter set corresponding to the data entity exists in the cache; if so, the parameter set corresponding to the data entity is obtained from the cache; if not, based on the preset parameter loading file corresponding to the data entity, the parameter set corresponding to the data entity is obtained from the database and stored in the cache. The parameter loading file is used to define the specific content and acquisition method of the parameter set corresponding to the data entity.
[0074] In some embodiments, the parameter set includes page parameters and / or database parameters.
[0075] It should be noted that a parameter set is a collection of related parameters, for example, consumption card number, amount, transaction time, transaction date and merchant, etc., which are parameters belonging to the same consumption transaction, and these parameters can be combined into a parameter set.
[0076] For a data entity of the target resource, before verifying the parameter set of the data entity, it is necessary to check whether the parameter set of the data entity is in the cache; if the parameter set exists in the cache, the parameter set of the data entity is obtained from the cache for the subsequent verification process; if the parameter set does not exist in the cache, it is necessary to use the parameter loading file corresponding to the data entity, read the parameter set corresponding to the data entity from the database and store it in the cache.
[0077] Step S103: For each data entity, using the verification rule contained in the data entity, verify the parameter set corresponding to the data entity to obtain a verification result.
[0078] In the process of specifically implementing step S103, after obtaining the verification rules (1 or more) contained in each data entity and the parameter set corresponding to each data entity; for each data entity, each verification rule of the data entity is used to verify the parameter set to obtain a verification result, and each verification rule will return a corresponding verification result, which is used to indicate whether the parameter set has passed the verification of the verification rule.
[0079] For example: Combine Figure 2As shown in the content, "Datas" contains multiple data entities such as "Data1", "Data2" and "JSData", and each data entity contains one or more verification rules; for each data entity, each verification rule of the data entity is used to verify the parameter set to obtain the verification result.
[0080] In some specific embodiments, for each data entity, if the verification rule contained in the data entity is a parameter verification rule, the parameter verification rule and the regular expression are combined to verify the first specified parameter in the parameter set corresponding to the data entity to obtain a verification result, and the first specified parameter is the parameter specified by the parameter verification rule; if the verification rule contained in the data entity is a script verification rule, the script verification rule and the corresponding preset script execution program are combined to verify the second specified parameter in the parameter set corresponding to the data entity to obtain a verification result, and the second specified parameter is one or more parameters specified by the script verification rule.
[0081] That is to say, when the page parameters and database entity parameters are verified using parameter verification rules, the parameters and regular expressions are checked for matching by calling the regular expression execution program to determine whether the parameters pass the verification of the parameter verification rules; for script verification rules, the preset script execution program can be used to verify the parameters.
[0082] It should be noted that the parameter verification rule is mainly used to verify one parameter. For example, assuming that the parameter verification rule is that the cardholder's age must be greater than or equal to 18 years old in a consumption transaction, the age parameter can be verified through this parameter verification rule.
[0083] Script verification rules can be used to verify one or more parameters. For example, assuming the script verification rule is that the cardholder's age in a consumption transaction must be greater than or equal to 18 years old, the consumption amount on the day is less than 10,000, and there is no bad consumption record, then the script verification rule can be used to verify the age parameter, consumption parameter and consumption record parameter.
[0084] Step S104: If all verification results indicate that the verification is passed, the target resource is fed back to the page, so that the page loads and displays the target resource.
[0085] It can be seen from the above content that when the parameter set is verified using the verification rules of the target resource, each verification rule will return a corresponding verification result. In the process of implementing step S104, if the verification result returned by any verification rule of the target resource indicates that the verification failed (that is, the parameter set failed the verification of the verification rule), the business logic control of the target resource is ended, that is, the page is not allowed to load the target resource, and enters the business logic control of the next resource; if the verification results returned by all verification rules of the target resource indicate that the verification passed (that is, the parameter set passed the verification of all verification rules), it means that the target resource passes the business logic control, the page is allowed to load the target resource, and the target resource is fed back to the page, so that the page loads and displays the target resource.
[0086] It should be noted that the resources requested by the page that require business logic control are the target resources mentioned above. For each target resource, steps S101 to S104 are executed to determine whether each target resource passes the business logic control, and then determine the target resources that the page can load and display.
[0087] In an embodiment of the present invention, a rule configuration file corresponding to a target resource is pre-parsed to obtain verification rules and store them in a cache. When a page requests a target resource, the verification rules contained in the data entity corresponding to the target resource are obtained from the cache, and the parameter set corresponding to each data entity is obtained from the cache or by using a parameter loading file. The parameter set corresponding to the data entity is verified according to the verification rules contained in the data entity to obtain a verification result. When all verification results indicate that the verification is passed, the target resource is fed back to the page for loading and display. By pre-setting the rule configuration file and the parameter loading file, all parameter fields that need to be controlled by business logic are defined, so as to achieve complete business logic control and improve the accuracy of business logic control.
[0088] To better explain the process of verifying the parameter set of each data entity involved in the above step S103, Figure 3 The contents shown are illustrated by examples, see Figure 3 , shows a flow chart of verifying a parameter set of each data entity provided by an embodiment of the present invention, including the following steps:
[0089] Step S301: Obtain the verification rules contained in each data entity.
[0090] Step S302: Determine a parameter set corresponding to the data entity to be verified.
[0091] Step S303: determine whether the parameter set is in the cache; if the parameter set is not in the cache, execute step S304; if the parameter set is in the cache, execute step S305;
[0092] Step S304: Load the file using the parameters corresponding to the data entity to be verified, obtain the parameter set and store it in the cache, and execute step S305;
[0093] Step S305: Perform single verification rule verification using the verification rule included in the data entity to be verified.
[0094] In the specific implementation of step S305, a single verification rule verification is performed on the parameter set using any verification rule contained in the data entity to be verified (a verification rule that has not been verified on the parameter set).
[0095] Step S306: Determine whether the verification is passed. If not, end the entire process; if passed, proceed to step S307.
[0096] Step S307: Determine whether there is a next verification rule. If there is no next verification rule, execute step S308; if there is a next verification rule, return to execute step S305.
[0097] It should be noted that, in the specific implementation step S307, it is specifically determined whether there are any verification rules that have not been verified for the parameter set.
[0098] Step S308: Determine whether there is a next parameter set to be verified. If there is a next parameter set to be verified, return to step S302; if there is no next parameter set to be verified, end the process.
[0099] In the process of implementing step S308, it is specifically determined whether there is a parameter set of the data entity that has not been verified. If so, the data entity is used as the data entity to be verified and the process returns to step S302; if not, the process ends.
[0100] It should be noted that the execution principle of step S301 to step S308 is Figure 1 The detailed description has been given in , so I will not repeat it here.
[0101] Corresponding to the method for loading page resources provided by the above embodiment of the present invention, see Figure 4 , the embodiment of the present invention also provides a structural block diagram of a page resource loading system, the loading system includes: a first acquisition unit 401, a second acquisition unit 402, a verification unit 403 and a feedback unit 404;
[0102] The first acquisition unit 401 is used to obtain the verification rules contained in the data entity corresponding to the target resource from the cache when receiving the instruction sent by the page for requesting the target resource. The verification rules are obtained by parsing the preset rule configuration file and pre-stored in the cache. Each data entity contains at least one of the verification rules.
[0103] In a specific implementation, the first acquisition unit 401 is specifically used for: upon receiving an instruction sent by a page for requesting a target resource, obtaining the verification rules contained in the data entity corresponding to the target resource from the cache using the URL of the target resource.
[0104] In a specific implementation, the first acquisition unit 401 is also used to: parse a preset rule configuration file corresponding to the target resource, obtain a data entity corresponding to the target resource, and obtain verification rules contained in the data entity; and store the verification rules obtained by parsing the rule configuration file in a cache.
[0105] In some specific embodiments, the verification rule is a parameter verification rule or a script verification rule.
[0106] In some specific embodiments, for each data entity, when the type of the data entity is a script verification entity, the script verification entity includes a script verification rule.
[0107] The second acquisition unit 402 is used to acquire a parameter set corresponding to each data entity. The parameter set is acquired from a cache or from a database based on a preset parameter loading file.
[0108] In a specific implementation, the second acquisition unit 402 is specifically used to: for each data entity, determine whether there is a parameter set corresponding to the data entity in the cache; if so, obtain the parameter set corresponding to the data entity from the cache; if not, based on a preset parameter loading file corresponding to the data entity, obtain the parameter set corresponding to the data entity from the database and store it in the cache, and the parameter loading file is used to define the specific content and acquisition method of the parameter set corresponding to the data entity.
[0109] In some embodiments, the parameter set includes page parameters and / or database parameters.
[0110] The verification unit 403 is used to verify the parameter set corresponding to each data entity using the verification rule contained in the data entity to obtain a verification result.
[0111] In a specific implementation, the verification unit 403 is specifically used for: for each data entity, if the verification rule contained in the data entity is a parameter verification rule, the parameter verification rule and the regular expression are combined to verify the first specified parameter in the parameter set corresponding to the data entity to obtain a verification result, and the first specified parameter is the parameter specified by the parameter verification rule; if the verification rule contained in the data entity is a script verification rule, the script verification rule and the corresponding preset script execution program are combined to verify the second specified parameter in the parameter set corresponding to the data entity to obtain a verification result, and the second specified parameter is one or more parameters specified by the script verification rule.
[0112] The feedback unit 404 is used to feed back the target resource to the page if all the verification results indicate that the verification is passed, so that the page loads and displays the target resource.
[0113] In an embodiment of the present invention, a rule configuration file corresponding to a target resource is pre-parsed to obtain verification rules and store them in a cache. When a page requests a target resource, the verification rules contained in the data entity corresponding to the target resource are obtained from the cache, and the parameter set corresponding to each data entity is obtained from the cache or by using a parameter loading file. The parameter set corresponding to the data entity is verified according to the verification rules contained in the data entity to obtain a verification result. When all verification results indicate that the verification is passed, the target resource is fed back to the page for loading and display. By pre-setting the rule configuration file and the parameter loading file, all parameter fields that need to be controlled by business logic are defined, so as to achieve complete business logic control and improve the accuracy of business logic control.
[0114] In summary, the embodiment of the present invention provides a method and system for loading page resources, which defines all parameter fields that need to be controlled by business logic by presetting a rule configuration file and a parameter loading file. When requesting resources, the rule configuration file and the parameter loading file are used to verify the parameter set of the data entity to be checked, thereby achieving complete business logic control and improving the accuracy of business logic control.
[0115] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without creative work.
[0116] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0117] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may 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 rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for loading page resources, characterized in that: The method comprises: Upon receiving an instruction sent by a page for requesting a target resource, obtaining from a cache the verification rules contained in a data entity corresponding to the target resource, wherein the verification rules are obtained by parsing a preset rule configuration file and are pre-stored in the cache, and a correspondence between the URL of the target resource and the rule configuration file is pre-constructed, wherein the URL of the target resource is used to locate the target resource and to obtain the rule configuration file, wherein each of the data entities contains at least one of the verification rules, and the verification rules are parameter verification rules or script verification rules; Obtaining a parameter set corresponding to each of the data entities, wherein the parameter set is obtained from the cache or from a database based on a preset parameter loading file; For each of the data entities, using the verification rule contained in the data entity, verify the parameter set corresponding to the data entity to obtain a verification result; If all the verification results indicate that the verification is passed, the target resource is fed back to the page, so that the page loads and displays the target resource; if any of the verification results indicates that the verification is not passed, the business logic control of the target resource is terminated, and the loading of the target resource is not allowed; When receiving the instruction sent by the page for requesting the target resource, obtaining the verification rule contained in the data entity corresponding to the target resource from the cache includes: When receiving the instruction for requesting the target resource sent by the page, the uniform resource locator URL of the target resource is used to obtain the verification rules contained in the data entity corresponding to the target resource from the cache.
2. The method according to claim 1, characterized in that The process of parsing a preset rule configuration file to obtain the verification rule and storing it in the cache includes: Parsing a preset rule configuration file corresponding to a target resource, obtaining a data entity corresponding to the target resource, and obtaining a verification rule contained in the data entity; The verification rules obtained by parsing the rule configuration file are stored in a cache.
3. The method according to claim 1, characterized in that The obtaining of a parameter set corresponding to each of the data entities includes: For each of the data entities, determining whether a parameter set corresponding to the data entity exists in the cache; If it exists, obtaining a parameter set corresponding to the data entity from the cache; If it does not exist, based on a preset parameter loading file corresponding to the data entity, the parameter set corresponding to the data entity is obtained from the database and stored in the cache, and the parameter loading file is used to define the specific content and acquisition method of the parameter set corresponding to the data entity.
4. The method according to claim 1, characterized in that: The parameter set includes page parameters and / or database parameters.
5. The method according to claim 1, characterized in that For each of the data entities, when the type of the data entity is a script verification entity, the script verification entity includes a script verification rule.
6. The method according to claim 1, characterized in that The step of verifying, for each of the data entities, the parameter set corresponding to the data entity using the verification rule contained in the data entity to obtain a verification result includes: For each of the data entities, if the verification rule contained in the data entity is a parameter verification rule, the first specified parameter in the parameter set corresponding to the data entity is verified in combination with the parameter verification rule and a regular expression to obtain a verification result, where the first specified parameter is a parameter specified by the parameter verification rule; If the verification rule contained in the data entity is a script verification rule, the second specified parameter in the parameter set corresponding to the data entity is verified in combination with the script verification rule and the corresponding preset script execution program to obtain a verification result, and the second specified parameter is one or more parameters specified by the script verification rule.
7. A page resource loading system, characterized in that: The system comprises: A first acquisition unit is used to acquire, from a cache, a verification rule contained in a data entity corresponding to the target resource upon receiving an instruction sent by a page for requesting a target resource, wherein the verification rule is obtained by parsing a preset rule configuration file and is pre-stored in the cache, and a correspondence between the URL of the target resource and the rule configuration file is pre-constructed, wherein the URL of the target resource is used to locate the target resource and to acquire the rule configuration file, and each of the data entities contains at least one verification rule, and the verification rule is a parameter verification rule or a script verification rule; A second acquisition unit, configured to acquire a parameter set corresponding to each of the data entities, wherein the parameter set is acquired from the cache or from a database based on a preset parameter loading file; A verification unit, configured to verify, for each of the data entities, the parameter set corresponding to the data entity using the verification rule contained in the data entity to obtain a verification result; A feedback unit is used to feed back the target resource to the page if all the verification results indicate that the verification is passed, so that the page loads and displays the target resource; if any of the verification results indicates that the verification is not passed, end the business logic control of the target resource and do not allow the target resource to be loaded; The first acquisition unit is specifically used to: when receiving an instruction sent by a page for requesting a target resource, use the uniform resource locator URL of the target resource to acquire the verification rules contained in the data entity corresponding to the target resource from the cache.
Citation Information
Patent Citations
Data acquisition method and device
CN106897433A
Data acquiring and displaying methods and devices
CN108287757A
Vilification method and device of page component, server and storage medium
CN108319575A
Page monitoring method and device and storage medium
CN111026619A