Embodiment
To combine the accompanying drawing in the embodiment of the invention below, the technical scheme in the embodiment of the invention is carried out clear, intactly description, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills are not making the every other embodiment that is obtained under the creative work prerequisite, all belong to the scope of the present invention's protection.
The embodiment of the invention provides a kind of data download method and data uploading method and browser, can realize web application of creating based on the Ajax technology and the equipment interaction data that adopts various protocols helping expanding Ajax The Application of Technology scope.
Below be elaborated respectively through specific embodiment.
Embodiment one,
A kind of data download method that sees also Fig. 1, the embodiment of the invention one can comprise:
101, browser receives the download request that issues based on the technological web application of creating of Ajax, and this download request is carried the URL of web application request data downloaded.
102, confirm above-mentioned download request corresponding protocols type.
Under a kind of application scenarios, the download request that the web application of creating based on Ajax technology issues can be carried URL (URL, Uniform Resource Locator) and other relevant parameter of request data downloaded etc.
Wherein, the URL that carries of above-mentioned download request comprises the address information and the routing information of this data on this server of the server of storing above-mentioned request data downloaded.The URL that download request is carried can also comprise the protocol type sign of indicating this download request corresponding protocols type, and download request corresponding protocols type is just stored the protocol type that server adopted of above-mentioned request data downloaded.
For example, the URL that carries as if download request is: http://www.gdzl.gov.cn/zljs/index.jsp, then its protocol type that comprises is designated HTTP, shows that this download request corresponding protocols type is HTTP.
Under a kind of application scenarios, browser can detect the protocol type sign that URL that above-mentioned download request carries comprises, and according to the result who detects, confirms download request corresponding protocols type.
For instance, when browser detected protocol type that URL comprises and is designated FTP, then determining download request corresponding protocols type was FTP (FTP, File Transfer Protocol); When detecting protocol type that URL comprises and be designated FILE, then determining download request corresponding protocols type is file protocol; When detecting protocol type that URL comprises and be designated RES, then determine download request corresponding protocols type and be resource (RES, Resouse) agreement, by that analogy.
Further; The browser and the page are used the protocol type of agreement acquiescence in advance; When browser detects the protocol type sign that URL that download request carries do not comprise, directly determine this download request corresponding protocols type and be the protocol type of agreement acquiescence in advance.
In addition; The download request that the above-mentioned web application of creating based on the Ajax technology issues also can be carried the indication information that other is used to indicate this download request corresponding protocols type; At this moment; Then browser can detect above-mentioned indication information, and according to testing result, confirms above-mentioned download request corresponding protocols type.
103, according to the pairing processing mode of the protocol type of determining, according to above-mentioned URL data download from the corresponding server.
Browser is determined download request corresponding protocols type; Also just determined the protocol type that server adopted of storing above-mentioned request data downloaded; And then can be according to the pairing downloading mode of the protocol type of determining, the URL that carries according to download request data download from the corresponding server.
For instance, when determining download request corresponding protocols type and be FTP, browser is according to the pairing processing mode of FTP, according to the URL of request data downloaded data download from the corresponding server; When determining download request corresponding protocols type and be FILE; Browser is according to the pairing processing mode data download of FILE agreement; When determining download request corresponding protocols type and be HTTP; Browser is local file system corresponding protocols type according to the pairing processing mode data download of HTTP when determining download request corresponding protocols type, and browser then can be according to the pairing processing mode of the protocol type of local file system; According to URL from local file system file in download resource, by that analogy.
Wherein, browser connects and the process of data download according to pairing processing mode of variety of protocol and respective server, for conventionally known to one of skill in the art, repeats no more here.
104,, then send from server success data downloaded to above-mentioned web application if download successfully.
Under a kind of application scenarios, after successfully downloading to corresponding data from respective server, the above-mentioned web application of browser is sent from server success data downloaded; If failed download, browser can feed back the indication information of a failed download to web application.
Certainly, web application can be handled and displaying etc. after receiving the data download of browser feedback accordingly.
Can find out by technique scheme; Browser is determined the download request corresponding protocols type that the technological web application of creating of Ajax issues earlier in this enforcement; According to the pairing processing mode of the protocol type of determining data download from the corresponding server; Can realize web application of creating based on the Ajax technology and the server interaction data that adopt various protocols being applicable to plurality of application scenes, help expanding Ajax The Application of Technology scope.
The foregoing description is to be example based on the technological web application request data download of creating of Ajax, describes, and uploads data instance with the web application request of creating based on the Ajax technology below and describes.
Embodiment two,
A kind of data uploading method that sees also Fig. 2, the embodiment of the invention two can comprise:
201, browser receives the upload request that the web application created based on the Ajax technology issues, and this upload request is carried the data that this web application request uploads and the URL of this data upload.
202, confirm upload request corresponding protocols type.
Under a kind of application scenarios, the data that the upload request request of can carrying that the web application of creating based on the Ajax technology issues is uploaded and the URL of this data upload can also carry other relevant parameter etc.
Wherein, the URL that carries of upload request comprise data address information and this data upload relative path information to this server of the server that will upload to.The URL that upload request is carried can also comprise the protocol type sign of indicating this upload request corresponding protocols type, and upload request corresponding protocols type just data the protocol type that server adopted that will upload to.
Under a kind of application scenarios, browser can detect the protocol type sign that URL that upload request carries comprises, and according to the result who detects, confirms upload request corresponding protocols type.
For instance, when browser detected protocol type that URL comprises and is designated FTP, then determining upload request corresponding protocols type was FTP; When detecting protocol type that URL comprises and be designated FILE, then determining upload request corresponding protocols type is file protocol; When detecting protocol type that URL comprises and be designated RES; Then determining upload request corresponding protocols type is resource protocol; When detecting protocol type that URL comprises and be designated HTTP, then determining upload request corresponding protocols type is HTTP, by that analogy.
Further; The browser and the page are used the protocol type of agreement acquiescence in advance; When browser detects the protocol type sign that URL that upload request carries do not comprise, directly determine this upload request corresponding protocols type and be the protocol type of agreement acquiescence in advance.
In addition; The upload request that the above-mentioned web application of creating based on the Ajax technology issues also can be carried the indication information that other is used to indicate this upload request corresponding protocols type; At this moment; Then browser can detect above-mentioned indication information, and according to testing result, confirms this upload request corresponding protocols type.
203, according to the pairing processing mode of the protocol type of determining, upload data to corresponding server according to above-mentioned URL.
Browser is determined upload request corresponding protocols type; Also just determined data the protocol type that server adopted that will upload to; And then can be according to the pairing upload process mode of the protocol type of determining, the URL that carries according to upload request uploads data to corresponding server.
For instance, when determining upload request corresponding protocols type and be FTP, browser is according to the pairing processing mode of FTP, uploads data according to the URL of data upload to corresponding server; When determining upload request corresponding protocols type and be FILE; Browser is uploaded data according to the pairing processing mode of FILE agreement; When determining download request corresponding protocols type and be HTTP; Browser is uploaded data according to the pairing processing mode of HTTP, when definite upload request corresponding protocols type is a local file system corresponding protocols type, according to the pairing processing mode of the protocol type of local file system; Upload data according to URL to local file system, by that analogy.
Wherein, browser connects according to pairing processing mode of variety of protocol and respective server and uploads the process of data, for conventionally known to one of skill in the art, repeats no more here.
Under a kind of application scenarios, after browser is being uploaded the data success, can feed back an indication information of uploading success to web application; If upload failure, browser can be uploaded the indication information of failure to the web application feedback.
Can find out by technique scheme; Browser is determined the upload request corresponding protocols type that the technological web application of creating of Ajax issues earlier in this enforcement; Upload data according to the pairing processing mode of the protocol type of determining to corresponding server; Can realize web application of creating based on the Ajax technology and the server interaction data that adopt each multi-protocols being applicable to plurality of application scenes, help expanding Ajax The Application of Technology scope.
Be the better implement technique scheme, a kind of browser also is provided in the embodiment of the invention.
Embodiment three,
A kind ofbrowser 300 that sees also Fig. 3, the embodiment of the invention three can comprise:receiver module 310,determination module 320,download module 330 and sendingmodule 340.
Wherein,receiver module 310 is used to receive the download request that issues based on the technological web application of creating of Ajax, and this download request is carried the URL of web application request data downloaded.
Determination module 320 is used for confirming above-mentioned download request corresponding protocols type.
Under a kind of application scenarios, the download request that the web application of creating based on the Ajax technology issues can be carried the URL of request data downloaded, and other relevant parameter etc.
Wherein, the URL that carries of the download request that receives ofreceiver module 310 comprises the address information and the routing information of this data on this server of the server of storing above-mentioned request data downloaded.
The URL that download request is carried can also comprise the protocol type sign of indicating this download request corresponding protocols type, and download request corresponding protocols type is just stored the protocol type that server adopted of above-mentioned request data downloaded.
Download module 330 is used for the pairing processing mode of protocol type confirmed according todetermination module 320, according to above-mentioned URL data download from the corresponding server.
In practical application;Determination module 320 is determined download request corresponding protocols type; Also just determined the protocol type that server adopted of storing above-mentioned request data downloaded;Download module 330 and then can be, the URL that carries according to download request data download from the corresponding server according to the pairing downloading mode of the protocol type thatdetermination module 320 is determined.
Sendingmodule 340 is used for afterdownload module 330 data are downloaded successfully, sendsdownload module 330 from respective server success data downloaded to above-mentioned web application.
Under a kind of application scenarios,determination module 320 can comprise:
Detection sub-module 321 is used to detect the protocol type sign that above-mentioned URL comprises.
Confirm submodule 322, be used for result, confirm above-mentioned download request corresponding protocols type according to detection sub-module 322 detections.
For instance, whendetection sub-module 321 detects protocol type that URL comprises and is designated FTP, confirm that it is FTP that submodule 322 is determined download request corresponding protocols type; Whendetection sub-module 321 detects protocol type that URL comprises and is designated FILE, confirm that it is file protocol that submodule 322 is determined download request corresponding protocols type; Whendetection sub-module 321 detects protocol type that URL comprises and is designated RES, confirm that it is the RES agreement that submodule 322 is determined download request corresponding protocols type, by that analogy.
Under a kind of application scenarios; Determining download request corresponding protocols type whendetermination module 320 is local file system corresponding protocols type; 330 of download modules can be according to the pairing processing mode of the protocol type of local file system, according to URL from local file system file in download resource.
Further;Browser 300 is used the protocol type of agreement acquiescence in advance with the page; Whendetection sub-module 321 detects the protocol type sign that URL that download request carries do not comprise, confirm thatsubmodule 322 directly determines this download request corresponding protocols type and be the protocol type of agreement acquiescence in advance.
In addition; The download request that the above-mentioned web application of creating based on the Ajax technology issues also can be carried the indication information that other is used to indicate this download request corresponding protocols type; At this moment;Determination module 320 can detect above-mentioned indication information, and according to testing result, confirms above-mentioned download request corresponding protocols type.
It is understandable that; Thisenforcement browser 300 can be like the browser among the embodiment one; The function of its each functional module can specifically realize that its concrete implementation procedure can repeat no more with reference to the associated description among the embodiment according to the method among the embodiment one here.
Can find out by technique scheme;Browser 300 is determined the download request corresponding protocols type that the technological web application of creating of Ajax issues earlier in this enforcement; According to the pairing processing mode of the protocol type of determining data download from the corresponding server; Can realize web application of creating based on the Ajax technology and the server interaction data that adopt various protocols being applicable to plurality of application scenes, help expanding Ajax The Application of Technology scope.
Embodiment four,
A kind ofbrowser 400 that sees also Fig. 4, the embodiment of the invention four can comprise:receiver module 410,determination module 420 andlast transmission module 430.
Wherein,receiver module 410 is used to receive the upload request that the web application created based on the Ajax technology issues, and this upload request is carried the data that above-mentioned web application request uploads and the URL of this data upload.
Determination module 420 is used for confirming above-mentioned upload request corresponding protocols type.
Under a kind of application scenarios, the data that the upload request request of can carrying that the web application of creating based on the Ajax technology issues is uploaded and the URL of this data upload can also carry other relevant parameter etc.
Wherein, the URL that carries of the upload request that receives ofreceiver module 410 comprise data address information and this data upload relative path information to this server of the server that will upload to.
The URL that upload request is carried can also comprise the protocol type sign of indicating this upload request corresponding protocols type, and upload request corresponding protocols type just data the protocol type that server adopted that will upload to.
Last transmission module 430 is used for the pairing processing mode of protocol type confirmed according todetermination module 420, uploads corresponding data according to above-mentioned URL to corresponding server.
Under a kind of application scenarios,determination module 420 can comprise:
Detection sub-module 421 is used to detect the protocol type sign that above-mentioned URL comprises.
Confirm submodule 422, be used for result, confirm above-mentioned upload request corresponding protocols type according to detection sub-module 421 detections.
For instance, whendetection sub-module 421 detects protocol type that URL comprises and is designated FTP, confirm that it is FTP that submodule 422 is determined upload request corresponding protocols type; Whendetection sub-module 421 detects protocol type that URL comprises and is designated FILE, confirm that it is file protocol that submodule 422 is determined upload request corresponding protocols type; Whendetection sub-module 421 detects protocol type that URL comprises and is designated RES; Confirm that it is resource protocol that submodule 422 is determined upload request corresponding protocols type; Whendetection sub-module 421 detects protocol type that URL comprises and is designated HTTP; Confirm that it is HTTP that submodule 422 is determined upload request corresponding protocols type, by that analogy.
Under a kind of application scenarios; Determining upload request corresponding protocols type whendetermination module 420 is local file system corresponding protocols type; 430 of last transmission modules can be uploaded data according to URL to local file system according to the pairing processing mode of the protocol type of local file system.
Further;Browser 400 is used the protocol type of agreement acquiescence in advance with the page; Whendetection sub-module 421 detects the protocol type sign that URL that upload request carries do not comprise, confirm thatsubmodule 422 directly determines this upload request corresponding protocols type and be the protocol type of agreement acquiescence in advance.
In addition; The upload request that the above-mentioned web application of creating based on the Ajax technology issues also can be carried the indication information that other is used to indicate this upload request corresponding protocols type; At this moment;Determination module 420 can detect above-mentioned indication information, and according to testing result, confirms this upload request corresponding protocols type.
It is understandable that; Thisenforcement browser 400 can be like the browser among the embodiment two; The function of its each functional module can specifically realize that its concrete implementation procedure can repeat no more with reference to the associated description among the embodiment according to the method among the embodiment two here.
Can find out by technique scheme; Thisenforcement browser 400 is determined the upload request corresponding protocols type that the technological web application of creating of Ajax issues earlier; Upload data according to the pairing processing mode of the protocol type of determining to corresponding server; Can realize web application of creating based on the Ajax technology and the server interaction data that adopt various protocols being applicable to plurality of application scenes, help expanding Ajax The Application of Technology scope.
Need to prove; For aforesaid each method embodiment, for simple description, so it all is expressed as a series of combination of actions; But those skilled in the art should know; The present invention does not receive the restriction of described sequence of movement, because according to the present invention, some step can adopt other orders or carry out simultaneously.Secondly, those skilled in the art also should know, the embodiment described in the specification all belongs to preferred embodiment, and related action and module might not be that the present invention is necessary.
In the above-described embodiments, the description of each embodiment is all emphasized particularly on different fields, do not have the part that details among certain embodiment, can be referring to the associated description of other embodiment.
In sum; In the embodiment of the invention; Browser is determined the interactive request corresponding protocols type that issues based on the technological web application of creating of Ajax earlier, and according to pairing processing mode of the protocol type of determining and corresponding server interaction data, can realize web application and the server interaction data that adopt various protocols based on the establishment of Ajax technology; Be applicable to plurality of application scenes, help expanding Ajax The Application of Technology scope.
One of ordinary skill in the art will appreciate that all or part of step in the whole bag of tricks of the foregoing description is to instruct relevant hardware to accomplish through program; This program can be stored in the computer-readable recording medium, and storage medium can comprise: read-only memory, at random store its, disk or CD etc.
More than a kind of data download method that the embodiment of the invention provided and data uploading method and browser have been carried out detailed introduction; Used concrete example among this paper principle of the present invention and execution mode are set forth, the explanation of above embodiment just is used for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, the part that on embodiment and range of application, all can change, in sum, this description should not be construed as limitation of the present invention.