CN109788073A - A kind of method of file download in Web system - Google Patents

A kind of method of file download in Web system Download PDF

Info

Publication number
CN109788073A
CN109788073A CN201910181396.7A CN201910181396A CN109788073A CN 109788073 A CN109788073 A CN 109788073A CN 201910181396 A CN201910181396 A CN 201910181396A CN 109788073 A CN109788073 A CN 109788073A
Authority
CN
China
Prior art keywords
file
data
request
client
server end
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN201910181396.7A
Other languages
Chinese (zh)
Inventor
朱灵蕾
李波
岳永胜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Changhong Electric Co Ltd
Original Assignee
Sichuan Changhong Electric Co Ltd
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 Sichuan Changhong Electric Co Ltd filed Critical Sichuan Changhong Electric Co Ltd
Priority to CN201910181396.7A priority Critical patent/CN109788073A/en
Publication of CN109788073A publication Critical patent/CN109788073A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a kind of methods of file download in Web system, belong to Internet technical field.It solves in the case where not changing server end and client agreement time-out time, because file is too big, the server end time longer problem for leading to time-out.Step 1: client sends request Q1, received server-side is to after requesting according to client request Q1Parameter, return corresponding picture number, table item number or other can evaluate the total amount of data N of file size, while server starts to generate downloading file W;Step 2: the total amount of data N that client is returned according to server end requests Q come computation requests time interval t to send2Inquire the whether generated downloading file W of server end;If the generated downloading file W of servers' data, is immediately performed step 3;Conversely, then latency period t issues the request Q of the inquiry whether packed data of server end again3;Step 3: file is downloaded according to the address of the W of return.

Description

A kind of method of file download in Web system
Technical field
The present invention relates to Internet technical fields, particularly belong to the front-end and back-end field of Web platform development technology, are related to A kind of method of file download in Web system.
Background technique
As network is universal and develops, Web application function abundantization, user's request server end file is also more and more normal See.It is related to data management, the Web platform management system of pictures management nearly all has the demand for downloading file.
Having a kind of common method for down loading in existing Web file download technology is after user initiates request, and rear end is by user The file generated of request it is good or it is packed be placed on the accessible address of some user, and provide a user download link, use Link is taken at family can download file and compressed package.All operations are all to complete in the primary request, however work as file ratio When larger, rear end prepares compressed package and the time of file is more long, will lead to the request timed out of user, to download mistake It loses.Such as list data reaches ten thousand datas or more to user's request, high definition picture file is more than that 100 these application scenarios exist It is relatively common in Web application.And these situations use common technical solution, with regard to will appear request timed out problem.
Summary of the invention
In order to solve in the case where not changing server end and client agreement time-out time, in web system, because of file Too big, the server end time longer problem for leading to time-out, the present invention provides a kind of side of file download in Web system Method.
To achieve the goals above, the invention adopts the following technical scheme:
A kind of method of file download in Web system, comprising the following steps:
Step 1: client sends request Q1, received server-side is to after requesting according to client request Q1Parameter, return Return corresponding picture number, table item number or other can evaluate the total amount of data N of file size, while server starts to generate Download file W;
Step 2: client according to the total amount of data N that server end returns come computation requests time interval t, according to request Time interval t requests Q to send2Inquire the whether generated downloading file W of server end;If servers' data is generated Downloading file W, is immediately performed step 3;Conversely, if request results are server ends there are no generated downloading file W, Latency period t issues the request Q of the inquiry whether packed data of server end again3, such circulation step two is until entering Step 3;
Step 3: file is downloaded according to the address of the W of return.
Specifically, in the step 1, Q1It is just returned the result after being ready in request without waiting for W, as long as data are total Amount N returns to client.
Specifically, time interval t is according to request Q in the step 21Return to the value that the data come are calculated.
Specifically, the calculation method of the time interval t is as follows: time interval: t=N*m/t ';Wherein N is that data are total Amount, m are every data mean sizes, and t ' is average time required for generating a data.
Compared with the prior art, the invention has the beneficial effects that:
1, the present invention and the difference of conventional method are the difference and more step 2 of step 1.Conventional method is in step Server is required to return to the address of W file in rapid one, it can request timed out when such W is excessive.Present design procedure one Middle request does not require to return to the address of W, Q1It is just returned the result after being ready in request without waiting for W, as long as returning to N to client , Q can be led in this way to avoid because server prepares W overlong time1Request timed out.More simultaneously step 2, client The t time is waited to send whether request query server W is ready to.If the generated downloading file W of servers' data, stands Execute step 3;Conversely, latency period t is again if request results are server ends there are no generated downloading file W Issue the request Q of the inquiry whether packed data of server end3, such circulation step two is until entering third step i.e. according to return W address download file.The present invention optimizes Web system existing file method for down loading row, solves the excessive situation of file The problem of lower file download request timed out.
Detailed description of the invention
Fig. 1 is the interaction signal of the client and server of the method for file download in a kind of Web system of the invention Figure.
Specific embodiment
The present invention will be further described with reference to the examples below, and described embodiment is only present invention a part Embodiment is not whole embodiment.Based on the embodiments of the present invention, those skilled in the art are not making Other embodiments used obtained, belong to protection scope of the present invention under the premise of creative work.
Embodiment 1:
Since the file of user's request is excessive, the time of server end document has required more than server end and client Arrange time-out time, client judges request timed out, is then turned off request connection, failed download.
For this problem, solution proposed by the present invention is: when data volume is larger, by downloading request by original 2 steps are improved to 3 steps:
A kind of method of file download in Web system, comprising the following steps:
Step 1 as shown in Figure 1:: client sends request Q1, received server-side is to after requesting according to client request Q1 Parameter, return corresponding picture number, table item number or other can evaluate the total amount of data N of file size, service simultaneously Device starts to generate downloading file W;Q1It is just returned the result after being ready in request without waiting for W, is as long as returning to N to client Can, Q can be led in this way to avoid because server prepares W overlong time1Request timed out.
Step 2: client according to the total amount of data N that server end returns come computation requests time interval t, according to request Time interval t requests Q to send2Inquire the whether generated downloading file W of server end;If servers' data is generated Downloading file W, is immediately performed step 3;Conversely, if request results are server ends there are no generated downloading file W, Latency period t issues the request Q of the inquiry whether packed data of server end again3, such circulation step two is until entering Step 3;
Step 3: file is downloaded according to the address of the W of return.
The difference of method and conventional method provided by the invention is the difference and more step 2 of step 1.Tradition Method requires server to return to the address of W file in step 1, can request timed out when such W is excessive.Present sets Meter step 1 request does not require to return to the address of W, while more step 2, and client waits the t time to send request query service Whether device W is ready to.
Since the file size of user's request is different, inquiry W whether ready request time interval t cannot uniformly be set It is fixed.If the t of setting is too small relative to the time that service prepares W, it will lead to client and repeatedly send whether request query W prepares It is good.If the t of setting is excessive relative to the time that service prepares W, it will lead to server end and get out the address W already, and client End does not send inquiry request for a long time, causes download time too long.
For this problem, the design is using calculating a time interval t according to demand file size.Between time It is request Q every t1Return to the value that the data come are calculated.The major function of t is to determine Q2、Q3... the time between request Interval.When the data volume of request is small, i.e., server end can get out downloading data faster, and time interval can set small It is some.In the case that the data volume of request is bigger, server end can need several minutes can just get out downloading data, Time interval can set longer, reduce the number of request.
Specifically, the calculation method of the time interval t is as follows: time interval: t=N*m/t ';Wherein N is that data are total Amount, m are every data mean sizes, and t ' is average time required for generating a data.
The present invention optimizes Web system existing file method for down loading row, solves file download in the excessive situation of file The problem of request timed out.The method of file download can be used for form document in Web system in Web system provided by the invention Picture file downloading in downloading, Web system, and other file downloads of file size can be estimated.
When having file, picture, table download function demand in Web system as shown in Figure 1:, described using the present invention Method realize downloading, in detail realize steps are as follows:
Step 1: writing following 5 programs:
1) customer terminal webpage program F1, program function is to click that the request Q for sending file download can be triggered1
2) server F2, program function is after receiving client download requests while to do two pieces thing: 1. being replied Request Q1, reply content is the size N of file W;2. starting to generate demand file W.
3) customer terminal webpage program F3, program function is acquisition request Q1N in reply calculates time interval t.Every t Second to server end send request, inquiry file W whether be ready to.
4) server F4, program function is to receive the inquiry request from customer terminal webpage, if file W is ready to , client's device end page face is given in the address for returning to W, if being not ready for, returns to the mark being not ready for and gives client's device end page face.
5) customer terminal webpage program F5If program function is the reply for receiving inquiry request, if obtained reply is the ground of W This document is just downloaded according to address in location, if receiving the mark that W is not ready for, whether interval t retransmits request query W quasi- It gets ready, the address until taking W.
Step 2: clicking trigger program F1, and then trigger and successively execute program F2, F3, F4, F5Realize download function.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all in essence of the invention Made any modifications, equivalent replacements, and improvements etc., should all be included in the protection scope of the present invention within mind and principle.

Claims (4)

1. a kind of method of file download in Web system, it is characterised in that: the following steps are included:
Step 1: client sends request Q1, received server-side is to after requesting according to client request Q1Parameter, return phase The picture number answered, table item number or other can evaluate the total amount of data N of file size, while server starts to generate downloading File W;
Step 2: client according to the total amount of data N that server end returns come computation requests time interval t, according to request time Interval t requests Q to send2Inquire the whether generated downloading file W of server end;Under if servers' data is generated Publish papers part W, is immediately performed step 3;Conversely, then latency period t issues the inquiry whether packed data of server end again Request Q3, such circulation step two is until entering step three;
Step 3: file is downloaded according to the address of the W of return.
2. the method for file download in a kind of Web system according to claim 1, it is characterised in that: in the step 1, Q1It is just returned the result after being ready in request without waiting for W, as long as total amount of data N is returned to client.
3. the method for file download in a kind of Web system according to claim 1, it is characterised in that: in the step 2, Time interval t is according to request Q1Return to the value that the data come are calculated.
4. the method for file download in a kind of Web system according to claim 3, it is characterised in that: the time interval t Calculation method it is as follows: time interval: t=N*m/t ';Wherein N is total amount of data, and m is every data mean size, and t ' is raw At average time required for a data.
CN201910181396.7A 2019-03-11 2019-03-11 A kind of method of file download in Web system Pending CN109788073A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910181396.7A CN109788073A (en) 2019-03-11 2019-03-11 A kind of method of file download in Web system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910181396.7A CN109788073A (en) 2019-03-11 2019-03-11 A kind of method of file download in Web system

Publications (1)

Publication Number Publication Date
CN109788073A true CN109788073A (en) 2019-05-21

Family

ID=66488951

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910181396.7A Pending CN109788073A (en) 2019-03-11 2019-03-11 A kind of method of file download in Web system

Country Status (1)

Country Link
CN (1) CN109788073A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101064639A (en) * 2006-04-29 2007-10-31 中兴通讯股份有限公司 Method for transmitting files between management entity and agent entity of mobile communication network
CN101964739A (en) * 2009-07-22 2011-02-02 中国移动通信集团公司 Data transmission method, device and system
US20160092648A1 (en) * 2014-09-25 2016-03-31 George Mitchell Angelos Risk management system directed to health care environments and methods of using the same
CN106412137A (en) * 2016-12-20 2017-02-15 北京并行科技股份有限公司 File downloading system and file downloading method
CN107181787A (en) * 2017-03-21 2017-09-19 阿里巴巴集团控股有限公司 A kind of request processing method and device
CN107665235A (en) * 2017-07-27 2018-02-06 上海壹账通金融科技有限公司 Method for caching and processing, device, computer equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101064639A (en) * 2006-04-29 2007-10-31 中兴通讯股份有限公司 Method for transmitting files between management entity and agent entity of mobile communication network
CN101964739A (en) * 2009-07-22 2011-02-02 中国移动通信集团公司 Data transmission method, device and system
US20160092648A1 (en) * 2014-09-25 2016-03-31 George Mitchell Angelos Risk management system directed to health care environments and methods of using the same
CN106412137A (en) * 2016-12-20 2017-02-15 北京并行科技股份有限公司 File downloading system and file downloading method
CN107181787A (en) * 2017-03-21 2017-09-19 阿里巴巴集团控股有限公司 A kind of request processing method and device
CN107665235A (en) * 2017-07-27 2018-02-06 上海壹账通金融科技有限公司 Method for caching and processing, device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
US10491534B2 (en) Managing resources and entries in tracking information in resource cache components
CN108510389B (en) Intelligent contract calling method and device based on block chain and readable storage medium
JP6626211B2 (en) Method and apparatus for processing short link and short link server
CN101409706B (en) Method, system and relevant equipment for distributing data of edge network
CN110430274A (en) A kind of document down loading method and system based on cloud storage
CN110557284B (en) Data aggregation method and device based on client gateway
CN109491758A (en) Docker mirror image distribution method, system, data gateway and computer readable storage medium
CN103297447B (en) A kind of resource share method and its equipment
CN103973475A (en) Difference service pack generating method, difference service pack downloading method, server and client-side
CN105472045A (en) Database migration method and database migration device
CN110012068B (en) Download control method, device and storage medium
CN107547591A (en) Upgrade server, set top box, set top box upgrading file delivery method and system
CN108874472B (en) Method and system for optimally displaying user head portraits
CN109032693A (en) Method and device for loading display information, electronic equipment and readable storage medium
CN112307058A (en) Short link processing method and device, storage medium and computer equipment
CN109788073A (en) A kind of method of file download in Web system
CN111182053A (en) Method and device for downloading file, computer storage medium and terminal
CN111478951B (en) File issuing method and device
CN110474954B (en) Block chain-based file sharing method and device, computer equipment and readable storage medium
CN106326296A (en) Data query method and device
CN108156246A (en) A kind of document distribution method, system, server and client
CN113849125A (en) Method, device and system for reading disk of CDN server
CN110267107A (en) A kind of software upgrade package method for down loading, system and storage medium
CN109756464A (en) A kind of communication means and server, client
CN107332679B (en) Centerless information synchronization method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20190521

RJ01 Rejection of invention patent application after publication