WO2012048617A1 - Method and system for updating widget, widget client and widget server - Google Patents

Method and system for updating widget, widget client and widget server Download PDF

Info

Publication number
WO2012048617A1
WO2012048617A1 PCT/CN2011/080099 CN2011080099W WO2012048617A1 WO 2012048617 A1 WO2012048617 A1 WO 2012048617A1 CN 2011080099 W CN2011080099 W CN 2011080099W WO 2012048617 A1 WO2012048617 A1 WO 2012048617A1
Authority
WO
WIPO (PCT)
Prior art keywords
widget
update
file
document
data area
Prior art date
Application number
PCT/CN2011/080099
Other languages
French (fr)
Chinese (zh)
Inventor
张锐利
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2012048617A1 publication Critical patent/WO2012048617A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/131Protocols for games, networked simulations or virtual reality

Definitions

  • Widget update method system, Widget client and Widget server
  • the present invention relates to communication technologies, and in particular, to a Widget technology for a mobile terminal.
  • Widget is a small web application developed using existing standard web technologies like regular web pages, including HTML (HyperText Mark-up Language), CSS (cading Style Sheet), cascading Style sheets, which are a set of formatting rules), JavaScript (a client-side scripting language), XML (Extensible Markup Language), and Ajax (Asynchronous JavaScript and XML, asynchronous JavaScript and XML).
  • HTML HyperText Mark-up Language
  • CSS cading Style Sheet
  • cascading Style sheets which are a set of formatting rules
  • JavaScript a client-side scripting language
  • XML Extensible Markup Language
  • Ajax Asynchronous JavaScript and XML, asynchronous JavaScript and XML.
  • the most striking difference from a normal web page is that it does not rely on the browser display framework and is designed to have specific features such as stocks, weather forecasts, clocks, games, and more.
  • Widgets Due to its advantages of small size, light weight, complete functions, and diverse personalization, Widgets have been applied to the field of mobile terminals to enhance the user experience and provide cost-effective services. And the Widget app has another feature - updateability. Even if the Widget app has been released, it allows developers to continually refine the Widget application, fix bugs in previous versions, or add more features. Users can download the latest Widget app to get the latest and more reasonable experience.
  • the Widget application zip package conforming to the Widget standard definition consists of three parts: a file data area, a file directory area, and a file directory end area.
  • the file data area represents the file data in the compressed package. How many files and directories have the file data area? This is also the main part of the zi compression package, which contains the data of all files; each file data area corresponds to one file.
  • Directory area this part only records the directory name or file name, and the offset of the corresponding file data area starting position in the entire zip file; the file directory end area is the last part of the zip archive, contains the directory inside the compressed package File The number, and the size of the file directory area.
  • the existing Widget application package named weekdays contains 4 file data areas, namely index.html, config.xmK scripts ⁇ scripts/ dayfinder js , and also contains 4 file directory areas and 1 file directory. End zone.
  • the technical problem to be solved by the present invention is to provide a Widget update method, system, Widget client and Widget server to improve update efficiency.
  • the present invention provides a method for updating a widget (Widget), the method comprising:
  • the Widget client sends an update request to the Widget server
  • the Widget server After receiving the update request, the Widget server extracts the current version of the Widget application package and the latest version of the Widget application package of the Widget client, and compares them;
  • the widget server constructs a response body and sends the response body to the Widget client, the response body including an update document constructed according to the comparison result and a preset update policy;
  • the widget client receives the response body and updates according to the update document.
  • the update request sent by the Widget client carries the current Widget version number, and the Widget server obtains the current version Widget application package according to the current Widget version number.
  • the method further includes: updating the correspondence between the Widget client and the Widget version number when the Widget server sends the response body;
  • the step of extracting the current version Widget application package of the Widget client includes: the Widget server according to the The mapping between the Widget client and the Widget version number obtains the current version Widget application package.
  • the updating policy is: constructing the updated document according to the changed file and information; or determining whether the number and/or size of the changed file exceeds a preset threshold, and if so, using all files of the latest version as Update the document, if not exceeded, construct the updated document based on the changed files and information.
  • Each Widget application package includes a file data area, a file directory area, and a file directory end area; the steps of comparing the current version of the widget client's Widget application package with the latest version of the Widget application package include:
  • the first data area sequence and the second data area sequence are respectively generated by using the current version Widget application package and the latest version Widget application package, and the content (Data) of each file data area in each data area sequence and the file/directory corresponding to the content
  • the name (ID) is a node of the sequence of the data area
  • the update file includes updated file data area information, newly added file data area information, deleted file data area information, and a file directory area and a file directory end area of the latest version.
  • the updated file data area information includes an ID and a data
  • the added file data area information includes an ID
  • a location in a current version of the Widget application package and Data
  • the deleted file data area information includes an ID
  • the response body further includes an update document type indication, configured to indicate that the update document is a total update document or a partial update document; and the updating according to the update document comprises: the Widget client determining, according to the updated document type indication Update the document type; when the update document is all updated documents, the Widget client will update the document to replace the current version of the Widget application package; when the update document is a partial update document, the Widget client performs the current version of the Widget application package according to the updated document. Partially updated.
  • the step of the Widget client partially updating the current version Widget application package according to the update document includes:
  • Parsing the updated document extracting the Data and the ID corresponding to the Data, and classifying and representing the management by updating, deleting, and adding a mark, and extracting the file directory area and the file directory end area at the same time.
  • the present invention further provides a Widget server, the Widget server comprising:
  • a network interaction unit configured to: receive an update request sent by the Widget client, and send a response body to the Widget client, where the response body includes an update document;
  • Widget application package database which is configured to store each version of the Widget application package
  • a version comparison unit configured to compare a current version of the Widget client package with a latest version of the Widget application package
  • the response body construction unit is configured to construct the update document and construct the response body according to the comparison result of the version comparison unit and the preset update policy.
  • the present invention further provides a Widget client, where the Widget client includes:
  • a network interaction unit configured to: send an update request to the Widget server, and receive a response body sent by the Widget server, where the response body includes an update document, where the update document is the Widget server according to the current current of the Widget client
  • the version of the Widget application package is compared with the latest version of the Widget application package and the update strategy is constructed;
  • a widget update unit configured to complete the widget update based on the updated document.
  • the Widget server generates an update document according to the comparison result between the current version application package and the latest version application package, and the Widget client performs the Widget update according to the update document, thereby implementing partial update of the Widget and effectively improving the update efficiency.
  • Figure 1 is the zip package format of the Widget application
  • FIG. 2 is a schematic diagram of a method for updating a Widget of the present invention
  • FIG. 3 is a flowchart of implementing an update of a Widget server according to an embodiment of the present invention
  • FIG. 4 is a flowchart of a Widget client completing an update according to an embodiment of the present invention
  • FIG. 5 is a flowchart of a method for judging content comparison content of a Widget server according to the present invention
  • FIG. 6 is a schematic diagram of a Widget update system of the present invention.
  • FIG. 7 is a block diagram showing a module structure of a version comparison unit of a Widget server
  • FIG. 8 is a block diagram showing a module structure of a Widget update unit of a Widget client
  • Figure 9 is a block diagram showing the structure of a partial update module. Preferred embodiment of the invention
  • the Widget server generates an update document according to the comparison result between the current version application package and the latest version application package, and the Widget client performs Widget update according to the update document, thereby implementing partial update of the Widget.
  • the Widget update method of the present invention includes:
  • Step 201 The Widget client sends an update request to the Widget server.
  • the Widget server includes but is not limited to the following two ways to obtain the current version of the Widget client application package:
  • Manner 1 The update request sent by the Widget client carries the current version number of the Widget, and the Widget server obtains the current version application package according to the current version number of the Widget. If the Widget server can provide multiple Widget application packages, the update request should also carry the corresponding Widget ID or name to uniquely identify a Widget application package along with the version number.
  • the Widget application package includes a file data area, a file directory area, and a file directory end area, and comparing the current version application package of the Widget client with the latest version application package includes:
  • Bl. respectively generate a data area sequence for the current version and the latest version, wherein each file data area content (Data) and its corresponding file/directory name (ID) are used as a node of the data area sequence; cl. will be the latest version
  • Each node is compared with each node of the current version one by one. If the latest version of a node is the same as the current version of a node ID and Data is different, the latest version of the node is marked as an update, if the latest version of a node is If there is no corresponding ID in the current version, the node of the latest version is marked as new. If a node of the current version does not have a corresponding ID in the latest version, the node of the current version is marked as deleted.
  • Data file data area content
  • ID file/directory name
  • Step 203 The Widget server constructs a response body and sends the response body to the Widget client, where the response body includes an update document constructed according to the comparison result and a preset update policy.
  • Strategy 1 constructing the updated document according to the changed file and information
  • Strategy 2 Determine whether the number and/or size of the changed files exceeds a preset threshold. If it exceeds, all the files of the latest version are used as the updated document. If not, the update is constructed according to the changed files and information. Documentation. Preferably, the second strategy is employed.
  • an updated document constructed based on a changed file and information is also referred to as a partial update document, and an updated document constructed based on the latest version of all files is referred to as a full update document.
  • Step 204 The Widget client receives the response body and updates according to the update document.
  • the (partial) update document includes updated file data area information, and a new file data area.
  • Information, deleted file data area information, and the latest version of the file directory area and file directory end area specifically:
  • the updated file data area information includes a file/directory name and a file data area content, where the newly added file data area information includes a file/directory name, a location in a current version application package, and a file data area content,
  • the deleted file data area information includes the file/directory name.
  • the response body further includes an update document type indication, configured to indicate that the update document is a full update document or a partial update document; and the Widget client 4 determines according to the updated document type indication.
  • Update the document type when the update document is all updated documents, the Widget client will update the document to replace the current Widget application package; when the update document is a partial update document, the Widget client partially updates the current Widget application package according to the updated document.
  • the update of the Widget client according to the update document includes:
  • the Widget update method of the present invention includes:
  • the Widget client sends an update network request carrying the current Widget application version number (VI) and the Widget application URI (Uniform Resource Identifier) to the corresponding Widget server;
  • the Widget server After receiving the network request, the Widget server performs policy judgment—taking the VI version of the Widget application package from the local server and comparing it with the latest version of the Widget application package;
  • the Widget server constructs and returns a response body
  • the version of the Widget application package is returned to the Widget client as a response body of the A step;
  • the server constructs a partial update document containing updated file data area information, new file data area information, deleted file data area information, and file directory area. , the end of the file directory. Return the document as a response body of step A to the Widget client;
  • Widget client After the Widget client receives the response body of the server, it completes the update.
  • the Widget client receives all of them, replacing the old Widget application package;
  • the Widget client parses the file data area information in the read document, replaces the corresponding file data area in the current version, or deletes the specified data area, or inserts the newly added file data area to Specify the location. Finally, replace the corresponding part of the current version with the file directory area and the file end area in the document to complete the update process of the Widget application package.
  • the Widget update method includes: after receiving the update request sent by the Widget client, the Widget server extracts the current version application package of the Widget client and the latest version application package, and compares the same; The Widget server constructs a response body and sends the response body to the Widget client, and the response body includes an update document constructed according to the comparison result and a preset update policy.
  • the update policy may be the foregoing policy one or the second one.
  • the embodiment uses the second strategy.
  • the processing flow of the Widget server of the present invention will be described in more detail below with reference to the accompanying drawings and embodiments.
  • the number of changed files is proportional to the width T1 and the size ratio is wide.
  • the value T2 is 60% and 70%, respectively.
  • the method for implementing update of the Widget server includes:
  • the Widget server receives the update request sent by the Widget client, and parses out the Widget application name and the current application version number;
  • the Widget server reads the Widget application package with the specified version number and name from the database storing the Widget application, and the latest version of the Widget application package;
  • the Widget server parses the current version of the Widget application package and the latest version of the Widget application package according to the zi compression file standard, and constructs a node for each file data area content (data) and corresponding file name or directory name information (id) in order. Adding to the sequence structure, generating two data area sequences, the data area sequence of the current version application package is Seql, and the data area sequence of the latest version application package is Seq2;
  • the Widget server reads each node of Seq2 in order, according to the content comparison decision algorithm (refer to FIG. 5), and compares with the nodes in the Seql sequence, if there is a data area with the same file name or directory name (ie, the same id), Then, it is determined whether the content data of the data area is the same. If the content is different, it indicates that the data area is updated, and the node of Seq2 is marked as updated; if there is no data area with the same id, the data area is added, and Seq2 is added. The node is marked as new; when traversing the node in Seql and finding that the id of a node does not match the node id in Seq2, the node in Seql is marked as deleted.
  • the Widget server performs an update policy judgment. Traversing the Seq2 sequence to obtain the number and total size of the data area to be updated and added. If the number of data areas that have changed is too large, it exceeds T1, or the total size accounts for a larger proportion of the entire Widget application package, exceeding T2. Then it is not suitable for partial update, execute all update policies, go to step 306', if the number of changed data areas and the total size are smaller than the corresponding threshold, execute the partial update policy, and go to step 306;
  • the Widget Server Configuration section updates the documentation. Take the XML markup language as an example.
  • the document should contain updated file data area information, new file data area information, deleted file data area information, and a new version of the file directory area and file directory end area.
  • each updated file data area it is represented by an ⁇ updateEntry> ⁇ /updateEntry> element. At least the following attributes are included: ID indicates the file/directory name corresponding to the data area, and length indicates the The size of the data area. The content between the open tag ⁇ updateEntry > and the closed tag ⁇ / updateEntry > is the updated file data area, and its length is consistent with the value of the length attribute, and can be 0.
  • ID indicates the file/directory name corresponding to the data area.
  • each new file data area it is represented by a ⁇ newEntry> ⁇ /newEntry> element. It includes at least the following attributes: ID indicates the file name or directory name corresponding to the data area, position indicates the position where the data area should be inserted, and length indicates the size of the data area.
  • ID indicates the file name or directory name corresponding to the data area
  • position indicates the position where the data area should be inserted
  • length indicates the size of the data area.
  • the content between the open tag ⁇ newEntry> and the closed tag ⁇ /newEntry> is a new file data area whose length is consistent with the length attribute value and can be 0.
  • the Widget server performs a full update policy. The server reads the latest version of the Widget application package from the database storing the Widget application and uses it as an update document.
  • the Widget server constructs a response body of the Widget client update request, which is encapsulated according to a specific application layer protocol. If it is a partial update, the partial update document is used as a response body text, and the corresponding MIME (Multipurpose Internet Mail Extensions) is indicated. Web mail extension) type, for XML documents, the MIME type is application/xml, which means the application of XML type. If it is all updates, the latest version of the Widget application package is directly used as the body of the update request response body, and the MIME type is specified. Application/Widget, which means the application of the Widget type;
  • the Widget server sends the encapsulated response body to the Widget client through the network to complete the update process on the Widget server side.
  • the method for updating the Widget of the present invention includes: a Widget client sends an update request to the Widget server; the Widget client receives a response body sent by the Widget server, and the response body includes an update document.
  • the update document is constructed by the Widget server according to a comparison result and an update policy of a current version application package of the Widget client and a latest version application package; and the Widget client updates according to the update document.
  • the process of updating the Widget client in the embodiment includes:
  • the Widget client receives the response body of the Widget server to the update request, and parses the MIME type and the body data;
  • the MIME type is application/Widget, it means that all updates, the body data is the new version of the Widget application package, and directly replaces the current version of the Widget application package, and executes 409'; if the MIME type is application/xml, It means that the partial update, the body data is a partial update document, and the execution continues to 403.
  • Parse the partial update document Parsing the updated document, extracting the Data and the corresponding ID, and classifying and representing the management according to the update, delete, and newly added tags, and extracting the file directory area and the file directory end area content: constructing an update data area node sequence (updateSeq) ), for each ⁇ updateEntry> to generate a node, with the ID attribute value as the node identifier, and save the data area content of the element; construct a delete data area node sequence (delSeq), construct a node for each ⁇ delEntry>, The ID attribute value is used as the node identifier.
  • update data area node sequence updateSeq
  • delSeq delete data area node sequence
  • the file name or directory name represented by the data area is used as a node identifier to form a file data area sequence (OrigSeq), and the last node of the sequence saves the file directory area and the file directory end area content.
  • the corresponding node is found in the current Widget application file data area sequence OrigSeq according to the ID identification value of each node, and the node is deleted;
  • each node (Node2)
  • the corresponding node (Node1) is found in the OrigSeq sequence, and the file data area content of the Node2 node is replaced with the Node1 node. Data area.
  • OrigSeq is already a sequence that stores the updated data area, writing the contents of each node's data area to a local temporary file.
  • Figure 5 is a flow chart of the algorithm for comparing the content of the Widget server:
  • the node is taken from the N2 position of the new version data area sequence Seq2, and the initial value of N2 is 0.
  • step 503 If the N2 node is empty, indicating that the Seq2 sequence has been traversed, and if the N2 node is not empty, the N2 node is compared with the nodes of the Seq1 sequence one by one, and step 503 is performed;
  • step 506 is performed to determine the content of the data area. If the ID is not found in Seql, Execute 505;
  • step 508 is performed. If not, step 507 is performed;
  • nodes in Seql that are not marked as “not deleted” are marked as "deleted", ie, those nodes marked as "delete” do not find the ID-instance node in Seq2.
  • the present invention further provides a Widget update system.
  • the system includes a Widget client and a Widget server, and the Widget client includes:
  • a network interaction unit configured to: send an update request to the Widget server, and receive the Widget server to send to the response body, where the response body includes an update document;
  • the update request sent by the Widget client carries the current version number of the Widget, and the version comparison unit of the Widget server obtains the current version of the application package according to the current version number of the Widget.
  • the widget update unit is configured to complete a widget update according to the update document;
  • the widget server includes:
  • a network interaction unit configured to receive the update request and send the response body to the Widget client
  • Widget application package database which is configured to store each version of the Widget application package
  • a version comparison unit configured to compare a current version application package of the Widget client with a latest version application package
  • the response body construction unit is configured to construct the update document based on the comparison result and the preset update policy, and construct the response body.
  • the update strategy is:
  • the Widget application package includes a file data area, a file directory area, and a file directory end area.
  • the version comparison unit of the Widget server includes:
  • a Widget package content extraction module configured to generate a data area sequence respectively for the current version and the latest version, wherein the content (Data) of each file data area in each data area sequence and the corresponding file/directory name (ID) a node for the sequence of data regions;
  • a version comparison module configured to compare each node of the latest version with each node of the current version one by one, if the node of the latest version is different from the node ID of the current version, the latest version of the node is marked For the update, if the latest version of a node does not have a corresponding ID in the current version, the node of the latest version is marked as new. If a node of the current version does not have a corresponding ID in the latest version, the current The node of the version is marked for deletion;
  • the (partial) update document constructed by the response body construction unit includes updated file data area information, newly added file data area information, deleted file data area information, and a latest version file directory area and file directory end area.
  • the updated file data area information includes a file/directory name and a file data area content
  • the newly added file data area information includes a file/directory name, a location in the compressed package, and a file data area content, and the deleted content.
  • the file data area information includes the file/directory name.
  • the response body further includes an update document type indication, which is used to indicate that the update document is a total update document or a partial update document.
  • the Widget update unit includes an update determination module, all update modules, and a portion. Update module
  • the update judging module is configured to judge the update document type according to the update document type indication; the update module is configured to replace the update file with the current Widget application package when the update document is all updated documents;
  • the partial update module is configured to partially update the current Widget application package according to the update document when the update document is a partial update document. Further, as shown in FIG. 9, the partial update module includes:
  • the document analysis sub-module is updated, and is configured to: parse the update document, extract the Data and the corresponding ID, and classify and represent the management according to the update, delete, and new tags, and extract the file directory area and the file directory end area content. ;
  • the Widget package content extraction sub-module is configured to: parse the current version application package, identify each file data area content in sequence, and the file/directory name identifier corresponding to the content, and form a compressed package data area management sequence (OrigSeq); as well as
  • a Widget package content update submodule configured to delete a file data area marked as deleted in the update document from the OrigSeq sequence; replacing the updated file data area in the OrigSeq sequence with the file data area marked as updated in the update document Inserting the file data area marked as new in the update document into the OrigSeq sequence according to the specified location; replacing the new version of the file directory area and the file directory end area with the corresponding area of the OrigSeq sequence to form a new version of the compressed package Data Area Management Sequence (NewSeq).
  • NewSeq compressed package Data Area Management Sequence
  • the present invention further provides a Widget server, the Widget server includes: a network interaction unit, configured to: receive an update request sent by a Widget client, and send a response body to the Widget client, where the response body includes an update Document
  • the update request sent by the Widget client carries the current version number of the Widget, and the version comparison unit of the Widget server obtains the current version of the application package according to the current version number of the Widget.
  • Widget application package database which is configured to store each version of the Widget application package
  • a version comparison unit configured to compare a current version application package of the Widget client with a latest version application package
  • the response body construction unit is configured to construct the update document based on the comparison result and the preset update policy, and construct the response body.
  • the updating policy is: constructing the updated document according to the changed file and information; or, determining whether the number and/or size of the changed file exceeds a preset threshold, and if so, using all files of the latest version as Update the document, otherwise construct according to the changed file and information
  • the update document For example, if the quantity and size are each smaller than a certain threshold, the partial update; if there is too much file data area to be updated, or the changed file data area size is large, all are updated.
  • the Widget application package includes a file data area, a file directory area, and a file directory end area
  • the version comparison unit of the Widget server traverses the sequence of the two versions of the data area, compares the changes of the data area, and records the updated file.
  • the number and size of the data area used for update mode decision making. Specifically, if the content of the corresponding file data area (ie, the data area representing the same file or directory) is updated, the data area of the file is marked and the size is recorded; if there is a new file data area , then mark the data area and record its size. The result is the number of file data areas where the content has changed, as well as the total size.
  • the version comparison unit of the Widget server includes:
  • the Widget package content extraction module is configured to: generate a data area sequence by using the current version Widget application package and the latest version Widget application package, wherein each file data area content (Data) and the file/directory name (ID) corresponding to the content ) as a node of the sequence of data regions;
  • a version comparison module configured to: compare each node of the latest version with each node of the current version one by one, if the latest version of one node is the same as the current version of one node ID, Data is different, then the latest version of the node The node is marked as updated. If the latest version of a node does not have a corresponding ID in the current version, the node of the latest version is marked as new. If the current version of a node does not have a corresponding ID in the latest version, the current The node of the version is marked for deletion;
  • the (partial) update document constructed by the response body construction unit includes updated file data area information, newly added file data area information, deleted file data area information, and a latest version file directory area and file directory end area.
  • Partially updated documents can use XML or other contracted markup languages.
  • the updated file data area information includes a file/directory name and a file data area content, where the newly added file data area information includes a file/directory name, a location in the current version application package, and a file data area content,
  • the deleted file data area information includes the file/directory name.
  • the present invention further provides a Widget client, where the Widget client includes:
  • a network interaction unit configured to: send an update request to the Widget server, and receive the location a response body sent by the Widget server, where the response body includes an update file, where the update document is constructed by the Widget server according to a comparison result and an update policy of a current version application package of the Widget client and a latest version application package;
  • a widget update unit configured to complete the widget update based on the updated document.
  • the (partial) update document includes updated file data area information, newly added file data area information, deleted file data area information, and a latest version file directory area and a file directory end area, and the updated file data area information includes File/directory name and file data area content, the newly added file data area information includes file/directory name, location in the current version application package, and file data area content, deleted file data area information including file/ Directory name.
  • the response body further includes an update document type indication, configured to indicate that the update document is a total update document or a partial update document; and the widget update unit includes:
  • An update judging module configured to determine an update document type according to an update document type indication;
  • a full update module configured to: replace the current Widget application package with the update document when the update document is all updated documents;
  • a partial update module which is configured to: when the updated document is a partial update document, partially update the current widget application package according to the updated document.
  • the partial update module includes an update document analysis submodule, a widget package content extraction submodule, and a widget package content update submodule, wherein
  • the update document analysis sub-module is configured to: parse the update document, extract the Data and the corresponding ID, and classify and represent the management according to the update, delete, and new mark, and extract the file directory area and the file directory end area content;
  • the Widget package content extraction sub-module is configured to: parse the current version of the application package, identify each file data area content in sequence, and corresponding file/directory name identifiers, and form a compressed package data area management sequence (OrigSeq);
  • the Widget package content update submodule is configured to: delete the file data area marked as deleted in the update document from the OrigSeq sequence; replace the file data area marked as updated in the update document with the corresponding file data area in the OrigSeq sequence; The file data area marked as newly added in the update document is inserted into the OrigSeq sequence according to the specified position; the new version of the file directory area and the file directory end area are replaced with corresponding areas of the OrigSeq sequence to form a new version of the compressed package data area.
  • Management Sequence (NewSeq)
  • the method, system and device of the present invention compare the current version of the Widget client with the latest version of the application package, and generate a targeted update document according to the comparison result and the preset update policy, and then the Widget client performs the Widget update according to the update document. , can effectively provide update efficiency, especially when the number or size of changed files is less, the wireless network resources can be utilized more effectively, the network interaction time of the Widget application update is reduced, and the possible network abnormality is caused to cause the update failure. risks of.
  • the Widget server generates an update document according to the comparison result between the current version application package and the latest version application package, and the Widget client performs Widget update according to the update document, thereby implementing the Widget part. Update and effectively improve update efficiency.

Abstract

The invention relates to a method and system for updating Widget, a Widget client and a Widget server. The method comprises: the Widget client transmits an update request to the Widget server(201); after receiving the update request, the Widget server extracts the application package of the current version of the Widget client and the application package of the latest version and compares the two application packages(202); the Widget server constructs a response body and transmits the response body to the Widget client, wherein the response body comprises an update document constructed according to the comparison result and a preset update policy(203); and the Widget client receives the response body and performs the update according to the update document(204). The invention can realize part of updating and increase the updating efficiency.

Description

Widget更新方法、 系统、 Widget客户端及 Widget服务器  Widget update method, system, Widget client and Widget server
技术领域 Technical field
本发明涉及通信技术, 尤其涉及一种移动终端的 Widget技术。  The present invention relates to communication technologies, and in particular, to a Widget technology for a mobile terminal.
背景技术 Background technique
Widget (微技 )是一种小型的 Web应用程序, 与普通网页一样使用现有 的标准 Web技术开发, 包括 HTML ( HyperText Mark-up Language, 超文本标 记语言) 、 CSS(cading Style Sheet, 级联样式表, 是一组格式设置规则)、 JavaScript (—种客户端脚本语言) 、 XML ( Extensible Markup Language , 可 扩展标记语言 )和 Ajax ( Asynchronous JavaScript and XML, 异步 JavaScript 和 XML )等。 与普通网页的最显著区别就是, 它不依赖于浏览器显示框架, 且被设计为具有特定的功能, 如股票、 天气预报、 时钟、 游戏等。  Widget is a small web application developed using existing standard web technologies like regular web pages, including HTML (HyperText Mark-up Language), CSS (cading Style Sheet), cascading Style sheets, which are a set of formatting rules), JavaScript (a client-side scripting language), XML (Extensible Markup Language), and Ajax (Asynchronous JavaScript and XML, asynchronous JavaScript and XML). The most striking difference from a normal web page is that it does not rely on the browser display framework and is designed to have specific features such as stocks, weather forecasts, clocks, games, and more.
由于 Widget具备小巧轻便、 功能完整、 个性化形式多样等优势, 因此已 被应用到移动终端领域, 增强用户体验, 提供高性价比的服务。 而且 Widget 应用具有另一个特点——可更新性。 即使 Widget应用已经发布, 也允许开发 者不断地完善 Widget应用, 修复之前版本的缺陷, 或添加更多的功能。 用户 则可以下载最新的 Widget应用, 得到最新的、 更合理的体验。  Due to its advantages of small size, light weight, complete functions, and diverse personalization, Widgets have been applied to the field of mobile terminals to enhance the user experience and provide cost-effective services. And the Widget app has another feature - updateability. Even if the Widget app has been released, it allows developers to continually refine the Widget application, fix bugs in previous versions, or add more features. Users can download the latest Widget app to get the latest and more reasonable experience.
发布 Widget应用时, 是将该应用的所有本地文件, 如 javascript脚本或 图片, 遵从 zip (一种文件格式 )标准, 使用 deflate算法(一种计算机文件 的压缩算法)或存储方法打包整合起来,形成一个 zip压缩文件,通常以 .wgt 为后缀名, 如图 1所示。  When the Widget application is published, all local files of the application, such as javascript scripts or images, are compliant with the zip (a file format) standard, and are packaged and integrated using the deflate algorithm (a computer file compression algorithm) or a storage method. A zip file, usually suffixed with .wgt, as shown in Figure 1.
符合 Widget标准定义的 Widget应用 zip包由三部分组成: 文件数据区、 文件目录区和文件目录结束区。 文件数据区表示压缩包内的文件数据, 有多 少个文件和目录就有多少个文件数据区,这也是 zi 压缩包的主体部分, 包含 了所有文件的数据; 每个文件数据区都对应一个文件目录区, 该部分只是记 录了目录名或文件名,以及对应的文件数据区起始位置在整个 zip文件中的偏 移; 文件目录结束区是 zip压缩包的最后一部分, 包含了压缩包内目录、 文件 的数量, 以及文件目录区的尺寸。根据 zip格式内部的关系, 当文件数据区发 生了变化, 则文件目录区和文件目录结束区也会变化, 但后两个区的信息量 小, 其尺寸占整个 zip包的比例非常小, 有时可能都不到 1%。 以图 1为例, 现有名为 weekdays 的 Widget应用压缩包包含 4 个文件数据区, 分别为 index.html、 config.xmK scripts ^ scripts/ dayfinder j s , 同样包含 4个文件目录区 和 1个文件目录结束区。 The Widget application zip package conforming to the Widget standard definition consists of three parts: a file data area, a file directory area, and a file directory end area. The file data area represents the file data in the compressed package. How many files and directories have the file data area? This is also the main part of the zi compression package, which contains the data of all files; each file data area corresponds to one file. Directory area, this part only records the directory name or file name, and the offset of the corresponding file data area starting position in the entire zip file; the file directory end area is the last part of the zip archive, contains the directory inside the compressed package File The number, and the size of the file directory area. According to the internal relationship of the zip format, when the file data area changes, the file directory area and the file directory end area also change, but the information content of the latter two areas is small, and the size of the entire zip package is very small, sometimes It may not be 1%. Taking Figure 1 as an example, the existing Widget application package named weekdays contains 4 file data areas, namely index.html, config.xmK scripts ^ scripts/ dayfinder js , and also contains 4 file directory areas and 1 file directory. End zone.
当 Widget应用包中只有少数文件发生修改时,则只有相应几个文件数据 区发生变化, 其余大部分内容并未改变。 此时, 如果按照传统的 Widget更新 方式, 将 Widget应用包数据全部下载。 这样比较浪费网络资源, 甚至产生额 外的流量费用, 并且数据交互过多又会增加更新失败的风险。 发明内容  When only a few files in the Widget application package are modified, only the corresponding file data areas change, and most of the rest of the content has not changed. At this time, if the traditional Widget update method is used, the Widget application package data is all downloaded. This wastes network resources and even generates additional traffic charges, and excessive data interaction increases the risk of update failure. Summary of the invention
本发明要解决的技术问题是提供一种 Widget 更新方法、 系统、 Widget 客户端及 Widget服务器, 以提高更新效率。  The technical problem to be solved by the present invention is to provide a Widget update method, system, Widget client and Widget server to improve update efficiency.
为解决以上技术问题, 本发明提供了一种微技(Widget ) 更新方法, 该 方法包括:  To solve the above technical problem, the present invention provides a method for updating a widget (Widget), the method comprising:
Widget客户端向 Widget服务器发送更新请求;  The Widget client sends an update request to the Widget server;
所述 Widget服务器接收所述更新请求后, 提取所述 Widget客户端的当 前版本 Widget应用包和最新版本 Widget应用包, 并进行比较;  After receiving the update request, the Widget server extracts the current version of the Widget application package and the latest version of the Widget application package of the Widget client, and compares them;
所述 Widget服务器构造响应体并发送给所述 Widget客户端, 所述响应 体包括根据比较结果及预置的更新策略构造的更新文档; 以及  The widget server constructs a response body and sends the response body to the Widget client, the response body including an update document constructed according to the comparison result and a preset update policy;
所述 Widget客户端接收所述响应体, 并根据所述更新文档进行更新。 所述 Widget客户端发送的更新请求中携带当前 Widget版本号, 所述 Widget服务器根据所述当前 Widget版本号获取所述当前版本 Widget应用包。  The widget client receives the response body and updates according to the update document. The update request sent by the Widget client carries the current Widget version number, and the Widget server obtains the current version Widget application package according to the current Widget version number.
该方法还包括: 所述 Widget服务器发送所述响应体时, 更新所述 Widget 客户端与 Widget版本号的对应关系; 提取所述 Widget客户端的当前版本 Widget应用包的步骤包括: 所述 Widget服务器根据所述 Widget客户端与 Widget版本号的对应关系获取所述当前版本 Widget应用包。 所述更新策略为: 根据发生变化的文件和信息构造所述更新文档; 或者, 判断发生变化的文件的数量和 /或大小是否超过预设阔值, 如果超过, 则 将最新版本的全部文件作为更新文档, 若未超过则根据发生变化的文件和信 息构造所述更新文档。 The method further includes: updating the correspondence between the Widget client and the Widget version number when the Widget server sends the response body; the step of extracting the current version Widget application package of the Widget client includes: the Widget server according to the The mapping between the Widget client and the Widget version number obtains the current version Widget application package. The updating policy is: constructing the updated document according to the changed file and information; or determining whether the number and/or size of the changed file exceeds a preset threshold, and if so, using all files of the latest version as Update the document, if not exceeded, construct the updated document based on the changed files and information.
每个 Widget应用包包括文件数据区、 文件目录区和文件目录结束区; 将 所述 Widget客户端的当前版本 Widget应用包与最新版本 Widget应用包进行 比较的步骤包括:  Each Widget application package includes a file data area, a file directory area, and a file directory end area; the steps of comparing the current version of the widget client's Widget application package with the latest version of the Widget application package include:
解析当前版本 Widget应用包和最新版本 Widget应用包;  Parse the current version of the Widget application package and the latest version of the Widget application package;
用当前版本 Widget应用包和最新版本 Widget应用包分别生成第一数据 区序列和第二数据区序列, 每个数据区序列中每个文件数据区的内容(Data ) 及该内容对应的文件 /目录名 (ID )为该数据区序列的一个节点; 以及  The first data area sequence and the second data area sequence are respectively generated by using the current version Widget application package and the latest version Widget application package, and the content (Data) of each file data area in each data area sequence and the file/directory corresponding to the content The name (ID) is a node of the sequence of the data area;
将第二数据区序列的每个节点与第一数据区序列的所有节点逐一进行比 较, 对所述第二数据区序列中的一个节点: 如果在第一数据区中存在与该节 点 ID相同但 Data不同的节点, 则将该节点标记为更新; 如果在第一数据区 中不存在与该节点 ID相同的节点, 则将该节点标记为新增; 对所述第一数据 区中的一个节点: 如果在第二数据区中不存在与该节点 ID相同的节点, 则将 该节点标记为删除;  Comparing each node of the second data region sequence with all nodes of the first data region sequence one by one, for one node in the second data region sequence: if there is the same in the first data region as the node ID but If the node is different, the node is marked as updated; if there is no node in the first data area that is the same as the node ID, the node is marked as new; for a node in the first data area : if there is no node with the same node ID in the second data area, the node is marked as deleted;
所述更新文档包括更新的文件数据区信息、 新增的文件数据区信息、 删 除的文件数据区信息以及最新版本的文件目录区和文件目录结束区。  The update file includes updated file data area information, newly added file data area information, deleted file data area information, and a file directory area and a file directory end area of the latest version.
所述更新的文件数据区信息包括 ID以及 Data,所述新增的文件数据区信 息包括 ID、 在当前版本 Widget应用包中的位置以及 Data, 所述删除的文件 数据区信息包括 ID。  The updated file data area information includes an ID and a data, the added file data area information includes an ID, a location in a current version of the Widget application package, and Data, and the deleted file data area information includes an ID.
所述响应体还包括更新文档类型指示, 用于指示该更新文档为全部更新 文档或部分更新文档; 根据所述更新文档进行更新的步骤包括: 所述 Widget 客户端根据所述更新文档类型指示判断更新文档类型; 更新文档为全部更新 文档时, 所述 Widget客户端将更新文档替代当前版本 Widget应用包; 更新 文档为部分更新文档时,所述 Widget客户端根据更新文档对当前版本 Widget 应用包进行部分更新。 所述 Widget客户端根据所述更新文档对当前版本 Widget应用包进行部 分更新的步骤包括: The response body further includes an update document type indication, configured to indicate that the update document is a total update document or a partial update document; and the updating according to the update document comprises: the Widget client determining, according to the updated document type indication Update the document type; when the update document is all updated documents, the Widget client will update the document to replace the current version of the Widget application package; when the update document is a partial update document, the Widget client performs the current version of the Widget application package according to the updated document. Partially updated. The step of the Widget client partially updating the current version Widget application package according to the update document includes:
解析所述更新文档, 提取其中的 Data和该 Data对应的 ID , 且按更新、 删除、新增标记进行分类表示管理, 同时提取文件目录区和文件目录结束区。  Parsing the updated document, extracting the Data and the ID corresponding to the Data, and classifying and representing the management by updating, deleting, and adding a mark, and extracting the file directory area and the file directory end area at the same time.
解析当前版本 Widget应用包, 按顺序识别出每个文件数据区, 及该数据 区对应的 ID, 形成压缩包数据区管理序列 (OrigSeq ) ;  Parsing the current version of the Widget application package, identifying each file data area in sequence, and the ID corresponding to the data area, forming a compressed packet data area management sequence (OrigSeq);
将所述更新文档中标记为删除的文件数据区从 OrigSeq序列中删除; 将 所述更新文档中标记为更新的文件数据区替换 OrigSeq序列中被更新的文件 数据区; 将所述更新文档中标记为新增的文件数据区按照指定位置插入到 OrigSeq序列中;将从所述更新文档中提取的文件目录区和文件目录结束区替 换 OrigSeq序列的文件目录区和文件目录结束区, 形成一个新版本的压缩包 数据区管理序列 (NewSeq ) 。  Deleting the file data area marked as deleted in the update document from the OrigSeq sequence; replacing the updated file data area in the updated document with the file data area in the OrigSeq sequence; marking the updated document Inserting the newly added file data area into the OrigSeq sequence according to the specified location; replacing the file directory area and the file directory end area extracted from the updated document with the file directory area and the file directory end area of the OrigSeq sequence to form a new version Compressed packet data area management sequence (NewSeq).
为解决以上技术问题, 本发明还提供了一种微技(Widget )服务器, 所 述 Widget服务器包括:  To solve the above technical problem, the present invention further provides a Widget server, the Widget server comprising:
网络交互单元, 其设置成: 接收 Widget客户端发送的更新请求, 以及向 所述 Widget客户端发送响应体, 所述响应体包括更新文档;  a network interaction unit, configured to: receive an update request sent by the Widget client, and send a response body to the Widget client, where the response body includes an update document;
Widget应用包数据库, 其设置成存储各版本 Widget应用包;  a Widget application package database, which is configured to store each version of the Widget application package;
版本比较单元, 其设置成将所述 Widget客户端的当前版本 Widget应用 包与最新版本 Widget应用包进行比较; 以及  a version comparison unit configured to compare a current version of the Widget client package with a latest version of the Widget application package;
响应体构造单元, 其设置成根据所述版本比较单元的比较结果及预置的 更新策略, 构造所述更新文档, 以及构造响应体。  The response body construction unit is configured to construct the update document and construct the response body according to the comparison result of the version comparison unit and the preset update policy.
为解决以上技术问题, 本发明还提供了一种微技(Widget )客户端, 所 述 Widget客户端包括:  To solve the above technical problem, the present invention further provides a Widget client, where the Widget client includes:
网络交互单元, 其设置成: 向 Widget服务器发送更新请求, 以及接收所 述 Widget服务器发送的响应体, 所述响应体包括更新文档, 所述更新文档是 所述 Widget服务器根据所述 Widget客户端的当前版本 Widget应用包与最新 版本 Widget应用包的比较结果和更新策略构造的; 以及  a network interaction unit, configured to: send an update request to the Widget server, and receive a response body sent by the Widget server, where the response body includes an update document, where the update document is the Widget server according to the current current of the Widget client The version of the Widget application package is compared with the latest version of the Widget application package and the update strategy is constructed;
Widget更新单元, 其设置成根据所述更新文档完成 Widget更新。 本发明技术中, Widget服务器根据当前版本应用包与最新版本应用包的 比较结果生成更新文档, Widget客户端根据该更新文档进行 Widget更新,从 而可实现 Widget的部分更新, 并有效提高更新效率。 附图概述 A widget update unit configured to complete the widget update based on the updated document. In the technology of the present invention, the Widget server generates an update document according to the comparison result between the current version application package and the latest version application package, and the Widget client performs the Widget update according to the update document, thereby implementing partial update of the Widget and effectively improving the update efficiency. BRIEF abstract
图 1是 Widget应用的 zip包格式;  Figure 1 is the zip package format of the Widget application;
图 2是本发明 Widget更新方法的示意图;  2 is a schematic diagram of a method for updating a Widget of the present invention;
图 3是本发明实施例 Widget服务器实现更新的流程图;  3 is a flowchart of implementing an update of a Widget server according to an embodiment of the present invention;
图 4是本发明实施例 Widget客户端完成更新的流程图;  4 is a flowchart of a Widget client completing an update according to an embodiment of the present invention;
图 5是本发明 Widget服务器版本内容比较判定算法流程图;  5 is a flowchart of a method for judging content comparison content of a Widget server according to the present invention;
图 6是本发明 Widget更新系统的示意图;  6 is a schematic diagram of a Widget update system of the present invention;
图 7是 Widget服务器的版本比较单元的模块结构示意图;  7 is a block diagram showing a module structure of a version comparison unit of a Widget server;
图 8是 Widget客户端的 Widget更新单元的模块结构示意图;  8 is a block diagram showing a module structure of a Widget update unit of a Widget client;
图 9是部分更新模块的模块结构示意图。 本发明的较佳实施方式  Figure 9 is a block diagram showing the structure of a partial update module. Preferred embodiment of the invention
本发明技术中, Widget服务器根据当前版本应用包与最新版本应用包的 比较结果生成更新文档, Widget客户端根据该更新文档进行 Widget更新,从 而可实现 Widget的部分更新。  In the technology of the present invention, the Widget server generates an update document according to the comparison result between the current version application package and the latest version application package, and the Widget client performs Widget update according to the update document, thereby implementing partial update of the Widget.
如图 2所示, 本发明 Widget更新方法包括:  As shown in FIG. 2, the Widget update method of the present invention includes:
步骤 201 : 微技 ( Widget )客户端向 Widget服务器发送更新请求; 步骤 202: 所述 Widget服务器接收所述更新请求后, 提取所述 Widget 客户端的当前版本应用包与最新版本应用包, 并进行比较;  Step 201: The Widget client sends an update request to the Widget server. Step 202: After receiving the update request, the Widget server extracts the current version application package of the Widget client and the latest version application package, and compares ;
Widget服务器包括但不限于以下两种方式获得 Widget客户端当前版本 应用包:  The Widget server includes but is not limited to the following two ways to obtain the current version of the Widget client application package:
方式一: 所述 Widget客户端发送的更新请求中携带 Widget当前版本号, 所述 Widget服务器根据所述 Widget当前版本号获取所述当前版本应用包。 如果该 Widget服务器可提供多个 Widget的应用包, 则该更新请求还应 该携带相应的 Widget标识或名称, 以与版本号一起唯一的确定一个 Widget 应用包。 Manner 1: The update request sent by the Widget client carries the current version number of the Widget, and the Widget server obtains the current version application package according to the current version number of the Widget. If the Widget server can provide multiple Widget application packages, the update request should also carry the corresponding Widget ID or name to uniquely identify a Widget application package along with the version number.
方式二: 所述 Widget服务器发送所述响应体时, 更新所述 Widget客户 端和 Widget版本号的对应关系, 所述 Widget服务器接收所述更新请求时, 根据所述 widget客户端及其对应关系获取所述当前版本应用包。  Manner 2: When the Widget server sends the response body, the corresponding relationship between the Widget client and the Widget version number is updated, and when the Widget server receives the update request, the Widget server obtains the update request according to the widget client and its corresponding relationship. The current version of the application package.
所述 Widget应用包包括文件数据区、 文件目录区和文件目录结束区, 将 所述 Widget客户端的当前版本应用包与最新版本应用包进行比较包括:  The Widget application package includes a file data area, a file directory area, and a file directory end area, and comparing the current version application package of the Widget client with the latest version application package includes:
al.解析当前版本应用包和最新版本应用包;  Al. Parsing the current version of the application package and the latest version of the application package;
bl.将当前版本和最新版本分别生成一个数据区序列, 其中每个文件数据 区内容(Data )及其对应的文件 /目录名 (ID )作为数据区序列的一个节点; cl.将最新版本的每个节点与当前版本的每个节点逐一进行比较, 如果最 新版本的一节点与当前版本的一节点 ID相同、 Data不同,则将最新版本的该 节点标记为更新, 如果最新版本的一节点在当前版本中没有对应的 ID, 则将 最新版本的该节点标记为新增, 如果当前版本的一节点在最新版本没有对应 的 ID, 则将当前版本的该节点标记为删除。  Bl. respectively generate a data area sequence for the current version and the latest version, wherein each file data area content (Data) and its corresponding file/directory name (ID) are used as a node of the data area sequence; cl. will be the latest version Each node is compared with each node of the current version one by one. If the latest version of a node is the same as the current version of a node ID and Data is different, the latest version of the node is marked as an update, if the latest version of a node is If there is no corresponding ID in the current version, the node of the latest version is marked as new. If a node of the current version does not have a corresponding ID in the latest version, the node of the current version is marked as deleted.
步骤 203: 所述 Widget服务器构造响应体并发送给所述 Widget客户端, 所述响应体中包括根据比较结果及预置的更新策略构造的更新文档;  Step 203: The Widget server constructs a response body and sends the response body to the Widget client, where the response body includes an update document constructed according to the comparison result and a preset update policy.
具体的更新策略可以灵活设置, 包括但不限于以下策略:  Specific update policies can be flexibly set, including but not limited to the following strategies:
策略一: 根据发生变化的文件和信息构造所述更新文档;  Strategy 1: constructing the updated document according to the changed file and information;
策略二: 判断发生变化的文件的数量和 /或大小是否超过预设阔值, 如果 超过, 则将最新版本的全部文件作为更新文档, 若未超过则根据发生变化的 文件和信息构造所述更新文档。 优选地, 釆用第二种策略。  Strategy 2: Determine whether the number and/or size of the changed files exceeds a preset threshold. If it exceeds, all the files of the latest version are used as the updated document. If not, the update is constructed according to the changed files and information. Documentation. Preferably, the second strategy is employed.
本发明中也将根据发生变化的文件和信息构造的更新文档称为部分更新 文档, 将根据最新版本全部文件构造的更新文档称为全部更新文档。  In the present invention, an updated document constructed based on a changed file and information is also referred to as a partial update document, and an updated document constructed based on the latest version of all files is referred to as a full update document.
步骤 204: 所述 Widget客户端接收所述响应体, 并根据所述更新文档进 行更新。  Step 204: The Widget client receives the response body and updates according to the update document.
所述(部分) 更新文档包括更新的文件数据区信息、 新增的文件数据区 信息、 删除的文件数据区信息以及最新版本文件目录区和文件目录结束区, 具体地: The (partial) update document includes updated file data area information, and a new file data area. Information, deleted file data area information, and the latest version of the file directory area and file directory end area, specifically:
所述更新的文件数据区信息包括文件 /目录名以及文件数据区内容, 所述 新增的文件数据区信息包括文件 /目录名、 在当前版本应用包中的位置以及文 件数据区内容, 所述删除的文件数据区信息包括文件 /目录名。  The updated file data area information includes a file/directory name and a file data area content, where the newly added file data area information includes a file/directory name, a location in a current version application package, and a file data area content, The deleted file data area information includes the file/directory name.
若更新策略釆用策略二, 则所述响应体还包括更新文档类型指示, 用于 指示该更新文档为全部更新文档或部分更新文档; 所述 Widget客户端 4艮据所 述更新文档类型指示判断更新文档类型; 更新文档为全部更新文档时, 所述 Widget客户端将更新文档替代当前 Widget应用包;更新文档为部分更新文档 时, 所述 Widget客户端根据更新文档对当前 Widget应用包进行部分更新。 If the update policy uses the policy 2, the response body further includes an update document type indication, configured to indicate that the update document is a full update document or a partial update document; and the Widget client 4 determines according to the updated document type indication. Update the document type; when the update document is all updated documents, the Widget client will update the document to replace the current Widget application package; when the update document is a partial update document, the Widget client partially updates the current Widget application package according to the updated document. .
若更新文档是根据发生变化的文件和信息构造而成,则所述 Widget客户 端根据所述更新文档进行更新包括:  If the update document is constructed according to the changed file and information, the update of the Widget client according to the update document includes:
a2.解析所述更新文档, 提取其中的 Data和对应的 ID, 且按更新、 删除、 新增标记进行分类表示管理, 同时提取文件目录区和文件目录结束区内容。  A2. Parse the updated document, extract the Data and the corresponding ID, and classify and represent the management according to the update, delete, and new tags, and extract the file directory area and the file directory end area content.
b2.解析当前版本应用包, 按顺序识别出每个 Data, 及其对应的 ID, 形 成压缩包数据区管理序列 (OrigSeq ) ;  B2. Parsing the current version of the application package, identifying each Data and its corresponding ID in order, forming a compressed packet data area management sequence (OrigSeq);
c2.将所述更新文档中标记为删除的文件数据区从 OrigSeq序列中删除; 将所述更新文档中标记为更新的文件数据区替换 OrigSeq序列中对应的文件 数据区; 将所述更新文档中标记为新增的文件数据区按照指定位置插入到 OrigSeq序列中; 将新版本的文件目录区和文件目录结束区替换 OrigSeq序列 的相应区域, 形成一个新版本的压缩包数据区管理序列 (NewSeq ) 。  C2. deleting the file data area marked as deleted in the update document from the OrigSeq sequence; replacing the file data area marked as updated in the update document with the corresponding file data area in the OrigSeq sequence; The newly added file data area is inserted into the OrigSeq sequence according to the specified position; the new version of the file directory area and the file directory end area are replaced with the corresponding areas of the OrigSeq sequence to form a new version of the compressed package data area management sequence (NewSeq). .
实施例一 Embodiment 1
本发明 Widget更新方法包括:  The Widget update method of the present invention includes:
A. Widget客户端发送携带当前 Widget应用版本号 ( VI ) , 和 Widget 应用 URI ( Uniform Resource Identifier, 通用资源标志符) 的更新网络请 求给相应的 Widget服务器; B. Widget服务器接收到网络请求后, 执行策略判断——从本地服务器 中取出 VI版本的 Widget应用包, 和最新版本的 Widget应用包进行比较;A. The Widget client sends an update network request carrying the current Widget application version number (VI) and the Widget application URI (Uniform Resource Identifier) to the corresponding Widget server; B. After receiving the network request, the Widget server performs policy judgment—taking the VI version of the Widget application package from the local server and comparing it with the latest version of the Widget application package;
C. Widget服务器构造并返回响应体; C. The Widget server constructs and returns a response body;
如果新版本 Widget应用包中发生变化的文件数量比较多(如超过设定阔 值), 或者发生变化的文件总尺寸占 Widget应用包比例艮大(如超过设定阔 值 ) , 则直接将新版本的 Widget应用包作为 A步骤的响应体返回给 Widget 客户端;  If there are more files in the new version of the Widget application package (such as exceeding the set threshold), or if the total size of the changed file is larger than the Widget application package (such as exceeding the set threshold), then directly The version of the Widget application package is returned to the Widget client as a response body of the A step;
如果只有少数文件发生了更改, 且尺寸比例较小, 服务器则构造一个部 分更新文档, 其中包含了更新的文件数据区信息、 新增的文件数据区信息、 删除的文件数据区信息和文件目录区、 文件目录结束区。 将该文档作为 A步 骤的响应体返回给 Widget客户端;  If only a few files have been changed and the size ratio is small, the server constructs a partial update document containing updated file data area information, new file data area information, deleted file data area information, and file directory area. , the end of the file directory. Return the document as a response body of step A to the Widget client;
D. Widget客户端收到服务器的响应体后, 完成更新。  D. After the Widget client receives the response body of the server, it completes the update.
如果响应体中为 Widget应用包, 则 Widget客户端将其全部接收, 替换 旧版本 Widget应用包;  If the response body is a Widget application package, the Widget client receives all of them, replacing the old Widget application package;
如果响应体中是部分更新文档格式,则 Widget客户端解析读取文档中的 文件数据区信息, 替换当前版本中对应的文件数据区, 或删除指定数据区, 或插入新增的文件数据区到指定位置。 最后用文档中的文件目录区和文件目 录结束区替换当前版本的相应部分, 完成 Widget应用包的更新流程。  If the response body is partially updated in the document format, the Widget client parses the file data area information in the read document, replaces the corresponding file data area in the current version, or deletes the specified data area, or inserts the newly added file data area to Specify the location. Finally, replace the corresponding part of the current version with the file directory area and the file end area in the document to complete the update process of the Widget application package.
实施例二 Embodiment 2
从 Widget服务器角度描述,本发明 Widget更新方法包括:微技( Widget ) 服务器接收 Widget客户端发送的更新请求后, 提取所述 Widget客户端的当 前版本应用包与最新版本应用包, 并进行比较; 所述 Widget服务器构造响应 体并发送给所述 Widget客户端, 所述响应体包括根据比较结果及预置的更新 策略构造的更新文档。  According to the Widget server, the Widget update method includes: after receiving the update request sent by the Widget client, the Widget server extracts the current version application package of the Widget client and the latest version application package, and compares the same; The Widget server constructs a response body and sends the response body to the Widget client, and the response body includes an update document constructed according to the comparison result and a preset update policy.
更新策略可为前述策略一或策略二, 优选地, 该实施例釆用策略二, 下 面将结合附图及实施例对本发明 Widget服务器的处理流程进行更详细的说 明,其中更新策略中,设置发生变化的文件的数量比例阔值 T1和大小比例阔 值 T2分别为 60%和 70%。 The update policy may be the foregoing policy one or the second one. Preferably, the embodiment uses the second strategy. The processing flow of the Widget server of the present invention will be described in more detail below with reference to the accompanying drawings and embodiments. The number of changed files is proportional to the width T1 and the size ratio is wide. The value T2 is 60% and 70%, respectively.
如图 3所示, Widget服务器实现更新的方法包括:  As shown in FIG. 3, the method for implementing update of the Widget server includes:
301. Widget服务器接收到 Widget客户端发送的更新请求,解析出 Widget 应用名和当前应用版本号;  301. The Widget server receives the update request sent by the Widget client, and parses out the Widget application name and the current application version number;
302. Widget服务器从存储 Widget应用的数据库中读取指定版本号和名 称的 Widget应用包, 以及最新版本的 Widget应用包;  302. The Widget server reads the Widget application package with the specified version number and name from the database storing the Widget application, and the latest version of the Widget application package;
303. Widget服务器根据 zi 压缩文件标准, 解析当前版本 Widget应用包 和最新版本 Widget应用包, 按顺序将每个文件数据区内容( data )和对应的 文件名或目录名信息 (id )构造一个节点加入到序列结构中, 生成两个数据 区序列, 当前版本应用包的数据区序列为 Seql , 最新版本应用包的数据区序 列为 Seq2;  303. The Widget server parses the current version of the Widget application package and the latest version of the Widget application package according to the zi compression file standard, and constructs a node for each file data area content (data) and corresponding file name or directory name information (id) in order. Adding to the sequence structure, generating two data area sequences, the data area sequence of the current version application package is Seql, and the data area sequence of the latest version application package is Seq2;
304. Widget服务器按顺序读取 Seq2的每个节点,根据内容比较判定算法 (参考图 5 ) , 与 Seql序列中的节点比较, 如果有同文件名或目录名 (即 id 相同) 的数据区, 则继续判断其数据区内容 data是否相同, 若内容不同, 表 示该数据区发生更新, 将 Seq2的该节点标记为更新; 如果没有相同 id的数 据区, 则该数据区为新增的, 将 Seq2的该节点标记为新增; 当遍历 Seql中 的节点, 发现一节点的 id并未与 Seq2中某节点 id—致, 则将 Seql中的该节 点标记为删除。  304. The Widget server reads each node of Seq2 in order, according to the content comparison decision algorithm (refer to FIG. 5), and compares with the nodes in the Seql sequence, if there is a data area with the same file name or directory name (ie, the same id), Then, it is determined whether the content data of the data area is the same. If the content is different, it indicates that the data area is updated, and the node of Seq2 is marked as updated; if there is no data area with the same id, the data area is added, and Seq2 is added. The node is marked as new; when traversing the node in Seql and finding that the id of a node does not match the node id in Seq2, the node in Seql is marked as deleted.
305. Widget服务器进行更新策略判断。遍历 Seq2序列,得到待更新和新 增文件数据区的数量和总大小,如果发生变化的数据区数量过多,超过了 T1 , 或者总大小占整个 Widget应用包的比例较大, 超过了 T2, 则不适合部分更 新, 执行全部更新策略, 转到 306'步骤, 如果发生变化的数据区数量和总大 小均小于相应阔值, 则执行部分更新策略, 转到 306步骤;  305. The Widget server performs an update policy judgment. Traversing the Seq2 sequence to obtain the number and total size of the data area to be updated and added. If the number of data areas that have changed is too large, it exceeds T1, or the total size accounts for a larger proportion of the entire Widget application package, exceeding T2. Then it is not suitable for partial update, execute all update policies, go to step 306', if the number of changed data areas and the total size are smaller than the corresponding threshold, execute the partial update policy, and go to step 306;
306. Widget服务器构造部分更新文档。 以 XML标记语言为例。 该文档 中应包含更新的文件数据区信息、 新增的文件数据区信息、 删除的文件数据 区信息, 以及新版本文件目录区和文件目录结束区。  306. The Widget Server Configuration section updates the documentation. Take the XML markup language as an example. The document should contain updated file data area information, new file data area information, deleted file data area information, and a new version of the file directory area and file directory end area.
对于每个更新的文件数据区, 由一个 <updateEntry></updateEntry>元素表 示。 至少包含如下属性: ID表示该数据区对应的文件 /目录名, length表示该 数据区的大小。 开标签 < updateEntry >与闭标签 </ updateEntry >之间的内容为 更新后的文件数据区, 其长度与 length属性值一致, 且可以为 0。 For each updated file data area, it is represented by an <updateEntry></updateEntry> element. At least the following attributes are included: ID indicates the file/directory name corresponding to the data area, and length indicates the The size of the data area. The content between the open tag < updateEntry > and the closed tag </ updateEntry > is the updated file data area, and its length is consistent with the value of the length attribute, and can be 0.
对于每个删除的文件数据区, 由一个 <(161£1^1 ></(161£1^1 >元素表示。 至 少包含如下属性: ID表示该数据区对应的文件 /目录名。  For each deleted file data area, it is represented by a <(161£1^1></(161£1^1> element. At least the following attributes are included: ID indicates the file/directory name corresponding to the data area.
对于每个新增的文件数据区, 由一个 <newEntry></newEntry>元素表示。 至少包含如下属性: ID表示该数据区对应的文件名或目录名, position表示 该数据区应被插入的位置, length表示该数据区的大小。 开标签 <newEntry> 与闭标签 </newEntry>之间的内容为新增的文件数据区, 其长度与 length属性 值一致, 且可以为 0。  For each new file data area, it is represented by a <newEntry></newEntry> element. It includes at least the following attributes: ID indicates the file name or directory name corresponding to the data area, position indicates the position where the data area should be inserted, and length indicates the size of the data area. The content between the open tag <newEntry> and the closed tag </newEntry> is a new file data area whose length is consistent with the length attribute value and can be 0.
对于文件目录区和文件目录结束区, 由 11(1£1^1 >< 11(1£1^1 >元素表示, 至少包含如下属性: length表示该数据区的大小。 开标签 < endEntry >与闭标 签</ endEntry >之间的内容为新版本文件目录区和文件目录结束区正文,其长 度与 length属性值一致。  For the file directory area and the file directory end area, represented by 11 (1£1^1 >< 11 (1£1^1> elements, at least the following attributes: length indicates the size of the data area. Open label < endEntry > and The content between the closed tags </ endEntry > is the new version of the file directory area and the file directory end area body, and its length is consistent with the length attribute value.
由此, 就构成了一个以 XML结构表示的部分更新文档。 以图 1为例, 若 部分更新文档为如下形式:  Thus, a partial update document represented by an XML structure is constructed. Take Figure 1 as an example, if the partial update document is of the form:
<updateDescription>  <updateDescription>
<updateEntry ID="config.xml" length="400">config.xml 正 文 数 据 </updateEntry>  <updateEntry ID="config.xml" length="400">config.xml body data </updateEntry>
<updateEntry ID="index.html" length="1200"> index.html 正文数据 </updateEntry>  <updateEntry ID="index.html" length="1200"> index.html body data </updateEntry>
<delEntry ID="scripts/ dayfinder.j s"></ delEntry>  <delEntry ID="scripts/ dayfinder.j s"></ delEntry>
<newEntry ID="sciripts/daySearch.js" position="3" length="600"> daySearch.js正文数 </ηε νΕη1τγ>  <newEntry ID="sciripts/daySearch.js" position="3" length="600"> number of daysSearch.js text </ηε νΕη1τγ>
<endEntry length="100"> </endEntry>  <endEntry length="100"> </endEntry>
</updateDescription >  </updateDescription >
则表示, 有两个需要更新的文件数据区, 一个删除的文件数据区, 和一 个新增的文件数据区, 它应被插在第三个文件数据区之后。 306'. Widget服务器执行全部更新策略。 服务器从存储 Widget应用的数 据库中读取指定最新版本的 Widget应用包, 将它作为更新文档。 It means that there are two file data areas to be updated, a deleted file data area, and a new file data area, which should be inserted after the third file data area. 306'. The Widget server performs a full update policy. The server reads the latest version of the Widget application package from the database storing the Widget application and uses it as an update document.
307. Widget服务器构造 Widget客户端更新请求的响应体,按照具体的应 用层协议封装, 若为部分更新, 则将部分更新文档作为响应体正文, 并指示 相应的 MIME ( Multipurpose Internet Mail Extensions , 多功能网络邮件扩展 ) 类型, 对于 XML文档, 则 MIME类型为 application/xml, 表示 XML类型的 应用, 若为全部更新, 则将最新版本的 Widget应用包直接作为更新请求响应 体的正文,并指定 MIME类型为 application/Widget,表示 Widget类型的应用; 307. The Widget server constructs a response body of the Widget client update request, which is encapsulated according to a specific application layer protocol. If it is a partial update, the partial update document is used as a response body text, and the corresponding MIME (Multipurpose Internet Mail Extensions) is indicated. Web mail extension) type, for XML documents, the MIME type is application/xml, which means the application of XML type. If it is all updates, the latest version of the Widget application package is directly used as the body of the update request response body, and the MIME type is specified. Application/Widget, which means the application of the Widget type;
308. Widget服务器将封装后的响应体通过网络发送给 Widget客户端,完 成 Widget服务器侧的更新流程。 308. The Widget server sends the encapsulated response body to the Widget client through the network to complete the update process on the Widget server side.
实施例三 Embodiment 3
从 Widget客户端的角度描述, 本发明 Widget 更新方法包括: 微技 ( Widget )客户端向 Widget服务器发送更新请求; 所述 Widget客户端接收 Widget服务器发送的响应体, 所述响应体包括更新文档, 所述更新文档是所 述 Widget服务器根据所述 Widget客户端的当前版本应用包与最新版本应用 包的比较结果和更新策略构造的; 所述 Widget客户端根据所述更新文档进行 更新。  The method for updating the Widget of the present invention includes: a Widget client sends an update request to the Widget server; the Widget client receives a response body sent by the Widget server, and the response body includes an update document. The update document is constructed by the Widget server according to a comparison result and an update policy of a current version application package of the Widget client and a latest version application package; and the Widget client updates according to the update document.
下面将结合附图及实施例对本发明 Widget客户端的处理流程进行更详细 的说明, 如图 4所示, 实施例中 Widget客户端进行更新的流程包括:  The processing flow of the Widget client of the present invention will be described in more detail below with reference to the accompanying drawings and embodiments. As shown in FIG. 4, the process of updating the Widget client in the embodiment includes:
401. Widget客户端接收到 Widget服务器对更新请求的响应体,解析得到 MIME类型和正文数据;  401. The Widget client receives the response body of the Widget server to the update request, and parses the MIME type and the body data;
402. 更新类型判断;  402. Update type judgment;
判断依据是 MIME类型, 如果 MIME类型是 application/Widget, 则表示 全部更新, 正文数据为新版本 Widget应用包, 直接用其替换当前版本 Widget 应用包, 执行 409' ; 如果 MIME类型是 application/xml, 则表示部分更新, 正 文数据是部分更新文档, 继续执行 403。  The judgment is based on the MIME type. If the MIME type is application/Widget, it means that all updates, the body data is the new version of the Widget application package, and directly replaces the current version of the Widget application package, and executes 409'; if the MIME type is application/xml, It means that the partial update, the body data is a partial update document, and the execution continues to 403.
403. 解析部分更新文档。 解析所述更新文档, 提取其中的 Data和对应的 ID, 且按更新、 删除、 新 增标记进行分类表示管理, 同时提取文件目录区和文件目录结束区内容: 构造一个更新数据区节点序列 (updateSeq ) , 为每个 <updateEntry>生成 一个节点, 以 ID属性值作为节点标识, 并保存该元素的数据区内容; 构造一 个删除数据区节点序列 (delSeq ) , 为每个 < delEntry >构造一个节点, 以 ID 属性值作为节点标识。 构造一个新增数据区节点序列 (newSeq ) , 为每个 < newSeq >构造一个节点, 以 ID属性值作为节点标识, 并保存 position属性值 和数据区内容; 最后将文档中的 11(1£1^1 >元素内容(文件目录区和文件目 录结束区)保存到緩冲区 (bufferl ) 中。 403. Parse the partial update document. Parsing the updated document, extracting the Data and the corresponding ID, and classifying and representing the management according to the update, delete, and newly added tags, and extracting the file directory area and the file directory end area content: constructing an update data area node sequence (updateSeq) ), for each <updateEntry> to generate a node, with the ID attribute value as the node identifier, and save the data area content of the element; construct a delete data area node sequence (delSeq), construct a node for each <delEntry>, The ID attribute value is used as the node identifier. Construct a new data area node sequence (newSeq), construct a node for each <newSeq>, use the ID attribute value as the node identifier, and save the position attribute value and the data area content; finally, 11 (1£1) in the document The ^1> element content (file directory area and file directory end area) is saved to the buffer (bufferl).
404. 解析当前版本 Widget应用包;  404. Parsing the current version of the Widget application package;
按顺序识别出每个文件数据区内容, 及其对应的文件 /目录名, 形成压缩 包数据区管理序列 (OrigSeq ) , 具体地, 遵从 zip格式标准, 将每个文件数 据区内容提取出来构成节点, 以该数据区所代表的文件名或目录名作为节点 标识, 形成一个文件数据区序列 (OrigSeq ) , 序列的最后一个节点保存了文 件目录区和文件目录结束区内容。  Identifying the contents of each file data area and its corresponding file/directory name in sequence, forming a compressed packet data area management sequence (OrigSeq), specifically, following the zip format standard, extracting the contents of each file data area to form a node The file name or directory name represented by the data area is used as a node identifier to form a file data area sequence (OrigSeq), and the last node of the sequence saves the file directory area and the file directory end area content.
将所述更新文档中标记为删除的文件数据区从 OrigSeq序列中删除; 将 所述更新文档中标记为更新的文件数据区替换 OrigSeq序列中对应的文件数 据区; 将所述更新文档中标记为新增的文件数据区按照指定位置插入到 OrigSeq序列中; 将新版本的文件目录区和文件目录结束区替换 OrigSeq序列 的相应区域, 形成一个新版本的压缩包数据区管理序列 (NewSeq )。 即执行 以下步骤 405至 408;  Deleting the file data area marked as deleted in the update document from the OrigSeq sequence; replacing the file data area marked as updated in the update document with the corresponding file data area in the OrigSeq sequence; marking the update document as The newly added file data area is inserted into the OrigSeq sequence according to the specified position; the new version of the file directory area and the file directory end area are replaced with the corresponding areas of the OrigSeq sequence to form a new version of the compressed package data area management sequence (NewSeq). That is, the following steps 405 to 408 are performed;
405. 遍历删除数据区节点序列 delSeq, 完成删除操作;  405. Traversing the deleted data area node sequence delSeq to complete the deletion operation;
依次根据每个节点的 ID 标识值, 在当前 Widget应用文件数据区序列 OrigSeq中找到对应的节点, 将该节点删除;  The corresponding node is found in the current Widget application file data area sequence OrigSeq according to the ID identification value of each node, and the node is deleted;
406. 遍历更新数据区节点序列 updateSeq, 完成对应节点的内容更新操 作;  406. Traverse the update data area node sequence updateSeq to complete the content update operation of the corresponding node;
具体地, 根据每个节点 (Node2 ) 的 ID标识值, 在 OrigSeq序列中找到 对应的节点 (Nodel ) , 将 Node2节点的文件数据区内容替换到 Nodel节点 的数据区。 Specifically, according to the ID identifier value of each node (Node2), the corresponding node (Node1) is found in the OrigSeq sequence, and the file data area content of the Node2 node is replaced with the Node1 node. Data area.
407. 遍历新增数据区节点序列 newSeq, 完成新增操作;  407. Traverse the newly added data area node sequence newSeq to complete the new operation;
根据节点的 ID和数据区内容构造一个新的节点, 插入到 OrigSeq序列中 position属性所指位置的节点之后。  Constructs a new node based on the ID of the node and the contents of the data area, inserted after the node in the OrigSeq sequence at the position pointed to by the position attribute.
408. 将新版本的文件目录区和文件目录结束区内容( bufferl )替换到 408. Replace the new version of the file directory area and the file directory end area content (buffer) with
OrigSeq最后一个节点的数据区; The data area of the last node of OrigSeq;
至此完成更新。 如果 delSeq或 newSeq或 updateSeq为空, 则不执行与这 些序列相对应的步骤。  This completes the update. If delSeq or newSeq or updateSeq is empty, the steps corresponding to these sequences are not performed.
409. 至此, OrigSeq 已经是存储了更新后数据区的序列, 将每个节点的 数据区内容写入到本地临时文件中。  409. At this point, OrigSeq is already a sequence that stores the updated data area, writing the contents of each node's data area to a local temporary file.
409'. 执行全部更新, 将响应体正文直接保存到本地临时文件中;  409'. Perform all updates to save the body of the response directly to the local temporary file;
410. 删除当前版本 Widget应用包,将临时文件名改为同名 Widget应用, 完成 Widget应用的更新。  410. Delete the current version of the Widget application package, change the temporary file name to the same name Widget application, and complete the update of the Widget application.
图 5是 Widget服务器进行版本内容比较的算法流程图: Figure 5 is a flow chart of the algorithm for comparing the content of the Widget server:
501. 从新版本数据区序列 Seq2的 N2位置开始取节点, N2初始值为 0。 501. The node is taken from the N2 position of the new version data area sequence Seq2, and the initial value of N2 is 0.
502. 如果 N2节点为空, 表示 Seq2序列已经遍历完成, 结束, 如果 N2 节点不为空, 则将该 N2节点与 Seql序列的节点逐一进行比较, 执行 503步 骤; 502. If the N2 node is empty, indicating that the Seq2 sequence has been traversed, and if the N2 node is not empty, the N2 node is compared with the nodes of the Seq1 sequence one by one, and step 503 is performed;
503. 从 N1位置开始遍历 Seql序列 (N1初始值为 0 ) , 直至找到 ID标 识一致的节点, 或者 Seql遍历结束;  503. Traverse the Seql sequence from the N1 position (the initial value of N1 is 0) until the node with the same ID identifier is found, or the Seql traversal ends;
504. 如果 N1节点和 N2节点的 ID标识一致, 即表示同一个文件名或目 录名的文件数据区, 则执行步骤 506进行数据区内容判断, 如果没有从 Seql 中找到 ID—致的节点, 则执行 505;  504. If the IDs of the N1 node and the N2 node are the same, that is, the file data area of the same file name or directory name, step 506 is performed to determine the content of the data area. If the ID is not found in Seql, Execute 505;
505. Seql中没有与 N2节点 ID标识一致的节点, 表示 N2节点是新增节 点, 则将 N2标识为 "新增" , 并且指向 Seq2下一个节点, 重复 501 ;  505. There is no node in Seql that is consistent with the N2 node ID, indicating that the N2 node is a new node, then N2 is marked as "new" and points to the next node of Seq2, repeating 501;
506. 在 Seql 中将 Nl节点标记为 "未删除" , 表示该 N1节点在 Seq2 中有对应的节点, 同时判断 N1节点与 N2节点的文件数据区内容是否相同, 如果相同, 则执行步骤 508, 如果不相同, 执行步骤 507; 506. Mark the N1 node as "not deleted" in Seql, indicating that the N1 node is in Seq2 There is a corresponding node, and it is determined whether the contents of the file data area of the N1 node and the N2 node are the same. If they are the same, step 508 is performed. If not, step 507 is performed;
507. 表示 Seql的 N1节点内容发生了更新,在 Seq2中将 N2节点标记为 "更新" ;  507. Indicates that the N1 node content of Seql has been updated, and the N2 node is marked as "update" in Seq2;
508. 同 ID的节点比较完成, 指向 Seq2的下一个节点, 指向 Seql的 N1 节点, 继续进行节点比较, 重复 501步骤, 直至 Seq2遍历结束。  508. The node comparison with the ID is completed, pointing to the next node of Seq2, pointing to the N1 node of Seql, continuing the node comparison, and repeating step 501 until the Seq2 traversal ends.
在 Seq2遍历结束后, Seql中未被标记为 "未删除" 的节点被标记为 "删 除" , 即这些被标记为 "删除" 的节点在 Seq2中未找到 ID—致的节点。  At the end of the Seq2 traversal, nodes in Seql that are not marked as "not deleted" are marked as "deleted", ie, those nodes marked as "delete" do not find the ID-instance node in Seq2.
为实现以上方法, 本发明还提供了一种 Widget更新系统, 如图 6所示, 该系统包括微技 ( Widget )客户端及 Widget服务器, 所述 Widget客户端包 括:  To implement the above method, the present invention further provides a Widget update system. As shown in FIG. 6, the system includes a Widget client and a Widget server, and the Widget client includes:
网络交互单元, 其设置成: 向 Widget服务器发送更新请求, 以及接收所 述 Widget服务器发送向响应体, 所述响应体包括更新文档;  a network interaction unit, configured to: send an update request to the Widget server, and receive the Widget server to send to the response body, where the response body includes an update document;
所述 Widget客户端发送的更新请求中携带 Widget 当前版本号, 所述 Widget服务器的版本比较单元根据所述 Widget当前版本号获取所述当前版本 应用包。  The update request sent by the Widget client carries the current version number of the Widget, and the version comparison unit of the Widget server obtains the current version of the application package according to the current version number of the Widget.
所述 Widget更新单元, 其设置成根据所述更新文档完成 Widget更新; 所述 Widget服务器包括:  The widget update unit is configured to complete a widget update according to the update document; the widget server includes:
网络交互单元, 其设置成接收所述更新请求, 以及向所述 Widget客户端 发送所述响应体;  a network interaction unit configured to receive the update request and send the response body to the Widget client;
Widget应用包数据库, 其设置成存储各版本 Widget应用包;  a Widget application package database, which is configured to store each version of the Widget application package;
版本比较单元,其设置成将所述 Widget客户端的当前版本应用包与最新 版本应用包进行比较;  a version comparison unit configured to compare a current version application package of the Widget client with a latest version application package;
响应体构造单元, 其设置成根据比较结果及预置的更新策略, 构造所述 更新文档, 以及构造响应体。  The response body construction unit is configured to construct the update document based on the comparison result and the preset update policy, and construct the response body.
所述更新策略为:  The update strategy is:
根据发生变化的文件和信息构造所述更新文档; 或, 判断发生变化的文件的数量和 /或大小是否超过预设阔值, 如果超过, 则 将最新版本的全部文件作为更新文档, 如果未超过则根据发生变化的文件和 信息构造所述更新文档。 Constructing the updated document based on the changed file and information; or, It is judged whether the number and/or size of the changed files exceeds a preset threshold. If it is exceeded, all the files of the latest version are taken as the updated document, and if not, the updated document is constructed according to the changed files and information.
所述 Widget应用包包括文件数据区、 文件目录区和文件目录结束区, 具 体地, 如图 7所示, 所述 Widget服务器的版本比较单元包括: The Widget application package includes a file data area, a file directory area, and a file directory end area. Specifically, as shown in FIG. 7, the version comparison unit of the Widget server includes:
Widget包内容提取模块, 其设置成将当前版本和最新版本分别生成一个 数据区序列, 其中每个数据区序列中每个文件数据区的内容( Data )及该对 应的文件 /目录名 (ID )为该数据区序列的一个节点;  a Widget package content extraction module, configured to generate a data area sequence respectively for the current version and the latest version, wherein the content (Data) of each file data area in each data area sequence and the corresponding file/directory name (ID) a node for the sequence of data regions;
版本比较模块, 其设置成将最新版本的每个节点与当前版本的每个节点 逐一进行比较,如果最新版本的一节点与当前版本的一节点 ID相同 ata不同, 则将最新版本的该节点标记为更新, 如果最新版本的一节点在当前版本中没 有相对应的 ID, 则将最新版本的该节点标记为新增, 如果当前版本的一节点 在最新版本中没有相对应的 ID, 则将当前版本的该节点标记为删除;  a version comparison module, configured to compare each node of the latest version with each node of the current version one by one, if the node of the latest version is different from the node ID of the current version, the latest version of the node is marked For the update, if the latest version of a node does not have a corresponding ID in the current version, the node of the latest version is marked as new. If a node of the current version does not have a corresponding ID in the latest version, the current The node of the version is marked for deletion;
所述响应体构造单元构造的 (部分) 更新文档包括更新的文件数据区信 息、 新增的文件数据区信息、 删除的文件数据区信息以及最新版本文件目录 区和文件目录结束区。  The (partial) update document constructed by the response body construction unit includes updated file data area information, newly added file data area information, deleted file data area information, and a latest version file directory area and file directory end area.
所述更新的文件数据区信息包括文件 /目录名以及文件数据区内容, 所述 新增的文件数据区信息包括文件 /目录名, 所处压缩包中的位置, 以及文件数 据区内容、 删除的文件数据区信息包括文件 /目录名。  The updated file data area information includes a file/directory name and a file data area content, and the newly added file data area information includes a file/directory name, a location in the compressed package, and a file data area content, and the deleted content. The file data area information includes the file/directory name.
进一步地, 所述响应体还包括更新文档类型指示, 用于指示该更新文档 为全部更新文档或部分更新文档; 如图 8所示, 所述 Widget更新单元包括更 新判断模块、 全部更新模块及部分更新模块;  Further, the response body further includes an update document type indication, which is used to indicate that the update document is a total update document or a partial update document. As shown in FIG. 8, the Widget update unit includes an update determination module, all update modules, and a portion. Update module
更新判断模块设置成 4艮据更新文档类型指示判断更新文档类型; 全部更新模块设置成在所述更新文档为全部更新文档时, 将所述更新文 档替代当前 Widget应用包;  The update judging module is configured to judge the update document type according to the update document type indication; the update module is configured to replace the update file with the current Widget application package when the update document is all updated documents;
部分更新模块设置成在所述更新文档为部分更新文档时, 根据所述更新 文档对当前 Widget应用包进行部分更新。 进一步地, 如图 9所示, 所述部分更新模块包括: The partial update module is configured to partially update the current Widget application package according to the update document when the update document is a partial update document. Further, as shown in FIG. 9, the partial update module includes:
更新文档分析子模块, 其设置成: 解析所述更新文档, 提取其中的 Data 和对应的 ID, 且按更新、 删除、 新增标记进行分类表示管理, 同时提取文件 目录区和文件目录结束区内容;  The document analysis sub-module is updated, and is configured to: parse the update document, extract the Data and the corresponding ID, and classify and represent the management according to the update, delete, and new tags, and extract the file directory area and the file directory end area content. ;
Widget包内容提取子模块, 其设置成: 解析当前版本应用包, 按顺序识 别出每个文件数据区内容, 及该内容对应的文件 /目录名标识, 形成压缩包数 据区管理序列 (OrigSeq ) ; 以及  The Widget package content extraction sub-module is configured to: parse the current version application package, identify each file data area content in sequence, and the file/directory name identifier corresponding to the content, and form a compressed package data area management sequence (OrigSeq); as well as
Widget包内容更新子模块, 其设置成将更新文档中标记为删除的文件数 据区从 OrigSeq序列中删除; 将所述更新文档中标记为更新的文件数据区替 换 OrigSeq序列中被更新的文件数据区; 将所述更新文档中标记为新增的文 件数据区按照指定位置插入到 OrigSeq序列中; 将新版本的文件目录区和文 件目录结束区替换 OrigSeq序列的相应区域, 形成一个新版本的压缩包数据 区管理序列 (NewSeq ) 。  a Widget package content update submodule, configured to delete a file data area marked as deleted in the update document from the OrigSeq sequence; replacing the updated file data area in the OrigSeq sequence with the file data area marked as updated in the update document Inserting the file data area marked as new in the update document into the OrigSeq sequence according to the specified location; replacing the new version of the file directory area and the file directory end area with the corresponding area of the OrigSeq sequence to form a new version of the compressed package Data Area Management Sequence (NewSeq).
本发明还提供了一种 Widget服务器, 所述 Widget服务器包括: 网络交互单元, 其设置成: 接收 Widget客户端发送的更新请求, 以及向 所述 Widget客户端发送响应体, 所述响应体包括更新文档; The present invention further provides a Widget server, the Widget server includes: a network interaction unit, configured to: receive an update request sent by a Widget client, and send a response body to the Widget client, where the response body includes an update Document
所述 Widget客户端发送的更新请求中携带 Widget 当前版本号, 所述 Widget服务器的版本比较单元根据所述 Widget当前版本号获取所述当前版本 应用包。  The update request sent by the Widget client carries the current version number of the Widget, and the version comparison unit of the Widget server obtains the current version of the application package according to the current version number of the Widget.
Widget应用包数据库, 其设置成存储各版本 Widget应用包;  a Widget application package database, which is configured to store each version of the Widget application package;
版本比较单元,其设置成将所述 Widget客户端的当前版本应用包与最新 版本应用包进行比较;  a version comparison unit configured to compare a current version application package of the Widget client with a latest version application package;
响应体构造单元, 其设置成根据比较结果及预置的更新策略, 构造所述 更新文档, 以及构造响应体。  The response body construction unit is configured to construct the update document based on the comparison result and the preset update policy, and construct the response body.
所述更新策略为: 根据发生变化的文件和信息构造所述更新文档; 或, 判断发生变化的文件的数量和 /或大小是否超过预设阔值, 如果超过, 则 将最新版本的全部文件作为更新文档, 否则根据发生变化的文件和信息构造 所述更新文档。 比如, 如果数量和大小均各自小于某阔值, 则部分更新; 如 果发生更新的文件数据区过多, 或者发生更改的文件数据区大小较大, 则全 部更新。 The updating policy is: constructing the updated document according to the changed file and information; or, determining whether the number and/or size of the changed file exceeds a preset threshold, and if so, using all files of the latest version as Update the document, otherwise construct according to the changed file and information The update document. For example, if the quantity and size are each smaller than a certain threshold, the partial update; if there is too much file data area to be updated, or the changed file data area size is large, all are updated.
进一步地, 所述 Widget应用包包括文件数据区、 文件目录区和文件目录 结束区, Widget服务器的版本比较单元遍历两个版本的数据区序列, 比较其 中数据区的变化, 并记录发生更新的文件数据区数量和大小, 用于更新方式 决策判断。 具体而言, 如果对应的文件数据区内容(即, 表示同一个文件或 目录的数据区)发生了更新, 则对该文件数据区进行标记, 并记录其大小; 如果有新增的文件数据区, 则也对该数据区标记, 同时记录其大小。 最终得 到了内容发生变化的文件数据区数量, 以及总大小。  Further, the Widget application package includes a file data area, a file directory area, and a file directory end area, and the version comparison unit of the Widget server traverses the sequence of the two versions of the data area, compares the changes of the data area, and records the updated file. The number and size of the data area, used for update mode decision making. Specifically, if the content of the corresponding file data area (ie, the data area representing the same file or directory) is updated, the data area of the file is marked and the size is recorded; if there is a new file data area , then mark the data area and record its size. The result is the number of file data areas where the content has changed, as well as the total size.
具体地, 所述 Widget服务器的版本比较单元包括:  Specifically, the version comparison unit of the Widget server includes:
Widget包内容提取模块, 其设置成: 将当前版本 Widget应用包和最新版 本 Widget应用包分别生成一个数据区序列,其中每个文件数据区内容( Data ) 及该内容对应的文件 /目录名 (ID )作为数据区序列的一个节点;  The Widget package content extraction module is configured to: generate a data area sequence by using the current version Widget application package and the latest version Widget application package, wherein each file data area content (Data) and the file/directory name (ID) corresponding to the content ) as a node of the sequence of data regions;
版本比较模块, 其设置成: 将最新版本的每个节点与当前版本的每个节 点逐一进行比较, 如果最新版本的一节点与当前版本的一节点 ID相同、 Data 不同, 则将最新版本的该节点标记为更新, 如果最新版本的一节点在当前版 本没有相对应的 ID, 则将最新版本的该节点标记为新增, 如果当前版本的一 节点在最新版本没有相对应的 ID, 则将当前版本的该节点标记为删除;  a version comparison module, configured to: compare each node of the latest version with each node of the current version one by one, if the latest version of one node is the same as the current version of one node ID, Data is different, then the latest version of the node The node is marked as updated. If the latest version of a node does not have a corresponding ID in the current version, the node of the latest version is marked as new. If the current version of a node does not have a corresponding ID in the latest version, the current The node of the version is marked for deletion;
所述响应体构造单元构造的 (部分) 更新文档包括更新的文件数据区信 息、 新增的文件数据区信息、 删除的文件数据区信息以及最新版本文件目录 区和文件目录结束区。 部分更新文档可以使用 XML或其他约定的标记语言。  The (partial) update document constructed by the response body construction unit includes updated file data area information, newly added file data area information, deleted file data area information, and a latest version file directory area and file directory end area. Partially updated documents can use XML or other contracted markup languages.
所述更新的文件数据区信息包括文件 /目录名以及文件数据区内容, 所述 新增的文件数据区信息包括文件 /目录名, 所处当前版本应用包中的位置, 以 及文件数据区内容、 删除的文件数据区信息包括文件 /目录名。  The updated file data area information includes a file/directory name and a file data area content, where the newly added file data area information includes a file/directory name, a location in the current version application package, and a file data area content, The deleted file data area information includes the file/directory name.
另外, 本发明还提供了一种微技(Widget )客户端, 所述 Widget客户端 包括:  In addition, the present invention further provides a Widget client, where the Widget client includes:
网络交互单元, 其设置成: 向 Widget服务器发送更新请求, 以及接收所 述 Widget服务器发送的响应体, 所述响应体包括更新文档, 所述更新文档是 所述 Widget服务器根据所述 Widget客户端的当前版本应用包与最新版本应 用包的比较结果和更新策略构造的; 以及 a network interaction unit, configured to: send an update request to the Widget server, and receive the location a response body sent by the Widget server, where the response body includes an update file, where the update document is constructed by the Widget server according to a comparison result and an update policy of a current version application package of the Widget client and a latest version application package;
Widget更新单元, 其设置成根据所述更新文档完成 Widget更新。  A widget update unit configured to complete the widget update based on the updated document.
所述(部分) 更新文档包括更新的文件数据区信息、 新增的文件数据区 信息、 删除的文件数据区信息以及最新版本文件目录区和文件目录结束区, 所述更新的文件数据区信息包括文件 /目录名以及文件数据区内容, 所述新增 的文件数据区信息包括文件 /目录名, 所处当前版本应用包中的位置, 以及文 件数据区内容、 删除的文件数据区信息包括文件 /目录名。  The (partial) update document includes updated file data area information, newly added file data area information, deleted file data area information, and a latest version file directory area and a file directory end area, and the updated file data area information includes File/directory name and file data area content, the newly added file data area information includes file/directory name, location in the current version application package, and file data area content, deleted file data area information including file/ Directory name.
进一步地, 所述响应体还包括更新文档类型指示, 用于指示该更新文档 为全部更新文档或部分更新文档; 所述 Widget更新单元包括:  Further, the response body further includes an update document type indication, configured to indicate that the update document is a total update document or a partial update document; and the widget update unit includes:
更新判断模块, 其设置成根据更新文档类型指示判断更新文档类型; 全部更新模块, 其设置成: 在更新文档为全部更新文档时, 将更新文档 替代当前 Widget应用包; 以及  An update judging module configured to determine an update document type according to an update document type indication; a full update module, configured to: replace the current Widget application package with the update document when the update document is all updated documents;
部分更新模块, 其设置成: 在更新文档为部分更新文档时, 根据更新文 档对当前 Widget应用包进行部分更新。  A partial update module, which is configured to: when the updated document is a partial update document, partially update the current widget application package according to the updated document.
所述部分更新模块包括更新文档分析子模块、 Widget包内容提取子模块 和 Widget包内容更新子模块, 其中  The partial update module includes an update document analysis submodule, a widget package content extraction submodule, and a widget package content update submodule, wherein
更新文档分析子模块设置成: 解析所述更新文档, 提取其中的 Data和对 应的 ID, 且按更新、 删除、 新增标记进行分类表示管理, 同时提取文件目录 区和文件目录结束区内容;  The update document analysis sub-module is configured to: parse the update document, extract the Data and the corresponding ID, and classify and represent the management according to the update, delete, and new mark, and extract the file directory area and the file directory end area content;
Widget包内容提取子模块设置成: 解析当前版本应用包, 按顺序识别出 每个文件数据区内容, 及其对应的文件 /目录名标识, 形成压缩包数据区管理 序列 (OrigSeq ) ;  The Widget package content extraction sub-module is configured to: parse the current version of the application package, identify each file data area content in sequence, and corresponding file/directory name identifiers, and form a compressed package data area management sequence (OrigSeq);
Widget包内容更新子模块设置成: 将更新文档中标记为删除的文件数据 区从 OrigSeq序列中删除; 将所述更新文档中标记为更新的文件数据区替换 OrigSeq序列中对应的文件数据区;将所述更新文档中标记为新增的文件数据 区按照指定位置插入到 OrigSeq序列中; 将新版本的文件目录区和文件目录 结束区替换 OrigSeq序列的相应区域, 形成一个新版本的压缩包数据区管理 序列 (NewSeq ) The Widget package content update submodule is configured to: delete the file data area marked as deleted in the update document from the OrigSeq sequence; replace the file data area marked as updated in the update document with the corresponding file data area in the OrigSeq sequence; The file data area marked as newly added in the update document is inserted into the OrigSeq sequence according to the specified position; the new version of the file directory area and the file directory end area are replaced with corresponding areas of the OrigSeq sequence to form a new version of the compressed package data area. Management Sequence (NewSeq)
本领域普通技术人员可以理解上述方法中的全部或部分步骤可通过程序 来指令相关硬件完成, 所述程序可以存储于计算机可读存储介质中, 如只读 存储器、 磁盘或光盘等。 可选地, 上述实施例的全部或部分步骤也可以使用 一个或多个集成电路来实现。 相应地, 上述实施例中的各模块 /单元可以釆用 硬件的形式实现, 也可以釆用软件功能模块的形式实现。 本发明不限制于任 何特定形式的硬件和软件的结合。 One of ordinary skill in the art will appreciate that all or a portion of the above steps may be accomplished by a program instructing the associated hardware, such as a read-only memory, a magnetic disk, or an optical disk. Alternatively, all or part of the steps of the above embodiments may also be implemented using one or more integrated circuits. Correspondingly, each module/unit in the above embodiment may be implemented in the form of hardware or in the form of a software function module. The invention is not limited to any specific form of combination of hardware and software.
本发明方法、 系统及设备, 通过比较 Widget客户端当前版本和最新版本 的应用包, 并根据比较结果和预置更新策略生成具有针对性的更新文档, 进 而 Widget客户端根据该更新文档进行 Widget更新, 可以有效提供更新效率, 尤其是当发生变化的文件数量或大小较少时, 可以更有效地利用了无线网络 资源, 减少了 Widget应用更新的网络交互时间, 降低了可能的网络异常导致 更新失败的风险。  The method, system and device of the present invention compare the current version of the Widget client with the latest version of the application package, and generate a targeted update document according to the comparison result and the preset update policy, and then the Widget client performs the Widget update according to the update document. , can effectively provide update efficiency, especially when the number or size of changed files is less, the wireless network resources can be utilized more effectively, the network interaction time of the Widget application update is reduced, and the possible network abnormality is caused to cause the update failure. risks of.
工业实用性 与现有技术相比, 本发明中, Widget服务器根据当前版本应用包与最新 版本应用包的比较结果生成更新文档, Widget客户端根据该更新文档进行 Widget更新, 从而可实现 Widget的部分更新, 并有效提高更新效率。 Industrial Applicability Compared with the prior art, in the present invention, the Widget server generates an update document according to the comparison result between the current version application package and the latest version application package, and the Widget client performs Widget update according to the update document, thereby implementing the Widget part. Update and effectively improve update efficiency.

Claims

权 利 要 求 书 Claim
1、 一种微技 ( Widget ) 更新方法, 包括: 1. A method for updating a widget (widget), including:
Widget客户端向 Widget服务器发送更新请求;  The Widget client sends an update request to the Widget server;
所述 Widget服务器接收所述更新请求后, 提取所述 Widget客户端的当 前版本 Widget应用包和最新版本 Widget应用包, 并进行比较;  After receiving the update request, the Widget server extracts the current version of the Widget application package and the latest version of the Widget application package of the Widget client, and compares them;
所述 Widget服务器构造响应体并发送给所述 Widget客户端, 所述响应 体包括根据比较结果及预置的更新策略构造的更新文档; 以及  The widget server constructs a response body and sends the response body to the Widget client, the response body including an update document constructed according to the comparison result and a preset update policy;
所述 Widget客户端接收所述响应体, 并根据所述更新文档进行更新。  The widget client receives the response body and updates according to the update document.
2、 如权利要求 1所述的方法, 其中, 所述 Widget客户端发送的更新请 求中携带当前 Widget版本号, 所述 Widget服务器根据所述当前 Widget版本 号获取所述当前版本 Widget应用包。 The method of claim 1, wherein the update request sent by the Widget client carries a current Widget version number, and the Widget server obtains the current version Widget application package according to the current Widget version number.
3、 如权利要求 1所述的方法, 还包括: 所述 Widget服务器发送所述响 应体时, 更新所述 Widget客户端与 Widget版本号的对应关系; 提取所述 Widget客户端的当前版本 Widget应用包的步骤包括: 所述 Widget服务器根据所述 Widget客户端与 Widget版本号的对应关系获取所述 当前版本 Widget应用包。 The method of claim 1, further comprising: updating the correspondence between the Widget client and the Widget version number when the Widget server sends the response body; extracting a current version Widget application package of the Widget client The step of the method includes: obtaining, by the Widget server, the current version of the Widget application package according to the correspondence between the Widget client and the Widget version number.
4、 如权利要求 1所述的方法, 其中, 所述更新策略为: 4. The method of claim 1, wherein the update policy is:
根据发生变化的文件和信息构造所述更新文档; 或者,  Constructing the updated document according to the changed file and information; or
判断发生变化的文件的数量和 /或大小是否超过预设阔值, 如果超过, 则 将最新版本的全部文件作为更新文档, 若不超过则根据发生变化的文件和信 息构造所述更新文档。  It is judged whether the number and/or size of the changed file exceeds the preset threshold. If it is exceeded, all the files of the latest version are used as the update document, and if not, the updated document is constructed according to the changed file and information.
5、 如权利要求 1所述的方法, 其中, 每个 Widget应用包包括文件数据 区、 文件目录区和文件目录结束区; 将所述 Widget客户端的当前版本 Widget应用包与最新版本 Widget应用 包进行比较的步骤包括: 解析当前版本 Widget应用包和最新版本 Widget应用包; 5. The method of claim 1, wherein each Widget application package includes a file data area, a file directory area, and a file directory end area; and the current version of the Widget client Widget application package is compared with the latest version of the Widget application package. The steps to compare include: Parsing the current version of the Widget application package and the latest version of the Widget application package;
用当前版本 Widget应用包和最新版本 Widget应用包分别生成第一数据 区序列和第二数据区序列, 每个数据区序列中每个文件数据区的内容(Data ) 及该内容对应的文件 /目录名 (ID )为该数据区序列的一个节点; 以及  The first data area sequence and the second data area sequence are respectively generated by using the current version Widget application package and the latest version Widget application package, and the content (Data) of each file data area in each data area sequence and the file/directory corresponding to the content The name (ID) is a node of the sequence of the data area;
将第二数据区序列的每个节点与第一数据区序列的所有节点逐一进行比 较, 对所述第二数据区序列中的一个节点: 如果在第一数据区中存在与该节 点 ID相同但 Data不同的节点, 则将该节点标记为更新; 如果在第一数据区 中不存在与该节点 ID相同的节点, 则将该节点标记为新增; 对所述第一数据 区中的一个节点: 如果在第二数据区中不存在与该节点 ID相同的节点, 则将 该节点标记为删除;  Comparing each node of the second data region sequence with all nodes of the first data region sequence one by one, for one node in the second data region sequence: if there is the same in the first data region as the node ID but If the node is different, the node is marked as updated; if there is no node in the first data area that is the same as the node ID, the node is marked as new; for a node in the first data area : if there is no node with the same node ID in the second data area, the node is marked as deleted;
所述更新文档包括更新的文件数据区信息、 新增的文件数据区信息、 删 除的文件数据区信息以及最新版本的文件目录区和文件目录结束区。  The update file includes updated file data area information, newly added file data area information, deleted file data area information, and a file directory area and a file directory end area of the latest version.
6、如权利要求 5所述的方法,其中, 所述更新的文件数据区信息包括 ID 以及 Data, 所述新增的文件数据区信息包括 ID、 在当前版本 Widget应用包 中的位置以及 Data, 所述删除的文件数据区信息包括 ID。 The method of claim 5, wherein the updated file data area information comprises an ID and a data, and the added file data area information comprises an ID, a location in a current version of the Widget application package, and a data. The deleted file data area information includes an ID.
7、 如权利要求 1所述的方法, 其中, 所述响应体还包括更新文档类型指 示, 用于指示该更新文档为全部更新文档或部分更新文档; 根据所述更新文档进行更新的步骤包括: 所述 Widget客户端根据所述更 新文档类型指示判断更新文档类型; 当更新文档为全部更新文档时, 所述 Widget客户端将更新文档替代当前版本 Widget应用包; 当更新文档为部分更 新文档时, 所述 Widget客户端根据更新文档对当前版本 Widget应用包进行 部分更新。 The method of claim 1, wherein the response body further comprises an update document type indication, configured to indicate that the update document is a total update document or a partial update document; and the updating according to the update document comprises: The Widget client determines to update the document type according to the updated document type indication; when the update document is all updated documents, the Widget client replaces the current version of the Widget application package; when the updated document is a partial update document, The Widget client partially updates the current version of the Widget application package according to the update document.
8、 如权利要求 7所述的方法, 其中, 所述 Widget客户端根据所述更新 文档对当前版本 Widget应用包进行部分更新的步骤包括: 8. The method of claim 7, wherein the step of the Widget client partially updating the current version of the Widget application package according to the updated document comprises:
解析所述更新文档, 提取其中的 Data和该 Data对应的 ID , 且按更新、 删除、新增标记进行分类表示管理, 同时提取文件目录区和文件目录结束区; 解析当前版本 Widget应用包, 按顺序识别出每个 Data, 及该 Data对应 的 ID, 形成压缩包数据区管理序列 (OrigSeq ) ; 以及 Parsing the updated document, extracting the ID corresponding to the Data and the Data, and classifying and representing the management according to the update, delete, and newly added tags, and extracting the file directory area and the file directory end area; parsing the current version of the Widget application package, and pressing Identify each Data sequentially, and corresponding to the Data ID, forming a compressed packet data area management sequence (OrigSeq);
将所述更新文档中标记为删除的文件数据区从 OrigSeq序列中删除; 将 所述更新文档中标记为更新的文件数据区替换 OrigSeq序列中被更新的文件 数据区; 将所述更新文档中标记为新增的文件数据区按照指定位置插入到 OrigSeq序列中;将从所述更新文档中提取的文件目录区和文件目录结束区分 别替换 OrigSeq序列的文件目录区和文件目录结束区, 形成一个新版本的压 缩包数据区管理序列 (NewSeq ) 。  Deleting the file data area marked as deleted in the update document from the OrigSeq sequence; replacing the updated file data area in the updated document with the file data area in the OrigSeq sequence; marking the updated document Inserting the newly added file data area into the OrigSeq sequence according to the specified location; replacing the file directory area and the file directory end area extracted from the updated document with the file directory area and the file directory end area of the OrigSeq sequence, respectively, to form a new Version of the compressed package data area management sequence (NewSeq).
9、 一种微技(Widget )服务器, 包括: 9. A Widget server, including:
网络交互单元, 其设置成: 接收 Widget客户端发送的更新请求, 以及向 所述 Widget客户端发送响应体, 所述响应体包括更新文档;  a network interaction unit, configured to: receive an update request sent by the Widget client, and send a response body to the Widget client, where the response body includes an update document;
Widget应用包数据库, 其设置成存储各版本 Widget应用包;  a Widget application package database, which is configured to store each version of the Widget application package;
版本比较单元, 其设置成将所述 Widget客户端的当前版本 Widget应用 包与最新版本 Widget应用包进行比较; 以及  a version comparison unit configured to compare a current version of the Widget client package with a latest version of the Widget application package;
响应体构造单元, 其设置成根据所述版本比较单元的比较结果及预置的 更新策略, 构造所述更新文档, 以及构造响应体。  The response body construction unit is configured to construct the update document and construct the response body according to the comparison result of the version comparison unit and the preset update policy.
10、 如权利要求 9所述的服务器, 其中, 所述更新策略为: 10. The server according to claim 9, wherein the update policy is:
根据发生变化的文件和信息构造所述更新文档; 或  Constructing the updated document based on the changed files and information; or
判断发生变化的文件的数量和 /或大小是否超过预设阔值, 如果超过, 则 将最新版本的全部文件作为更新文档, 若未超过则根据发生变化的文件和信 息构造所述更新文档。  It is judged whether the number and/or size of the changed file exceeds the preset threshold. If it is exceeded, all the files of the latest version are used as the update document, and if not, the updated document is constructed according to the changed file and information.
11、 如权利要求 9所述的服务器, 其中, 每个 Widget应用包包括文件数 据区、 文件目录区和文件目录结束区, 所述版本比较单元包括: The server according to claim 9, wherein each Widget application package includes a file data area, a file directory area, and a file directory end area, and the version comparison unit includes:
Widget包内容提取模块,其设置成用当前版本 Widget应用包和最新版本 Widget应用包分别生成第一数据区序列和第二数据区序列, 其中每个数据区 序列中每个文件数据区的内容( Data )及该内容对应的文件 /目录名 ( ID )构 成该数据区序列的一个节点; 以及  a Widget package content extraction module configured to generate a first data region sequence and a second data region sequence respectively, using a current version Widget application package and a latest version Widget application package, wherein each of the data region sequences has a content of each file data region ( Data) and the file/directory name (ID) corresponding to the content constitute a node of the sequence of the data area;
版本比较模块, 其设置成: 将第二数据序列的每个节点与第一数据序列 的所有节点逐一进行比较, 对所述第二数据区序列中的一个节点: 如果在第 一数据区中存在与该节点 ID相同但 Data不同的节点, 则将该节点标记为更 新; 如果在第一数据区中不存在与该节点 ID相同的节点, 则将该节点标记为 新增; 对所述第一数据区中的一个节点: 如果在第二数据区中不存在与该节 点 ID相同的节点, 则将该节点标记为删除; a version comparison module, configured to: each node of the second data sequence and the first data sequence All nodes are compared one by one, for one node in the second data zone sequence: if there is a node in the first data zone that is the same as the node ID but different in Data, the node is marked as updated; If there is no node in the data area that is the same as the node ID, the node is marked as new; for one node in the first data area: if there is no same in the second data area as the node ID Node, then mark the node as deleted;
的文件数据区信息、 删除的文件数据区信息以及最新版本的文件目录区和文 件目录结束区。 The file data area information, the deleted file data area information, and the latest version of the file directory area and the file directory end area.
12、 一种微技(Widget )客户端, 包括: 12. A Widget client, including:
网络交互单元, 其设置成: 向 Widget服务器发送更新请求, 以及接收所 述 Widget服务器发送的响应体, 所述响应体包括更新文档, 所述更新文档是 所述 Widget服务器根据所述 Widget客户端的当前版本 Widget应用包与最新 版本 Widget应用包的比较结果和更新策略构造的; 以及  a network interaction unit, configured to: send an update request to the Widget server, and receive a response body sent by the Widget server, where the response body includes an update document, where the update document is the Widget server according to the current current of the Widget client The version of the Widget application package is compared with the latest version of the Widget application package and the update strategy is constructed;
Widget更新单元, 其设置成根据所述更新文档完成 Widget更新。  A widget update unit configured to complete the widget update based on the updated document.
13、 如权利要求 12所述的 Widget客户端, 其中, 所述响应体还包括更 新文档类型指示, 用于指示该更新文档为全部更新文档或部分更新文档; 所 述 Widget更新单元包括: The Widget client according to claim 12, wherein the response body further includes an update document type indication, which is used to indicate that the update document is a total update document or a partial update document; the widget update unit includes:
更新判断模块, 其设置成根据更新文档类型指示判断更新文档类型; 全部更新模块, 其设置成在所述更新文档为全部更新文档时, 用更新文 档替代当前版本 Widget应用包;  An update judging module, configured to determine an update document type according to an update document type indication; a total update module, configured to replace the current version Widget application package with the update document when the update document is all updated documents;
部分更新模块, 其设置成在所述更新文档为部分更新文档时, 根据所述 更新文档对当前版本 Widget应用包进行部分更新。  And a partial update module, configured to perform a partial update of the current version of the Widget application package according to the update document when the update document is a partial update document.
14、 如权利要求 13所述的 Widget客户端, 其中, 所述部分更新模块包 括: 14. The Widget client of claim 13, wherein the partial update module comprises:
更新文档分析子模块, 其设置成: 解析所述更新文档, 提取所述更新文 档中的文件数据区内容(Data )及该内容对应的文件 /目录名 (ID ) , 且按更 新、 删除、 新增标记进行分类表示管理, 同时提取新版本的文件目录区和文 件目录结束区; Updating a document analysis sub-module, configured to: parse the update document, extract a file data area content (Data) in the update document, and a file/directory name (ID) corresponding to the content, and press update, delete, new Add tags to classify the management, and extract the new version of the file directory area and text End of directory
Widget包内容提取子模块, 其设置成: 解析当前版本 Widget应用包, 按 顺序识别出每个 Data , 及该 Data对应的 ID , 形成压缩包数据区管理序列 ( OrigSeq ) ;  The Widget package content extraction sub-module is configured to: parse the current version of the Widget application package, identify each Data in sequence, and the ID corresponding to the Data, and form a compressed packet data area management sequence (OrigSeq);
Widget包内容更新子模块, 其设置成: 将更新文档中标记为删除的文件 数据区从 OrigSeq序列中删除; 将所述更新文档中标记为更新的文件数据区 替换 OrigSeq序列中被更新的文件数据区; 将所述更新文档中标记为新增的 文件数据区按照指定位置插入到 OrigSeq序列中; 将新版本的文件目录区和 文件目录结束区替换 OrigSeq序列中的文件目录区和文件目录结束区, 形成 一个新版本的压缩包数据区管理序列 (NewSeq ) 。  a Widget package content update submodule, configured to: delete a file data area marked as deleted in the update document from the OrigSeq sequence; replace the updated file data area in the OrigSeq sequence with the file data area marked as updated in the update document Inserting the file data area marked as new in the update document into the OrigSeq sequence according to the specified location; replacing the file directory area and the file directory end area of the new version with the file directory area and the file directory end area in the OrigSeq sequence , form a new version of the compressed packet data area management sequence (NewSeq).
15、 一种微技 ( Widget )更新系统, 包括如权利要求 9至 11中任一项所 述的 Widget服务器以及如权利要求 12至 14中任一项所述的 Widget客户端。 A Widget update system, comprising the Widget server according to any one of claims 9 to 11 and the Widget client according to any one of claims 12 to 14.
PCT/CN2011/080099 2010-10-15 2011-09-23 Method and system for updating widget, widget client and widget server WO2012048617A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201010513880.4 2010-10-15
CN2010105138804A CN101977217A (en) 2010-10-15 2010-10-15 Widget updating method and system as well as Widget client and Widget server

Publications (1)

Publication Number Publication Date
WO2012048617A1 true WO2012048617A1 (en) 2012-04-19

Family

ID=43577061

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/080099 WO2012048617A1 (en) 2010-10-15 2011-09-23 Method and system for updating widget, widget client and widget server

Country Status (2)

Country Link
CN (1) CN101977217A (en)
WO (1) WO2012048617A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110442361A (en) * 2019-06-27 2019-11-12 五八有限公司 A kind of gray scale dissemination method, device and electronic equipment

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101977217A (en) * 2010-10-15 2011-02-16 中兴通讯股份有限公司 Widget updating method and system as well as Widget client and Widget server
CN103002011B (en) * 2012-10-29 2016-06-29 北京奇虎科技有限公司 Data-updating method and server based on server
CN104717182B (en) * 2013-12-12 2018-03-09 华为技术有限公司 The security strategy dispositions method and device of network firewall
CN104717194A (en) * 2013-12-16 2015-06-17 研祥智能科技股份有限公司 Security policy change method and system
CN104461613A (en) * 2014-11-14 2015-03-25 北京百度网讯科技有限公司 Method and device for managing floating window information display of application program
CN106919406A (en) * 2015-12-24 2017-07-04 阿里巴巴集团控股有限公司 A kind of desktop application component issue, update method and device
CN106325924B (en) * 2016-08-19 2019-11-15 成都卓影科技股份有限公司 A kind of electronic program guides heat update system and method
CN106648761B (en) * 2016-12-01 2019-04-05 武汉斗鱼网络科技有限公司 The method and device automatically updated in QT program
CN106685718A (en) * 2016-12-30 2017-05-17 杭州迪普科技股份有限公司 Configuration switching method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1379335A (en) * 2001-03-30 2002-11-13 松下电器产业株式会社 Remote control program system
CN1536789A (en) * 2003-04-09 2004-10-13 华为技术有限公司 Upgrading method by utilizing wave analysis of cuxiliary test example
CN101193356A (en) * 2006-11-22 2008-06-04 乐金电子(昆山)电脑有限公司 Firmware upgrade method for portable information terminal
CN101533410A (en) * 2009-04-13 2009-09-16 浙江大学 Widget content buffering method facing mobile terminal
CN101605294A (en) * 2009-07-13 2009-12-16 浙江大学 Method based on the Widget assembly management of TD-SCDMA network
CN101977217A (en) * 2010-10-15 2011-02-16 中兴通讯股份有限公司 Widget updating method and system as well as Widget client and Widget server

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1418732B1 (en) * 2002-09-19 2016-01-06 Ricoh Company, Ltd. Communication system implementing a plurality of communication apparatuses as communication client and communication server for exchanging operation requests and operation responses
US7653640B2 (en) * 2006-07-31 2010-01-26 Microsoft Corporation Two-way and multi-master synchronization over web syndications

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1379335A (en) * 2001-03-30 2002-11-13 松下电器产业株式会社 Remote control program system
CN1536789A (en) * 2003-04-09 2004-10-13 华为技术有限公司 Upgrading method by utilizing wave analysis of cuxiliary test example
CN101193356A (en) * 2006-11-22 2008-06-04 乐金电子(昆山)电脑有限公司 Firmware upgrade method for portable information terminal
CN101533410A (en) * 2009-04-13 2009-09-16 浙江大学 Widget content buffering method facing mobile terminal
CN101605294A (en) * 2009-07-13 2009-12-16 浙江大学 Method based on the Widget assembly management of TD-SCDMA network
CN101977217A (en) * 2010-10-15 2011-02-16 中兴通讯股份有限公司 Widget updating method and system as well as Widget client and Widget server

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110442361A (en) * 2019-06-27 2019-11-12 五八有限公司 A kind of gray scale dissemination method, device and electronic equipment
CN110442361B (en) * 2019-06-27 2024-02-09 五八有限公司 Gray release method and device and electronic equipment

Also Published As

Publication number Publication date
CN101977217A (en) 2011-02-16

Similar Documents

Publication Publication Date Title
WO2012048617A1 (en) Method and system for updating widget, widget client and widget server
US6199081B1 (en) Automatic tagging of documents and exclusion by content
CN101635718A (en) Network crawler system and method for acquiring resource as well as network resource gripping device
WO2015014145A1 (en) Method and device for accelerating sub-resource loading velocity
CN108512898B (en) File pushing method and device, computer equipment and storage medium
CN108900554B (en) HTTP asset detection method, system, device and computer medium
CN109241003B (en) File management method and device
US20190286687A1 (en) Identification of sequential browsing operations
US20020052889A1 (en) Method for managing alterations of contents
US20090182739A1 (en) Using metadata to route documents
CN110377579A (en) File memory method, device and server
JP5405190B2 (en) Content management information collection system and content management information collection method
CN105282238B (en) A kind of method for managing resource
JP2007011998A (en) Xpath expression processing method, xpath expression processor, xpath expression processing program, storage medium storing the program, and automaton
JP2004341942A (en) Content classification method, content classification device, content classification program, and storage medium storing content classification program
JP2002082936A (en) Contents data displaying device and contents data displaying system
JP6522261B1 (en) Method and apparatus for managing file attribute information {METHOD FOR MANAGING ATTRIBUTE INFORMATION OF FILE AND COMPUTING DEVICE USING THE SAME}
JP2000122912A (en) Method and device for gathering resource
JP3725087B2 (en) Knowledge information collecting system and knowledge information collecting method
JP3725088B2 (en) Knowledge information collecting system and knowledge information collecting method
US20060123109A1 (en) Method for processing HTTP requests and HTML pages transmitted or received by a navigator to or from at least one web server, and associated server
JP3708893B2 (en) Knowledge information collecting system and knowledge information collecting method
US9984074B2 (en) Information processing apparatus and non-transitory computer readable medium
CN106302797A (en) A kind of cookie accesses De-weight method and device
JP5941823B2 (en) Consistency confirmation method and system

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 11832014

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 11832014

Country of ref document: EP

Kind code of ref document: A1