Embodiment
In describing below, in order to illustrate rather than in order to limit, it is proposed that such as tool of particular system structure, technology etc
Body details, thoroughly to understand the embodiment of the present invention.However, it will be clear to one skilled in the art that there is no these specific
The present invention can also be realized in the other embodiments of details.In other situations, omit to well-known system, device, electricity
Road and the detailed description of method, in case unnecessary details hinders description of the invention.
In various embodiments of the present invention, the executive agent of flow is the application program run on mobile terminal, letter
Claim Mobile solution.The Mobile solution is mixed type application Hybrid App.
In order to illustrate technical solutions according to the invention, illustrated below by specific embodiment.
Fig. 1 shows the implementation process of page resource loading method provided in an embodiment of the present invention, and this method flow includes
Step S101 to S104.The specific implementation principle of each step is as follows.
S101:When page load events are triggered, page load request is intercepted, and obtains the page loading
The entrained page address of request.
At the time of startup at the time of Mobile solution loading page resource including Mobile solution and the operation in Mobile solution
During, at the time of receiving the resource selection instruction that user sends.In these cases, page load events are triggered.
Now, Mobile solution generation page load request.When the blocker for defaulting in Mobile solution detects the page load request,
Page load request is intercepted and captured, so that page load request can not normally reach its destination address, i.e. so that page
Face load request can not send to remote server and can not be on request of loading telecommunication network page resource.
The page load request intercepted to current time parses, to extract the page entrained by page load request
Address.Above-mentioned page address can for example be stored in URL (the Uniform Resoure of the page resource on remote server
Locator, URL) address.Can be embodied in page address the network transmission protocol, IP address, domain name addresses,
The information such as path and resource file name.
Exemplarily, the page address entrained by page load request for intercepting to obtain can be:local://
www.abc.com/item/url/110640。
Preferably, the network transmission protocol corresponding to the primary page resource of Mobile solution is usually file agreements, due to
File agreements can not be identified interception, therefore in the development process of Mobile solution, the network corresponding to primary page resource is passed
Defeated agreement is uniformly changed to local agreements.It is local only in the agreement for detecting the page address entrained by page load request
During agreement, just page load request is intercepted.
S102:Based on website corresponding to the page address, it is determined that the page resource plug-in unit with the site match, described
Page resource plug-in unit is pre-stored within the installation kit of application program.
Website represents to carry out multiple page resources the virtual directory of tissue, maintenance and management.Obtained according to above-mentioned S101
The page address obtained, the IP address part in page address or domain name addresses part are defined as corresponding to the page address
Website.
For example, in above-mentioned page address http:In //www.abc.com/item/url/110640, obtained domain is parsed
Name address is " www.abc.com ", therefore website corresponding to the page address is www.abc.com websites.
In the embodiment of the present invention, it is necessary to the installation kit based on the Mobile solution downloaded in advance before Mobile solution startup,
Installation process is carried out to the Mobile solution.In the installation kit of download, the page resource plug-in unit of multiple websites is stored with.Specifically
Ground, before the installation kit of issue Mobile solution, the page resource of each website related to the Mobile solution will be integrated into one
Hfcache plug-in units, and be packed into the hfcache plug-in units in the installation kit of Mobile solution.
After Mobile solution is installed successfully, each page resource plug-in unit is obtained from installation kit.According to each page resource
Website corresponding to the plug-in unit name of plug-in unit and above-mentioned page load request, from each page resource plug-in unit for being integrated in installation kit
In, determine the page resource plug-in unit with site match.
S103:The page resource plug-in unit is run, is provided with multiple static caches under the website that is locally stored
Source.
During each hfcache plug-in component operation, a compressed package corresponding with the hfcache plug-in units and a caching will be transferred
Lists of documents.The file format of above-mentioned compressed package includes but is not limited to .zip forms or .rar forms.Include station in compressed package
Every static cache resource of point, js files, css files, picture and audio file in such as website.Cache file inventory
For the resource name of every static cache resource in recording compressed bag and the MD5 values corresponding to each static cache resource.
Each static cache resource will calculate its MD5 value in issue by preset algorithm.By static cache resource consolidation extremely
During hfcache plug-in units, its MD5 value will be recorded in cache file inventory corresponding to hfcache plug-in units.
Compressed package corresponding to hfcache plug-in units is decompressed, can obtain the static cache resource under each store path.
S104:In the application program, according to default network view, loading matches described with the page address
Static cache resource.
From the page address entrained by page load request, the page resource of loading needed for current Mobile solution is parsed
Resource path and resource file name.In the obtained every static cache resource of decompression, determine with the resource path with
And the static cache resource of resource file name matching.
WebView is one based on webkit engines and the control for showing web page.In the embodiment of the present invention,
By the WebView of Mobile solution internal preset, the static cache resource determined is parsed, to generate corresponding Web
The page, so as to realize the displaying to the page resource needed for page load request.
In the embodiment of the present invention, by being stored in Hybrid App application program installation kit and multiple site matches
Page resource plug-in unit, and make Hybrid App when intercepting page load request, decompression is stored in local page resource and inserted
Part, to load the static cache resource matched with page load request, even ensure that Hybrid App in loaded page first
, also can be from local quick loading page resource, so as to reduce to remote server requests for page under the situation of face resource
The number of resource, the loading for greatly reducing page resource take, and thus also improve Hybrid App performance.
As an alternative embodiment of the invention, as shown in Fig. 2 after above-mentioned S104, in addition to:
S105:Every default time interval, update of plug-in detection request is sent to first server.
The static cache resource of different websites generally safeguards renewal by different team, is updated for the ease of Mobile solution
The static cache resource for each website being locally stored, the embodiments of the invention provide a static cache resource distribution platform, respectively
After individual team logs in the static cache resource distribution platform by its login account, you can beat the static cache resource after renewal
Wrap biography.After page resource plug-in unit is uploaded into static cache resource distribution platform, that is, complete the renewal of page resource plug-in unit
Issue.For the ease of understanding and distinguishing over below-mentioned remote server, by above-mentioned static cache resource distribution platform
Referred to as first server.
Mobile solution is sent update of plug-in detection request to first server, worked as with detection every default time interval
Whether the static cache resource that the preceding moment is locally stored updates.
As one embodiment of the present of invention, above-mentioned S105 is specifically included:
Every default time interval, update of plug-in detection request, the update of plug-in detection are sent to first server
Request bag contains the identification number of the page resource plug-in unit, so that the first server is in the plug-in unit bound with the identification number
In resource page, the static cache resource issued of extraction current time, and return to the first server and delay with static state
Deposit related the first cache file inventory of resource.
In the embodiment of the present invention, the local each page resource plug stored has allocated an identification number in advance, that is, uses
In the ID number of unique mark page resource plug-in unit.Every default time interval, Mobile solution need to determine that each page resource is inserted
Whether part there is redaction.The ID number of page resource plug-in unit based on required detection, Mobile solution send to first server and taken
Update of plug-in detection request with the ID number.
When first server receives update of plug-in detection request, the entrained page of update of plug-in detection request is parsed
The ID number of face resource plug.In each page resource plug-in unit that first server is issued at current time, filter out and the ID
Page resource plug-in unit corresponding to number.The static cache resource that page resource plug-in unit according to filtering out is called, first server
The first cache file inventory is generated, the resource name of every static cache resource and MD5 values are recorded in the first caching text
Part inventory, and the first cache file inventory is detected to the response message asked as update of plug-in, it is back to Mobile solution.
Preferably, the resource homepage address corresponding to each ID number is stored with first server, in prefixed time interval
During arrival, each resource homepage address that first server is stored according to it crawls the page resource in resource homepage address,
New page resource plug-in unit is integrated into so that result will be crawled, and the page resource plug-in unit is issued.In the embodiment of the present invention,
The administrative staff of website without manual entry static cache resource distribution platform and manually upload the page resource plug-in unit after renewal,
The resource homepage address of website need to be only stored in first server, can realize that the automatic of page resource plug-in unit crawls and determined
Shi Gengxin, thus reduce operation complexity of the page resource plug-in unit in issuing process is updated.
S106:Receive the first server asks the first returned cache file clear according to update of plug-in detection
Single, the first cache file inventory includes the MD5 values of each static cache resource.
S107:In the second cache file inventory obtained by running the page resource plug-in unit, read each described quiet
The MD5 values of state cache resources.
After running the page resource plug-in unit being locally stored, a cache file inventory can be equally obtained, in order to be different from first
The cache file inventory that server is returned, the cache file inventory that is obtained after the page resource plug-in unit that is locally stored will be run
Referred to as the second cache file inventory.From above-mentioned steps S103, the second cache file inventory record has page resource plug-in unit institute
The resource name of every static cache resource and the MD5 values corresponding to each static cache resource in corresponding compressed package.
S108:For each static cache resource, if its MD5 value in the first cache file inventory and its
MD5 values in the second cache file inventory are different, then update the static cache resource, and by second cache file
Inventory is updated to the first cache file inventory.
It is successively read the MD5 values corresponding to each resource name in the first cache file inventory.Wherein, each money is being read
During MD5 values corresponding to source name, in the second cache file inventory, MD5 values corresponding with the resource name are found out.If this
Two MD5 values differ, it is determined that the static cache resource corresponding to the resource name has issued new version.
Especially, if a certain resource name in the first cache file inventory is not present in the second cache file inventory,
Equally determine that the static cache resource corresponding to the resource name has issued new version.
When it is determined that a certain static cache resource has issued new version, from first server, the static cache is downloaded
Resource, to update the static cache resource that Mobile solution is locally stored.Also, stored Mobile solution originally first is delayed
Deposit lists of documents to be deleted, the second cache file inventory is updated to the first cache file inventory.
Preferably, when updating the static cache resource that Mobile solution is locally stored, only downloaded from first server
The incremental portion data of static cache resource, to reduce the data volume downloaded needed for Mobile solution, so as to improve static cache
The renewal efficiency of resource.
In the embodiment of the present invention, pass through timing acquisition first cache file related to the static cache resource of newest issue
Inventory, and judge the MD5 values and first cache file of static cache resource in local the second cache file inventory stored
Whether the MD5 values in inventory are identical, and whether the static cache resource that can be quickly detected out in Mobile solution has issued new edition
This, improves detection efficiency;In MD5 value of a certain static cache resource in the first cache file inventory with it in the second caching
When MD5 values in lists of documents are different, by updating the static cache resource, the full page larger to information content can be avoided
The download of resource plug, which thereby enhance the renewal efficiency of static cache resource.
As another embodiment of the present invention, as shown in figure 3, after above-mentioned S103, in addition to:
S109:Obtain default decipherment algorithm.
S110:By the decipherment algorithm, multiple static cache resources under the website that is locally stored are entered
Row decryption processing.
In the embodiment of the present invention, the page resource plug-in unit of the installation kit of Mobile solution, each page resource plug are packed into
Corresponding static cache resource and cache file inventory be based on AES (Advanced Encryption Standard,
Advanced Encryption Standard) encryption file data.When Mobile solution is in running status, and after intercepting page load request, touch
Send out decipherment algorithm and obtain event, to read the decipherment algorithm for prestoring and being stored in Mobile solution.By the decipherment algorithm, to encryption
Processing is decrypted in each static cache resource, to decrypt compressed package, the cache file inventory corresponding to page resource plug-in unit
And every static cache resource.
In the embodiment of the present invention, while being packed to page resource plug-in unit and application program, by static state
Every data file such as cache resources is encrypted so that static cache resource can be stored in mobile terminal in an encrypted form
In.Only when Mobile solution is run, page load request is just intercepted, the decryption for decrypting page resource plug-in unit could be obtained
Algorithm, it is therefore, as long as Mobile solution is not in running status, then quiet even if static cache resource is intercepted by other criminals
State cache resources can not be just decrypted, hereby it is ensured that the code security of static cache resource.
As one embodiment of the present of invention, as shown in figure 5, above-mentioned S104 is specifically included:
S1041:In the multiple static cache resource, the static cache money matched with the page address is obtained
Source, and calculate the MD5 values of the static cache resource.
It is each static slow after decompression according to the page address entrained by page load request in the embodiment of the present invention
Deposit in resource, search for the static cache resource matched with the page address.Local MD5 algorithms are stored in by prestoring, to search
Obtained static cache resource is handled, to calculate MD5 value of the static cache resource at current time.Wherein, it is local
The used MD5 algorithms when being distributed page resource plug-in unit are identical with first server for the MD5 algorithms stored.
S1042:In each MD5 values of the second cache file inventory are pre-recorded in, read and the static cache
MD5 values corresponding to resource.
According to the resource name of the static cache resource, in the cache file inventory being locally stored, the resource name is searched
Claim corresponding MD5 values, to judge whether MD5 values that lookup obtains and the MD5 values that current time calculates in real time are identical.
S1043:If it is identical with the MD5 values being calculated to read obtained MD5 values, in the application program, according to
Default network view, load the static cache resource.
S1044:If it is different from the MD5 values being calculated to read obtained MD5 values, the page is sent to second server
Face load request, to load the Webpage resource based on the page address.
Different data contents, its MD5 value being calculated by same MD5 algorithms is different.Therefore, if currently
Moment is stored in local static cache resource and changed, or the static cache resource that is recorded of cache file inventory
MD5 values are the MD5 values of newest issue, then the MD5 values being calculated by MD5 algorithms will be with being stored in cache file inventory
MD5 values it is different, so as to judge whether the static cache resource being locally stored is tampered or whether is latest edition
Page resource.
If the MD5 values being calculated are identical with the MD5 values read in the second cache file inventory, local can determine that
The static cache resource of storage is the page resource of newest issue, and is not tampered with, therefore by default WebView, directly add
Carry the static cache resource.
If the MD5 values being calculated are different from the MD5 values read in the second cache file inventory, local can determine that
The static cache resource of storage is the page resource of legacy version, or is illegally distorted.Now, the page that interception obtains is added
Carry request and be re-transmitted to the corresponding Resource Server in page address entrained by with it, to ask online to obtain page money
Source.
In the embodiment of the present invention, the real-time MD5 values of static cache resource are calculated by using MD5 algorithms, and contrast and be somebody's turn to do
Whether MD5 values and the MD5 values in cache file inventory are identical, realize the anti-tamper verification of static cache resource;Due to caching
Lists of documents may update in itself prior to the file of static cache resource, if thus the MD5 values that are calculated and caching text
MD5 values in part inventory are different, then the static cache resource that can tentatively judge to be locally stored may be with the static state of latest edition
Cache resources are different, therefore by online real-time loading page resource, it ensure that Mobile solution can improve page money to greatest extent
While the loading velocity of source, the page resource of latest edition is shown, so as to improve the reliability of Mobile solution.
It should be understood that the size of the sequence number of each step is not meant to the priority of execution sequence, each process in above-described embodiment
Execution sequence should determine that the implementation process without tackling the embodiment of the present invention forms any limit with its function and internal logic
It is fixed.
Corresponding to the page resource loading method described in foregoing embodiments, Fig. 5 shows page provided in an embodiment of the present invention
The structured flowchart of face resource loading device, for convenience of description, it illustrate only the part related to the embodiment of the present invention.
Reference picture 5, the device include:
Interception unit 501, for when page load events are triggered, being intercepted to page load request, and obtain
Page address entrained by the page load request.
Determining unit 502, for based on website corresponding to the page address, it is determined that being provided with the page of the site match
Source plug-in unit, the page resource plug-in unit are pre-stored within the installation kit of application program.
Decompression units 503, for running the page resource plug-in unit, with multiple under the website that is locally stored
Static cache resource.
Loading unit 504, in the application program, according to default network view, loading to be with the page
The static cache resource of location matching.
Alternatively, as shown in fig. 6, the page resource loading device also includes:
Request unit 505, for every default time interval, update of plug-in detection request to be sent to first server.
Receiving unit 506, returned the is asked according to update of plug-in detection for receiving the first server
One cache file inventory, the first cache file inventory include the MD5 values of each static cache resource.
Reading unit 507, in the second cache file inventory obtained by the page resource plug-in unit is run, reading
The MD5 values of each static cache resource.
Updating block 508, for for each static cache resource, if it is in the first cache file inventory
MD5 values it is different from its MD5 value in the second cache file inventory, then update the static cache resource, and will described in
Second cache file inventory is updated to the first cache file inventory.
Alternatively, the request unit 507 includes:
Subelement is asked, for every default time interval, update of plug-in detection request, institute to be sent to first server
State the update of plug-in detection request bag identification number that contains the page resource plug-in unit so that the first server with the mark
Know in number plug-in resource page of binding, the static cache resource that extraction current time is issued, and make the first server
Return to the first cache file inventory related to the static cache resource.
Alternatively, as shown in fig. 7, the page resource loading device also includes:
Acquiring unit 509, for obtaining default decipherment algorithm.
Decryption unit 510, for by the decipherment algorithm, to multiple static state under the website that is locally stored
Processing is decrypted in cache resources.
Alternatively, the loading unit 504 includes:
Computation subunit, in the multiple static cache resource, acquisition to match described with the page address
Static cache resource, and calculate the MD5 values of the static cache resource.
Subelement is obtained, in each MD5 values of the second cache file inventory are pre-recorded in, reading and being somebody's turn to do
MD5 values corresponding to static cache resource.
Subelement is loaded, if identical with the MD5 values being calculated for reading obtained MD5 values, journey is applied described
In sequence, according to default network view, the static cache resource is loaded.
Transmission sub-unit, if different from the MD5 values being calculated for reading obtained MD5 values, to second server
The page load request is sent, to load the Webpage resource based on the page address.
In the embodiment of the present invention, by being stored in Hybrid App application program installation kit and multiple site matches
Page resource plug-in unit, and make Hybrid App when intercepting page load request, decompression is stored in local page resource and inserted
Part, to load the static cache resource matched with page load request, even ensure that Hybrid App in loaded page first
, also can be from local quick loading page resource, so as to reduce to remote server requests for page under the situation of face resource
The number of resource, the loading for greatly reducing page resource take, and thus also improve Hybrid App performance.
Fig. 8 is the schematic diagram for the terminal device that one embodiment of the invention provides.As shown in figure 8, the terminal of the embodiment is set
Standby 8 include:Processor 80, memory 81 and it is stored in the meter that can be run in the memory 81 and on the processor 80
Calculation machine program 82, such as page resource loading procedure.The processor 80 is realized above-mentioned each when performing the computer program 82
Step in individual page resource loading method embodiment, such as step 101 shown in Fig. 1 is to 104.Or the processor 80
The function of each module/unit in above-mentioned each device embodiment, such as unit shown in Fig. 5 are realized when performing the computer program 82
51 to 54 function.
Exemplary, the computer program 82 can be divided into one or more module/units, it is one or
Multiple module/units are stored in the memory 81, and are performed by the processor 80, to complete the present invention.Described one
Individual or multiple module/units can be the series of computation machine programmed instruction section that can complete specific function, and the instruction segment is used for
Implementation procedure of the computer program 82 in the terminal device 8 is described.
The terminal device 8 can be that the calculating such as desktop PC, notebook, palm PC and cloud server are set
It is standby.The terminal device may include, but be not limited only to, processor 80, memory 81.It will be understood by those skilled in the art that Fig. 8
The only example of terminal device 8, the restriction to terminal device 8 is not formed, can included than illustrating more or less portions
Part, some parts or different parts are either combined, such as the terminal device can also include input-output equipment, net
Network access device, bus etc..
Alleged processor 80 can be CPU (Central Processing Unit, CPU), can also be
Other general processors, digital signal processor (Digital Signal Processor, DSP), application specific integrated circuit
(Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-
Programmable Gate Array, FPGA) either other PLDs, discrete gate or transistor logic,
Discrete hardware components etc..General processor can be microprocessor or the processor can also be any conventional processor
Deng.
The memory 81 comprises at least a type of computer-readable recording medium, can be the terminal device 8
Internal storage unit, such as the hard disk or internal memory of terminal device 8.The memory 81 can also be the terminal device 8
The plug-in type hard disk being equipped with External memory equipment, such as the terminal device 8, intelligent memory card (Smart Media Card,
SMC), secure digital (Secure Digital, SD) blocks, flash card (Flash Card) etc..Further, the memory 81
The internal storage unit of the terminal device 8 can also both be included or including External memory equipment.The memory 81 is used to deposit
Store up the computer program and other programs and data needed for the terminal device.The memory 81 can be also used for temporarily
When store the data that has exported or will export.
It is apparent to those skilled in the art that for convenience of description and succinctly, only with above-mentioned each work(
Can unit, module division progress for example, in practical application, can be as needed and by above-mentioned function distribution by different
Functional unit, module are completed, i.e., the internal structure of described device are divided into different functional units or module, more than completion
The all or part of function of description.Each functional unit, module in embodiment can be integrated in a processing unit, also may be used
To be that unit is individually physically present, can also two or more units it is integrated in a unit, it is above-mentioned integrated
Unit can both be realized in the form of hardware, can also be realized in the form of SFU software functional unit.In addition, each function list
Member, the specific name of module are not limited to the protection domain of the application also only to facilitate mutually distinguish.Said system
The specific work process of middle unit, module, the corresponding process in preceding method embodiment is may be referred to, will not be repeated here.
In the above-described embodiments, the description to each embodiment all emphasizes particularly on different fields, and is not described in detail or remembers in some embodiment
The part of load, it may refer to the associated description of other embodiments.
Those of ordinary skill in the art are it is to be appreciated that the list of each example described with reference to the embodiments described herein
Member and algorithm steps, it can be realized with the combination of electronic hardware or computer software and electronic hardware.These functions are actually
Performed with hardware or software mode, application-specific and design constraint depending on technical scheme.Professional and technical personnel
Described function can be realized using distinct methods to each specific application, but this realization is it is not considered that exceed
The scope of the present invention.
In embodiment provided by the present invention, it should be understood that disclosed device/terminal device and method, can be with
Realize by another way.For example, device described above/terminal device embodiment is only schematical, for example, institute
The division of module or unit is stated, only a kind of division of logic function, there can be other dividing mode when actually realizing, such as
Multiple units or component can combine or be desirably integrated into another system, or some features can be ignored, or not perform.Separately
A bit, shown or discussed mutual coupling or direct-coupling or communication connection can be by some interfaces, device
Or INDIRECT COUPLING or the communication connection of unit, can be electrical, mechanical or other forms.
The unit illustrated as separating component can be or may not be physically separate, show as unit
The part shown can be or may not be physical location, you can with positioned at a place, or can also be distributed to multiple
On NE.Some or all of unit therein can be selected to realize the mesh of this embodiment scheme according to the actual needs
's.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, can also
That unit is individually physically present, can also two or more units it is integrated in a unit.Above-mentioned integrated list
Member can both be realized in the form of hardware, can also be realized in the form of SFU software functional unit.
If the integrated module/unit realized in the form of SFU software functional unit and as independent production marketing or
In use, it can be stored in a computer read/write memory medium.Based on such understanding, the present invention realizes above-mentioned implementation
All or part of flow in example method, by computer program the hardware of correlation can also be instructed to complete, described meter
Calculation machine program can be stored in a computer-readable recording medium, and the computer program can be achieved when being executed by processor
The step of stating each embodiment of the method..Wherein, the computer program includes computer program code, the computer program
Code can be source code form, object identification code form, executable file or some intermediate forms etc..Computer-readable Jie
Matter can include:Can carry any entity or device of the computer program code, recording medium, USB flash disk, mobile hard disk,
Magnetic disc, CD, computer storage, read-only storage (ROM, Read-Only Memory), random access memory (RAM,
Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium etc..It is it should be noted that described
The content that computer-readable medium includes can carry out appropriate increasing according to legislation in jurisdiction and the requirement of patent practice
Subtract, such as in some jurisdictions, electric carrier signal and electricity are not included according to legislation and patent practice, computer-readable medium
Believe signal.
Embodiment described above is merely illustrative of the technical solution of the present invention, rather than its limitations;Although with reference to foregoing reality
Example is applied the present invention is described in detail, it will be understood by those within the art that:It still can be to foregoing each
Technical scheme described in embodiment is modified, or carries out equivalent substitution to which part technical characteristic;And these are changed
Or replace, the essence of appropriate technical solution is departed from the spirit and scope of various embodiments of the present invention technical scheme, all should
Within protection scope of the present invention.