Summary of the invention
Fundamental purpose of the present invention is to provide a kind of matching process and device of resource request, the low problem for the treatment of effeciency when resource request coupling in prior art to solve.
To achieve these goals, according to an aspect of the present invention, provide a kind of matching process of resource request, having comprised: the feature of Gains resources request; The matched rule corresponding with the feature of resource request in loading rule database, wherein, rule database is to the classify database of storage of matched rule in browser; And utilize the matched rule loading to mate resource request.
Further, to matched rule classify storage comprise: receive matched rule; Obtain type, action scope and the keyword of matched rule, wherein, action scope is the domain name of the applicable loading of matched rule website, and loading website is the website of Web page loading resource; According to the type getting, matched rule is classified, and the corresponding relation of storage class and matched rule and type; According to the action scope getting, matched rule is classified, and the corresponding relation of memory action territory and matched rule and action scope; And according to the keyword getting, matched rule is classified, and store the corresponding relation of keyword and matched rule and keyword.
Further, obtain in the following manner the keyword of matched rule: read the character string that represents matched rule; In process, often read first character reading, the character string that represents matched rule is once cut apart, obtain multiple separating character strings, wherein, the first character is neither alphabetic character neither numerical character; Add up the number of the character amount of each separating character string; And the maximum separating character string of the definite character amount keyword that is matched rule.
Further, the feature of resource request comprises the territory of the website of initiating resource request, the type of web page resources that resource request is corresponding and the address information of the website of initiation resource request, wherein, in loading rule database, the matched rule corresponding with the feature of resource request comprises that at least one that adopt in following load mode loads: using the type of web page resources corresponding to resource request as index terms, and according to the corresponding matched rule of type of web page resources corresponding with resource request in types index mode loading rule database, wherein, types index loads matched rule according to the type of matched rule, using the territory of website of initiating resource request as index terms, and according to matched rule corresponding with the territory of website of initiating resource request in action scope indexed mode loading rule database, wherein, action scope index loads matched rule according to the action scope of matched rule, and using the address information of website of initiating resource request as index terms, and according to matched rule corresponding with the address information of website of initiating resource request in keyword index mode loading rule database, wherein, keyword index loads matched rule according to the keyword of matched rule.
Further, using the type of web page resources corresponding to resource request as index terms, and comprise according to the corresponding matched rule of type of web page resources corresponding with resource request in types index mode loading rule database: whether search rule database is to store the first kind in judgment rule database, wherein, the type of the first kind web page resources corresponding with resource request is identical; And if judge and store the first kind in rule database, obtain the action scope of the matched rule under the first kind in rule database, obtain the first action scope, using the territory of website of initiating resource request as index terms, and comprise according to matched rule corresponding with the territory of website of initiating resource request in action scope indexed mode loading rule database: judge in the first action scope, whether to comprise the first territory, wherein, the first territory is the territory of initiating the website of resource request; And if judge the first action scope and comprise the first territory, obtain the keyword that is applied to the matched rule in the first territory in rule database, obtain the first keyword, using the address information of website of initiating resource request as index terms, and comprise according to matched rule corresponding with the address information of website of initiating resource request in keyword index mode loading rule database: judge whether the first character string comprises the first keyword, wherein, the first character string is the character string that represents address information; And if judge the first character string and comprise the first keyword, the matched rule that comprises the first keyword in loading rule database.
Further, before obtaining the type of matched rule, action scope and keyword, matching process also comprises: the time attribute of obtaining the matched rule receiving; Obtain the time attribute of rule database; And whether moment corresponding to the time attribute of the matched rule that receives of judgement be after moment corresponding to the time attribute of rule database, wherein, the time attribute of the matched rule receiving if judge corresponding time be engraved in moment corresponding to the time attribute of rule database after, obtain type, action scope and the keyword of matched rule.
To achieve these goals, according to a further aspect in the invention, provide a kind of coalignment of resource request, this coalignment is for carrying out any matching process that foregoing of the present invention provides.
To achieve these goals, according to a further aspect in the invention, provide a kind of coalignment of resource request, having comprised: the first acquiring unit, for the feature of Gains resources request; Loading unit, for the loading rule database matched rule corresponding with the feature of resource request, wherein, rule database be in browser to matched rule classify storage database; And matching unit, for the matched rule that utilizes loading, resource request is mated.
Further, coalignment also comprises: receiving element, for receiving matched rule; Second acquisition unit, for obtaining type, action scope and the keyword of matched rule, wherein, action scope is the domain name of the applicable loading of matched rule website, loading website is the website of Web page loading resource; The first processing unit, for according to the type getting, matched rule being classified, and the corresponding relation of storage class and matched rule and type; The second processing unit, for according to the action scope getting, matched rule being classified, and the corresponding relation of memory action territory and matched rule and action scope; And the 3rd processing unit, for according to the keyword getting, matched rule being classified, and store the corresponding relation of keyword and matched rule and keyword.
Further, second acquisition unit comprises: read subelement, for reading the character string that represents matched rule; Cut apart subelement, for often reading first character in the process that reads, to representing that the character string of matched rule once cuts apart, obtain multiple separating character strings, wherein, the first character is neither alphabetic character neither numerical character; Statistics subelement, for add up each separating character string character amount number; And definite subelement, for the keyword of determining that the maximum separating character string of character amount is matched rule.
Further, the feature of resource request comprises the type of web page resources corresponding to territory, the resource request of the website of initiating resource request and initiates the address information of the website of resource request, wherein, loading unit comprises: first loads subelement, for using the type of web page resources corresponding to resource request as index terms, and according to the corresponding matched rule of type of web page resources corresponding with resource request in types index mode loading rule database, wherein, types index loads matched rule according to the type of matched rule; Second loads subelement, be used for the territory of the website to initiate resource request as index terms, and according to matched rule corresponding with the territory of website of initiating resource request in action scope indexed mode loading rule database, wherein, action scope index loads matched rule according to the action scope of matched rule; And the 3rd load subelement, be used for the address information of the website to initiate resource request as index terms, and according to matched rule corresponding with the address information of website of initiating resource request in keyword index mode loading rule database, wherein, keyword index loads matched rule according to the keyword of matched rule.
Further, the first loading unit comprises: the first judge module, whether store the first kind for search rule database with judgment rule database, and wherein, the type of the first kind web page resources corresponding with resource request is identical; And first acquisition module, for in the time judging rule database and store the first kind, obtain the action scope of the matched rule under the first kind in rule database, obtain the first action scope, the second loading unit comprises: the second judge module, be used for judging whether the first action scope comprises the first territory, wherein, the first territory is the territory of initiating the website of resource request; And second acquisition module, for in the time judging the first action scope and comprise the first territory, obtain the keyword that is applied to the matched rule in the first territory in rule database, obtain the first keyword, the 3rd loading unit comprises: the 3rd judge module, be used for judging whether the first character string comprises the first keyword, wherein, the first character string is the character string that represents address information; And load-on module, in the time judging the first character string and comprise the first keyword, the matched rule that comprises the first keyword in loading rule database.
By the present invention, adopt the feature of Gains resources request; The matched rule corresponding with the feature of resource request in loading rule database, wherein, rule database is to the classify database of storage of matched rule in browser; And utilize the matched rule loading to mate resource request.By in the time that resource request is carried out to rule match, obtain rule corresponding with the feature of resource request in rule base, realize and reduced the matching times of resource request being carried out to rule match, avoid successively resource request and strictly all rules in rule base being mated to caused treatment effeciency low, solve the low problem for the treatment of effeciency when resource request coupling in prior art, and then reached the effect that improves resource request matching efficiency.
Embodiment
It should be noted that, in the situation that not conflicting, the feature in embodiment and embodiment in the application can combine mutually.Describe below with reference to the accompanying drawings and in conjunction with the embodiments the present invention in detail.
The embodiment of the present invention provides a kind of matching process of resource request, below the matching process of resource request that the embodiment of the present invention is provided be specifically introduced:
Fig. 2 is according to the process flow diagram of the matching process of the embodiment of the present invention, and as shown in Figure 2, the method comprises that following step S201 is to step S203:
S201: the feature of Gains resources request, particularly, in the time that user opens webpage by browser, first browser can produce resource request, afterwards again by resource request being responded to obtain the web page resources corresponding with resource request, wherein, the feature of Gains resources request is mainly to obtain initiate the type of web page resources corresponding to territory, the resource request of website of resource request and initiate the address information of the website of resource request.
S202: the matched rule corresponding with the feature of resource request in loading rule database, wherein, rule database be in browser to matched rule classify storage database, that is, in loading rule database, there is the matched rule of corresponding relation with the feature of resource request.
S203: utilize the matched rule loading to mate resource request.Particularly, can adopt prior art any one carries out the method for matching treatment to resource request.
The matching process of the embodiment of the present invention is in the time carrying out rule match to resource request, by in the time that resource request is carried out to rule match, obtain rule corresponding with the feature of resource request in rule base, realize and reduced the matching times of resource request being carried out to rule match, avoid successively resource request and strictly all rules in rule base being mated to caused treatment effeciency low, solve the low problem for the treatment of effeciency when resource request coupling in prior art, and then reached the effect that improves resource request matching efficiency.
To adopt the complete matching process of character string in step S203, to utilize the matched rule loading that resource request is mated and illustrated:
First, obtain respectively the character string of the address information that represents resource request and the character string of the matched rule that expression loads, wherein, the character string that represents the address information of resource request is to initiate the corresponding character string in URL address of the website of resource request, and the character string that represents the matched rule loading is the coded string of the matched rule of loading.Wherein, if when the matched rule loading in step S202 comprises many matched rules, the character string that represents each matched rule is all obtained, obtained many character strings, matched rule of a string representation.
Then, whether the character string that judges the address information that represents resource request is identical with the character string that represents the matched rule loading,, whether the URL address character string that judges resource request is identical with the character string that represents the matched rule loading, wherein, if the matched rule loading in step S202 is many rules, the character string of the address information that represents resource request is contrasted to judge whether identical with each character string getting.
Finally, in the time that the character string of judging the address information that represents resource request is identical with the character string that represents the matched rule loading, determine that the matched rule of resource request and browser matches.If the matched rule loading in step S202 comprises many matched rules, the character string of the address information that represents resource request is being contrasted after judgement with each character string getting, if it is identical with the arbitrary character string in many character strings to judge the character string of the address information that represents resource request, determine that the matched rule of resource request and browser matches.
In the embodiment of the present invention to matched rule classify storage concrete disposal route shown in Figure 3, as shown in Figure 3:
First, receive the matched rule in browser, type, action scope and keyword to the matched rule receiving obtain, wherein, so-called type refers to the enumeration type of the predetermined coded string of program when matched rule is encoded, so-called action scope refers to matched rule need to come into force under what domain name,, the domain name of the adaptable loading of matched rule website is the action scope of this matched rule, the so-called website that loads refers to the website that web page resources is loaded, and the website of initiating in embodiments of the present invention resource request is one and loads website;
Then, storage after matched rule is classified, mainly according to following three kinds of modes, matched rule is classified, mode one: matched rule is classified according to the enumeration type getting, and the type that gets of storage and the corresponding relation of matched rule and type,, by the each rule corresponding stored in matched rule under the enumeration type of its ownership; Mode two: according to getting action scope, matched rule is classified, and the action scope that gets of storage and the corresponding relation of matched rule and action scope, that is, and by the each rule corresponding stored in matched rule under its applied action scope; Mode three: according to the keyword getting, matched rule is classified, and stores the corresponding relation of keyword and matched rule and keyword, that is, and by the each rule corresponding stored in matched rule under corresponding keyword.
Wherein, in embodiments of the present invention, action scope is divided into two kinds, one is specified domain, one is universe, wherein, and in the time that loading website is the arbitrary website in preassigned a part of website, matched rule A comes into force, and this part set of the domain name of appointed website is in advance the specified domain of matched rule A; When loading website whencesoever when website, matched rule B all comes into force, and the set of domains of all websites is the universe of matched rule B, and wherein, the matched rule coming into force under universe is across the board rule, and the matched rule coming into force under specified domain is specified domain rule.The enumeration type of the embodiment of the present invention comprises enumHTML(html document resources), enumCSS(CSS (cascading style sheet) resource), enumPicture(image resource), enumJS(script resource), enumObject(embedded object resource), enumXML(xml document resources), other undefined types of enumUndef(); The keyword of matched rule can be the short character strings in matched rule coded string,, by the character string that represents matched rule being cut apart to obtain the keyword of matched rule, concrete dividing method is: the character string that represents matched rule is read, in process, often read first character reading, the character string that represents matched rule is once cut apart, obtain multiple separating character strings, wherein, so-called the first character refers to the character except alphabetic character and numerical character; The number of then adding up character in each separating character string is how many; Finally determine the keyword that the maximum separating character string of character number is matched rule, wherein, if have the character number of two or more separating character strings to be N in multiple separating character strings, and the character number of other separating character string is all less than N,, the separating character string that in separating character string, character number is maximum is multiple, the keyword that the character string that definite any one character number is N is matched rule.Illustrate, the character string that represents certain matched rule is " abcde-fghij.klmnop.com/qrstuvw.html ", determines the keyword that " qrstuvw " is this matched rule.
Further, in the embodiment of the present invention, from rule database, loading at least one or the two kind modes with two or more combinations of the matched rule corresponding with the feature of resource request in comprising in such a way loads:
Mode one: using the type of web page resources corresponding to resource request as index terms, and according to the corresponding matched rule of type of web page resources corresponding with resource request in types index mode loading rule database, wherein, types index loads matched rule according to the type of matched rule, , from rule database, load the matched rule under the type identical with the type according to the type of web page resources corresponding to resource request, reach the not identical matched rule of type of avoiding loading the web page resources corresponding with resource request, reduce the heap(ed) capacity of matched rule.
Mode two: using the territory of website of initiating resource request as index terms, and according to matched rule corresponding with the territory of website of initiating resource request in action scope indexed mode loading rule database, wherein, action scope index loads matched rule according to the action scope of matched rule,, according to the territory of website of initiating resource request from rule database load application to the matched rule under this territory, reach and avoided loading the matched rule under the territory that cannot be applied to the website of initiating resource request, reduced the heap(ed) capacity of matched rule.
Mode three: using the address information of website of initiating resource request as index terms, and according to matched rule corresponding with the address information of website of initiating resource request in keyword index mode loading rule database, wherein, keyword index loads matched rule according to the keyword of matched rule, , load according to address information, the matched rule corresponding with the address information of website of initiating resource request meets: the keyword that represents to have in the character string of address information the matched rule of loading, this load mode has reached the heap(ed) capacity that reduces matched rule equally.
Preferably, above-mentioned three kinds of load modes can be combined with in embodiments of the present invention, particularly, carry out according to following load step:
First, rule database is searched in judgment rule database, whether store the first kind, wherein, the type of the first kind web page resources corresponding with resource request is identical, if can find the first kind from rule database, explanation is judged in rule database and is stored the matched rule that belongs to the first kind, in this case, action scope to the matched rule under the first kind in rule database is obtained, and obtains the first action scope;
Then, judge in the first action scope whether comprise the first territory, wherein, the first territory is the territory of initiating the website of resource request, comprise the first territory if judge the first action scope, the keyword of the matched rule that is applied to the first territory in rule database is obtained, obtain the first keyword;
Finally, judge whether the first character string comprises the first keyword, wherein, the first character string is the character string that represents address information, comprise the first keyword if judge the first character string, the matched rule that comprises the first keyword in rule database is loaded, that is, extract all complete rules that the first keyword is corresponding and load.Further, if the matched rule that is applied to the first territory has the words of many, the keyword getting can be multiple, , the first keyword comprises multiple keywords, judge in the first character string, whether to comprise the arbitrary keyword in multiple keywords for this kind of situation, comprise the arbitrary keyword in multiple keywords if judge the first character string, determine that the first character string comprises the first keyword, suppose that keyword that the first character string comprises is keyword K, from rule database, extracting all complete rules that keyword K is corresponding loads.
By adopting successively the type of web page resources corresponding to resource request, the territory of website of initiating described resource request and the address information of website of initiating resource request as index terms, matched rule in rule database is screened successively, finally load the matched rule that simultaneously meets above condition, realize the heap(ed) capacity of further minimizing matched rule, with follow-up when matched rule is mated with resource request, adopt the matched rule of less amount to mate, improve further matching efficiency.
It should be noted that, in embodiments of the present invention, adopt " first kind " such descriptive language, just for the type of web page resources corresponding resource request and other type are distinguished, is not that the order of the type to web page resources limits.Adopt reason and the above-mentioned explanation of the such descriptive language of " the first action scope ", " the first keyword " similar.
Can find out by above description, the matching process of the resource request of the embodiment of the present invention is mainly divided into two parts, a part is that the matched rule that the each function in browser is used is processed, another part is to utilize matched rule after treatment to carry out matching treatment to resource request, this two parts flow process is independently carried out in different phase respectively, be independent of each other, wherein, the classification of matched rule processed and carried out before the matching treatment of resource request.The embodiment of the present invention, by matched rule having been carried out to specific classification processing (dividing according to the characteristic such as type, action scope), in the time that a certain resource request is mated, only needs the specific matched rule of loading section at every turn; According to the treatment scheme of the embodiment of the present invention (shown in Figure 4), the no matter number of matched rule total quantity, every resource request only need be carried out 2-4 comparison in the situation that there is no repeated matching rule, can complete complete matching process, has reduced matching times; Traditional single regularly the resource request of browser is compared one by one with character string rule mate flow process, every needed comparison number of times of resource request is equal to regular total quantity substantially; The two is compared, and the matching process of the embodiment of the present invention has obviously improved matching efficiency.
Further, after receiving matched rule, and before obtaining the type of matched rule, action scope and keyword, the matching process of the embodiment of the present invention also comprises whether matched rule the judgement of revising is occurred to, illustrate herein a kind of judge matched rule whether occur revise method: first, time attribute to the matched rule receiving is obtained, and the time attribute of rule database is obtained; Then, whether moment corresponding to the time attribute of the matched rule that contrast judgement receives be after moment corresponding to the time attribute of rule database, if the former is after the latter, illustrate front and once matched rule is classified and stored into after rule database, having there is modification in matched rule, needs in this case the matched rule storage of again classifying; Once matched rule is classified and stored into after rule database if the former not after the latter, illustrates front, matched rule is not revised, in this case without storage that matched rule is classified again.
Wherein, in the matching process of the embodiment of the present invention, the type of web page resources corresponding to resource request is being determined and can adopted following methods to carry out: first obtaining and judge that the kernel type of generation resource request is Webkit kernel or Trident kernel producing the kernel type of resource request.It is the situation of Webkit kernel for browser kernel, when browser produces resource request by Webkit kernel, can make modification at encapsulated layer, it is adjusted back to processing function by the function such as ResourceDispatcherHostImpl::OnRequestResource, ResourceDispatcherHostImpl::BeginRequest in the time of request resource, due to Webkit kernel in inner predefine ResourceType, so resource type corresponding to the resource request producing for Webkit kernel browser can directly acquire; And be the situation of Trident kernel for browser kernel, determining of web page resources corresponding to resource request that this browser kernel is produced, can be by program registration " the asynchronous agreement of inserting " (Asynchronous Pluggable Protocol), all resources of this kernel requests are adjusted back to program via the function such as COInetProt::StartEx, CInternetProtocolFilter::Start, obtain the address information of all resource request with this, and classify and obtain the type of the web page resources of asking by the extension name information to this address information.
The embodiment of the present invention also provides a kind of coalignment of resource request, below this being specifically introduced of coupling of resource request that the embodiment of the present invention is provided:
Fig. 5 is according to the schematic diagram of the coalignment of the embodiment of the present invention, and as shown in Figure 5, the coalignment of this embodiment comprises the first acquiring unit 10, loading unit 20 and matching unit 30.
Particularly, the first acquiring unit 10 is for the feature of Gains resources request, particularly, in the time that user opens webpage by browser, first browser can produce resource request, afterwards again by resource request being responded to obtain the web page resources corresponding with resource request, wherein, the feature of Gains resources request is mainly obtain the type of web page resources corresponding to territory, the resource request of the website of initiating resource request and initiate the address information of the website of resource request.
Loading unit 20 is for the loading rule database matched rule corresponding with the feature of resource request, wherein, rule database be in browser to matched rule classify storage database, that is, in loading rule database, there is the matched rule of corresponding relation with the feature of resource request.
Matching unit 30 mates resource request for the matched rule that utilizes loading.Particularly, can adopt prior art any one carries out the method for matching treatment to resource request.
The coalignment of the embodiment of the present invention is in the time carrying out rule match to resource request, by in the time that resource request is carried out to rule match, obtain rule corresponding with the feature of resource request in rule base, realize and reduced the matching times of resource request being carried out to rule match, avoid successively resource request and strictly all rules in rule base being mated to caused treatment effeciency low, solve the low problem for the treatment of effeciency when resource request coupling in prior art, and then reached the effect that improves resource request matching efficiency.
Matching unit 30 utilizes the matching process that the matched rule loading mates resource request to be:
First, obtain respectively the character string of the address information that represents resource request and the character string of the matched rule that expression loads, wherein, the character string that represents the address information of resource request is to initiate the corresponding character string in URL address of the website of resource request, and the character string that represents the matched rule loading is the coded string of the matched rule of loading.Wherein, if when the matched rule loading in loading unit 20 comprises many matched rules, the character string that represents each matched rule is all obtained, obtain many character strings, matched rule of a string representation.
Then, whether the character string that judges the address information that represents resource request is identical with the character string that represents the matched rule loading,, whether the URL address character string that judges resource request is identical with the character string that represents the matched rule loading, wherein, if the matched rule loading in loading unit 20 is many rules, the character string of the address information that represents resource request is contrasted to judge whether identical with each character string getting.
Finally, if it is identical with the character string that represents the matched rule loading to judge the character string of the address information that represents resource request, determine that the matched rule of resource request and browser matches.If the matched rule loading in loading unit 20 comprises many matched rules, the character string of the address information that represents resource request is being contrasted after judgement with each character string getting, if it is identical with the arbitrary character string in many character strings to judge the character string of the address information that represents resource request, determine that the matched rule of resource request and browser matches.
In the embodiment of the present invention matched rule being classified to when storage, can adopt the rule treatments unit in coalignment to process, wherein, the schematic diagram of rule treatments unit is shown in Figure 6, as shown in Figure 6, rule treatments unit comprises original regular reading unit, indexing units and fast table output unit, wherein, original regular reading unit (, receiving element) read for the matched rule with browser, indexing units is for processing matched rule, fast table output unit is the unit that the Output rusults of indexing units is stored, that is to say rule database.Wherein, indexing units is mainly processed matched rule by second acquisition unit and the first to the 3rd processing unit:
Particularly, second acquisition unit is for obtaining type, action scope and the keyword of matched rule, wherein, so-called type refers to the enumeration type of the predetermined coded string of program when matched rule is encoded, so-called action scope refers to matched rule need to come into force under what domain name,, the domain name of the adaptable loading of matched rule website is the action scope of this matched rule, the so-called website that loads refers to the website that web page resources is loaded, and the website of initiating in embodiments of the present invention resource request is one and loads website; The first processing unit is for classifying to matched rule according to the enumeration type getting, and the type that gets of storage and the corresponding relation of matched rule and type, that is, by the each rule corresponding stored in matched rule under the enumeration type of its ownership; The second processing unit is for classifying to matched rule according to getting action scope, and the action scope that gets of storage and the corresponding relation of matched rule and action scope, that is, by the each rule corresponding stored in matched rule under its applied action scope; The 3rd processing unit is for classifying to matched rule according to the keyword getting, and stores the corresponding relation of keyword and matched rule and keyword, that is, by the each rule corresponding stored in matched rule under corresponding keyword.Wherein, second acquisition unit reads the character string that represents matched rule by reading subelement, in process, often read first character reading, by cutting apart subelement, the character string that represents matched rule is once cut apart, obtain multiple separating character strings, wherein, so-called the first character refers to the character except alphabetic character and numerical character; Then add up the number of character in each separating character string by statistics subelement how many; Finally by the keyword of determining that separating character string that subelement determines that character number is maximum is matched rule.
In the embodiment of the present invention in the time that matched rule is loaded, can adopt the requesting processing in coalignment to process, wherein, the schematic diagram of requesting processing is shown in Figure 7, as shown in Figure 7, requesting processing comprises type matching unit, action scope matching unit and keyword matching unit.
Wherein, type matching unit is also referred to as the first loading subelement, be mainly used in the type of the web page resources corresponding using resource request as index terms, and according to matched rule corresponding with the type of the web page resources of resource request request in types index mode loading rule database, wherein, types index loads matched rule according to the type of matched rule, , from rule database, load the matched rule under the type identical with the type according to the type of web page resources corresponding to resource request, reach the not identical matched rule of type of avoiding loading the web page resources corresponding with resource request, reduce the heap(ed) capacity of matched rule.
Action scope matching unit is also referred to as the second loading subelement, be mainly used in the territory of the website of initiating resource request as index terms, and according to matched rule corresponding with the territory of website of initiating resource request in action scope indexed mode loading rule database, wherein, action scope index loads matched rule according to the action scope of matched rule, , according to the territory of website of initiating resource request from rule database load application to the matched rule under this territory, reach and avoided loading the matched rule under the territory that cannot be applied to the website of initiating resource request, reduce the heap(ed) capacity of matched rule.
Keyword matching unit loads subelement also referred to as the 3rd, be mainly used in the address information of the website of initiating resource request as index terms, and according to matched rule corresponding with the address information of website of initiating resource request in keyword index mode loading rule database, wherein, keyword index loads matched rule according to the keyword of matched rule, , load according to address information, the matched rule corresponding with the address information of website of initiating resource request meets: the keyword that represents to have in the character string of address information the matched rule of loading, this load mode has reached the heap(ed) capacity that reduces matched rule equally.
Further, type matching unit in the embodiment of the present invention, action scope matching unit and keyword matching unit can combine the loading of carrying out matched rule, particularly, be used for searching and whether storing and the first kind from rule database according to the type of web page resources corresponding to resource request (hereinafter referred to as the first kind) by the first judge module in the first loading subelement, judge if search and in rule database, store the first kind, explanation is judged and in rule database, is stored the matched rule that belongs to the first kind, now, by the first acquisition module in the first loading subelement, the action scope of the matched rule under the first kind in rule database is obtained, obtain the first action scope, then search to judge in the first action scope, whether to comprise the first territory by the second judge module in the second loading subelement, wherein, the first territory is the territory of initiating the website of resource request, comprise the first territory if judge the first action scope, by the second acquisition module in the second loading subelement, the keyword of the matched rule that is applied to the first territory in rule database is obtained, obtain the first keyword, finally, judge by the 3rd the 3rd judge module loading in subelement whether the first character string comprises the first keyword, wherein, the first character string is the character string that represents address information, comprise the first keyword if judge the first character string, by the 3rd load-on module loading in subelement, the matched rule that comprises the first keyword in rule database is loaded, that is, extract all complete rules that the first keyword is corresponding and load.
By adopting successively type matching unit, action scope matching unit and keyword matching unit to screen successively the matched rule in rule database, finally load the matched rule that simultaneously meets above condition, realize the heap(ed) capacity of further minimizing matched rule, with follow-up when matched rule is mated with resource request, adopt the matched rule of less amount to mate, improve further matching efficiency.
As can be seen from the above description, the present invention has realized the matching times of every resource request of great minimizing, promotes matching speed; While is because original match rule treatments is separated independently and carried out with resource matched processing procedure, and each matched rule loading that needs greatly reduces in resource matched process, and therefore, in matching process, the resource occupation of program also significantly reduces.Use method of the present invention, especially, in the time that browser is processed ample resources matching request, can greatly improve routine processes speed, reduce program CPU(Central Processing Unit, central processing unit) and memory source take.
It should be noted that, can in the computer system such as one group of computer executable instructions, carry out in the step shown in the process flow diagram of accompanying drawing, and, although there is shown logical order in flow process, but in some cases, can carry out shown or described step with the order being different from herein.
Obviously, those skilled in the art should be understood that, above-mentioned of the present invention each module or each step can realize with general calculation element, they can concentrate on single calculation element, or be distributed on the network that multiple calculation elements form, alternatively, they can be realized with the executable program code of calculation element, thereby, they can be stored in memory storage and be carried out by calculation element, or they are made into respectively to each integrated circuit modules, or the multiple modules in them or step are made into single integrated circuit module to be realized.Like this, the present invention is not restricted to any specific hardware and software combination.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for a person skilled in the art, the present invention can have various modifications and variations.Within the spirit and principles in the present invention all, any modification of doing, be equal to replacement, improvement etc., within all should being included in protection scope of the present invention.