CN103547339B - File uploading method, client side and server side - Google Patents
File uploading method, client side and server side Download PDFInfo
- Publication number
- CN103547339B CN103547339B CN201380000611.XA CN201380000611A CN103547339B CN 103547339 B CN103547339 B CN 103547339B CN 201380000611 A CN201380000611 A CN 201380000611A CN 103547339 B CN103547339 B CN 103547339B
- Authority
- CN
- China
- Prior art keywords
- upload
- file
- loopback address
- client
- header field
- 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.)
- Active
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/06—Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Transfer Between Computers (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本发明实施例提供一种文件上传方法、客户端和服务端,涉及互联网领域,能够简化文件上传方式,增强上传前后处理能力,且应用服务端无需购买和维护存储设备。其方法为:上传服务端接收客户端发送的请求消息,请求消息包括请求头域,根据请求消息中的请求头域判断是否满足文件的接收条件,若满足文件的接收条件,则接收文件,并根据回调地址向应用服务端发送通知消息,其中,回调地址是在客户端发送的请求消息的请求头域中携带的,或回调地址是从应用服务端获取的。本发明实施例用于上传文件。
Embodiments of the present invention provide a file upload method, a client and a server, which relate to the Internet field, can simplify file upload methods, and enhance processing capabilities before and after uploading, and the application server does not need to purchase and maintain storage devices. The method is as follows: the uploading server receives the request message sent by the client, the request message includes the request header field, judges whether the receiving condition of the file is satisfied according to the request header field in the request message, if the receiving condition of the file is satisfied, then receives the file, and Send a notification message to the application server according to the callback address, wherein the callback address is carried in the request header field of the request message sent by the client, or the callback address is obtained from the application server. The embodiment of the present invention is used for uploading files.
Description
技术领域technical field
本发明涉及互联网领域,尤其涉及一种文件上传方法、客户端和服务端。The invention relates to the Internet field, in particular to a file uploading method, a client and a server.
背景技术Background technique
随着互联网的高速发展,越来越多的网站提供上传工具,鼓励用户上传文件。但是由于网站上传服务器的性能、带宽、安全等的限制,用户上传文件的效率受到了严重影响,现有技术中,能够改善上传体验的方法,主要有两种:一种是CDN(Content DeliveryNetwork,内容分发网络)上传加速功能,一种是使用云存储。With the rapid development of the Internet, more and more websites provide upload tools to encourage users to upload files. However, due to the limitations of the performance, bandwidth, security, etc. of the website upload server, the efficiency of user upload files has been seriously affected. In the prior art, there are mainly two methods for improving the upload experience: one is CDN (Content Delivery Network, CDN) upload acceleration function, one is to use cloud storage.
具体的,CDN主要提供了上传加速和下载加速功能。其中,上传加速的方法为:用户将文件上传到CDN节点,CDN节点将文件传输到网站,这样,用户需要进行2次文件上传,才能将文件上传到网站。而云存储是将网络中大量的各种不同类型的存储设备通过应用软件集合起来协同工作,共同对外提供数据存储和业务访问服务。当使用云存储的方法时,用户可以将文件上传到网站,网站再将文件上传至云存储。Specifically, the CDN mainly provides upload acceleration and download acceleration functions. Among them, the upload acceleration method is: the user uploads the file to the CDN node, and the CDN node transmits the file to the website. In this way, the user needs to upload the file twice before uploading the file to the website. Cloud storage is a collection of a large number of different types of storage devices in the network to work together through application software to jointly provide data storage and business access services. When using the cloud storage method, users can upload files to the website, and the website uploads the files to the cloud storage.
因此,在上述两种方法中,用户的文件都需要进行2次上传,在CDN上传加速方法中,还需要购买和维护存储设施。另外,在云存储方法中,当上传完文件后,可能存在浏览器还需要与网络服务器再进行一次交互,如果是应用在CDN系统中,需要对应用逻辑做比较大的修改,并且Amazon S3(Amazon Simple Storage Service,亚马逊简易储存服务)为中心集中式服务,给用户上传文件带来不便。Therefore, in the above two methods, the user's files need to be uploaded twice, and in the CDN upload acceleration method, it is also necessary to purchase and maintain storage facilities. In addition, in the cloud storage method, after the file is uploaded, the browser may need to interact with the web server again. If it is applied in the CDN system, the application logic needs to be greatly modified, and Amazon S3 ( Amazon Simple Storage Service, Amazon Simple Storage Service) is a centralized service, which brings inconvenience to users to upload files.
发明内容Contents of the invention
本发明的实施例提供一种文件上传方法、客户端和服务端,能够简化文件上传方式,增强上传前后处理能力,且应用服务端无需购买和维护存储设备。Embodiments of the present invention provide a file uploading method, a client and a server, which can simplify file upload methods and enhance processing capabilities before and after uploading, and the application server does not need to purchase and maintain storage devices.
为达到上述目的,本发明的实施例采用如下技术方案:In order to achieve the above object, embodiments of the present invention adopt the following technical solutions:
第一方面,提供一种文件上传方法,包括:In the first aspect, a file upload method is provided, including:
接收客户端发送的请求消息,所述请求消息包括请求头域;receiving a request message sent by the client, where the request message includes a request header field;
根据所述请求消息中的请求头域判断是否满足文件的接收条件;judging whether the receiving condition of the file is satisfied according to the request header field in the request message;
若满足所述文件的接收条件,则接收所述文件,并根据回调地址向应用服务端发送通知消息。If the receiving condition of the file is satisfied, the file is received, and a notification message is sent to the application server according to the callback address.
结合第一方面,在第一种可能实现的方式中,所述回调地址包括上传前回调地址和上传后回调地址。With reference to the first aspect, in a first possible implementation manner, the callback address includes a pre-upload callback address and a post-upload callback address.
结合第一方面的第一种可能实现的方式,在第二种可能实现的方式中,所述请求头域还包括应用标识,所述应用标识是用来标识所述应用服务端的。With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner, the request header field further includes an application identifier, and the application identifier is used to identify the application server.
结合第一方面的第二种可能实现的方式,在第三种可能实现的方式中,所述回调地址是在所述客户端发送的请求消息的请求头域中携带的,或所述回调地址是从所述应用服务端获取的。With reference to the second possible implementation manner of the first aspect, in the third possible implementation manner, the callback address is carried in the request header field of the request message sent by the client, or the callback address obtained from the application server.
结合第一方面的第三种可能实现的方式,在第四种可能实现的方式中,当所述回调地址是从所述应用服务端获取的时,还包括:In combination with the third possible implementation manner of the first aspect, in the fourth possible implementation manner, when the callback address is obtained from the application server, it further includes:
接收所述应用服务端发送的注册消息,所述注册消息包括所述回调地址;receiving a registration message sent by the application server, where the registration message includes the callback address;
将所述回调地址保存在数据库中。Save the callback address in a database.
结合第一方面的第四种可能实现的方式,在第五种可能实现的方式中,当所述回调地址是从所述应用服务端获取的时,所述若满足所述文件的接收条件,则接收所述文件,并根据回调地址向应用服务端发送通知消息包括:With reference to the fourth possible implementation manner of the first aspect, in the fifth possible implementation manner, when the callback address is obtained from the application server, if the receiving condition of the file is met, Then receiving the file, and sending a notification message to the application server according to the callback address includes:
若满足所述文件的接收条件,则根据应用标识从所述数据库中获取所述上传前回调地址,并调用所述上传前回调地址向所述应用服务端发送第一通知消息,所述第一通知消息包括所述文件的第一文件信息;If the receiving condition of the file is satisfied, obtain the pre-upload callback address from the database according to the application identifier, and call the pre-upload callback address to send a first notification message to the application server, the first The notification message includes first file information of the file;
向所述客户端发送上传响应消息,所述上传响应消息包括所述请求头域,以便于所述客户端继续上传所述文件;Send an upload response message to the client, where the upload response message includes the request header field, so that the client can continue to upload the file;
接收并存储所述客户端根据所述上传响应消息发送的所述文件,而后根据所述应用标识从所述数据库中获取所述上传后回调地址,并调用所述上传后回调地址向所述应用服务端发送第二通知消息,所述第二通知消息包括所述文件的第二文件信息。receiving and storing the file sent by the client according to the upload response message, then obtaining the post-upload callback address from the database according to the application identifier, and calling the post-upload callback address to the application The server sends a second notification message, where the second notification message includes second file information of the file.
结合第一方面的第三种可能实现的方式,在第六种可能实现的方式中,当所述回调地址是在所述客户端发送的请求消息的请求头域中携带的时,所述若满足所述文件的接收条件,则接收所述文件,并根据回调地址向应用服务端发送通知消息包括:With reference to the third possible implementation manner of the first aspect, in a sixth possible implementation manner, when the callback address is carried in the request header field of the request message sent by the client, the if If the receiving condition of the file is met, the file is received, and sending a notification message to the application server according to the callback address includes:
若满足所述文件的接收条件,则从所述请求头域中获取所述上传前回调地址,并调用所述上传前回调地址向所述应用服务端发送第一通知消息,所述第一通知消息包括所述文件的第一文件信息;If the receiving condition of the file is satisfied, obtain the pre-upload callback address from the request header field, and call the pre-upload callback address to send a first notification message to the application server, the first notification the message includes first file information of the file;
向所述客户端发送上传响应消息,所述上传响应消息包括所述请求头域,以便于所述客户端继续上传所述文件;Send an upload response message to the client, where the upload response message includes the request header field, so that the client can continue to upload the file;
接收并存储所述客户端根据所述上传响应消息发送的所述文件,而后从所述请求头域中获取所述上传后回调地址,并调用所述上传后回调地址向所述应用服务端发送第二通知消息,所述第二通知消息包括所述文件的第二文件信息。receiving and storing the file sent by the client according to the upload response message, then obtaining the post-upload callback address from the request header field, and calling the post-upload callback address to send the file to the application server A second notification message, where the second notification message includes second file information of the file.
结合第一方面或第一方面的第一种可能实现的方式至第六种可能实现的方式,在第七种可能实现的方式中,所述方法还包括:In combination with the first aspect or the first possible implementation manner to the sixth possible implementation manner of the first aspect, in a seventh possible implementation manner, the method further includes:
在接收完所述文件后,向所述客户端发送完成响应消息。After receiving the file, send a completion response message to the client.
第二方面,提供一种文件上传方法,包括:In the second aspect, a file upload method is provided, including:
向上传服务端发送注册消息,所述注册消息包括文件上传时的回调地址;Send a registration message to the upload server, the registration message includes a callback address when the file is uploaded;
在注册完成后,接收所述上传服务端根据所述回调地址发送的文件上传的通知消息,以获取所述文件的文件信息。After the registration is completed, receive the file upload notification message sent by the upload server according to the callback address, so as to obtain the file information of the file.
结合第二方面,在第一种可能实现的方式中,所述回调地址包括上传前回调地址和上传后回调地址。With reference to the second aspect, in a first possible implementation manner, the callback address includes a pre-upload callback address and a post-upload callback address.
结合第二方面的第一种可能实现的方式,在第二种可能实现的方式中,所述接收所述上传服务端根据所述回调地址发送的文件上传的通知消息,以获取所述文件的文件信息包括:With reference to the first possible implementation manner of the second aspect, in the second possible implementation manner, the receiving the file upload notification message sent by the upload server according to the callback address to obtain the File information includes:
接收所述上传服务端根据所述上传前回调地址发送的第一通知消息,所述第一通知消息包括所述文件的第一文件信息;receiving a first notification message sent by the upload server according to the pre-upload callback address, the first notification message including first file information of the file;
当所述上传服务端接收完所述文件时,接收所述上传服务端根据所述上传后回调地址发送的第二通知消息,所述第二通知消息包括所述文件的第二文件信息。When the upload server finishes receiving the file, receive a second notification message sent by the upload server according to the post-upload callback address, the second notification message includes second file information of the file.
第三方面,提供一种文件上传方法,包括:In the third aspect, a file upload method is provided, including:
向上传服务端发送请求消息,所述请求消息包括请求头域;Send a request message to the upload server, where the request message includes a request header field;
接收所述上传服务端发送的上传响应消息,所述上传响应消息包括所述请求头域;receiving an upload response message sent by the upload server, where the upload response message includes the request header field;
根据所述上传响应消息,向所述上传服务端上传文件。Upload the file to the upload server according to the upload response message.
结合第三方面,在第一种可能实现的方式中,所述请求头域包括应用标识,或者所述请求头域包括回调地址和所述应用标识。With reference to the third aspect, in a first possible implementation manner, the request header field includes an application identifier, or the request header field includes a callback address and the application identifier.
结合第三方面的第一种可能实现的方式,在第二种可能实现的方式中,所述方法还包括:In combination with the first possible implementation manner of the third aspect, in the second possible implementation manner, the method further includes:
在所述上传服务端通过所述回调地址向应用服务端回调成功之后,接收所述上传服务端发送的完成响应消息。After the upload server successfully calls back to the application server through the callback address, it receives a completion response message sent by the upload server.
第四方面,提供一种上传服务端,包括:In the fourth aspect, an upload server is provided, including:
接收单元,用于接收客户端发送的请求消息,所述请求消息包括请求头域;A receiving unit, configured to receive a request message sent by the client, where the request message includes a request header field;
判断单元,用于根据所述请求消息中的请求头域判断是否满足文件的接收条件;A judging unit, configured to judge whether the receiving condition of the file is satisfied according to the request header field in the request message;
处理单元,用于若满足所述文件的接收条件,则接收所述文件,并根据回调地址向应用服务端发送通知消息。The processing unit is configured to receive the file if the receiving condition of the file is satisfied, and send a notification message to the application server according to the callback address.
结合第四方面,在第一种可能实现的方式中,所述回调地址包括上传前回调地址和上传后回调地址。With reference to the fourth aspect, in a first possible implementation manner, the callback address includes a pre-upload callback address and a post-upload callback address.
结合第四方面的第一种可能实现的方式,在第二种可能实现的方式中,所述请求头域还包括应用标识,所述应用标识是用来标识所述应用服务端的。With reference to the first possible implementation manner of the fourth aspect, in a second possible implementation manner, the request header field further includes an application identifier, and the application identifier is used to identify the application server.
结合第四方面的第二种可能实现的方式,在第三种可能实现的方式中,所述回调地址是在所述客户端发送的请求消息的请求头域中携带的,或所述回调地址是从所述应用服务端获取的。With reference to the second possible implementation manner of the fourth aspect, in the third possible implementation manner, the callback address is carried in the request header field of the request message sent by the client, or the callback address obtained from the application server.
结合第四方面的第三种可能实现的方式,在第四种可能实现的方式中,当所述回调地址是从所述应用服务端获取的时,还包括:With reference to the third possible implementation manner of the fourth aspect, in the fourth possible implementation manner, when the callback address is obtained from the application server, it further includes:
第一接收单元,用于接收所述应用服务端发送的注册消息,所述注册消息包括所述回调地址;A first receiving unit, configured to receive a registration message sent by the application server, where the registration message includes the callback address;
存储单元,用于将所述回调地址保存在数据库中。A storage unit, configured to store the callback address in a database.
结合第四方面的第四种可能实现的方式,在第五种可能实现的方式中,当所述回调地址是从所述应用服务端获取的时,所述处理单元包括:With reference to the fourth possible implementation manner of the fourth aspect, in a fifth possible implementation manner, when the callback address is obtained from the application server, the processing unit includes:
第一处理子单元,用于若满足所述文件接收条件,则根据应用标识从所述数据库中获取所述上传前回调地址,并调用所述上传前回调地址向所述应用服务端发送第一通知消息,所述第一通知消息包括所述文件的第一文件信息;The first processing subunit is configured to obtain the pre-upload callback address from the database according to the application identifier if the file receiving condition is met, and call the pre-upload callback address to send the first file to the application server. a notification message, the first notification message includes first file information of the file;
第一发送子单元,用于向所述客户端发送上传响应消息,所述上传响应消息包括所述请求头域,以便于所述客户端继续上传所述文件;A first sending subunit, configured to send an upload response message to the client, where the upload response message includes the request header field, so that the client can continue to upload the file;
第二处理子单元,用于接收并存储所述客户端根据所述上传响应消息发送的所述文件,而后根据所述应用标识从所述数据库中获取所述上传后回调地址,并调用所述上传后回调地址向所述应用服务端发送第二通知消息,所述第二通知消息包括所述文件的第二文件信息。The second processing subunit is configured to receive and store the file sent by the client according to the upload response message, and then obtain the post-upload callback address from the database according to the application identifier, and call the The post-upload callback address sends a second notification message to the application server, where the second notification message includes second file information of the file.
结合第四方面或第四方面的第三种可能实现的方式,在第六种可能实现的方式中,当所述回调地址是在所述客户端发送的请求消息的请求头域中携带的时,所述处理单元包括:With reference to the fourth aspect or the third possible implementation manner of the fourth aspect, in the sixth possible implementation manner, when the callback address is carried in the request header field of the request message sent by the client , the processing unit includes:
第三处理子单元,用于若满足所述文件的接收条件,则从所述请求头域中获取所述上传前回调地址,并调用所述上传前回调地址向所述应用服务端发送第一通知消息,所述第一通知消息包括所述文件的第一文件信息;The third processing subunit is configured to obtain the pre-upload callback address from the request header field if the receiving condition of the file is met, and call the pre-upload callback address to send the first a notification message, the first notification message includes first file information of the file;
第二发送子单元,用于向所述客户端发送上传响应消息,所述上传响应消息包括所述请求头域,以便于所述客户端继续上传所述文件;a second sending subunit, configured to send an upload response message to the client, where the upload response message includes the request header field, so that the client can continue to upload the file;
第四处理子单元,用于接收并存储所述客户端根据所述上传响应消息发送的所述文件,而后从所述请求头域中获取所述上传后回调地址,并调用所述上传后回调地址向所述应用服务端发送第二通知消息,所述第二通知消息包括所述文件的第二文件信息。The fourth processing subunit is configured to receive and store the file sent by the client according to the upload response message, then obtain the post-upload callback address from the request header field, and call the post-upload callback The address sends a second notification message to the application server, where the second notification message includes second file information of the file.
结合第四方面或第四方面的第一种可能实现的方式至第六种可能实现的方式,在第七种可能实现的方式中,还包括:In combination with the fourth aspect or the first possible implementation manner of the fourth aspect to the sixth possible implementation manner, the seventh possible implementation manner further includes:
响应单元,用于在接收完所述文件后,向所述客户端发送完成响应消息。A response unit, configured to send a completion response message to the client after receiving the file.
第五方面,提供一种应用服务端,包括:In the fifth aspect, an application server is provided, including:
第二发送单元,用于向上传服务端发送注册消息,所述注册消息包括文件上传时的回调地址;The second sending unit is configured to send a registration message to the upload server, where the registration message includes a callback address when the file is uploaded;
第二接收单元,用于在注册完成后,接收所述上传服务端根据所述回调地址发送的所述文件上传的通知消息,以获取所述文件的文件信息。The second receiving unit is configured to receive the file upload notification message sent by the upload server according to the callback address after the registration is completed, so as to obtain the file information of the file.
结合第五方面,在第一种可能实现的方式中,所述回调地址包括上传前回调地址和上传后回调地址。With reference to the fifth aspect, in a first possible implementation manner, the callback address includes a pre-upload callback address and a post-upload callback address.
结合第五方面的第一种可能实现的方式,在第二种可能实现的方式中,所述第二接收单元用于:With reference to the first possible implementation manner of the fifth aspect, in a second possible implementation manner, the second receiving unit is configured to:
接收所述上传服务端根据所述上传前回调地址发送的第一通知消息,所述第一通知消息包括所述文件的第一文件信息;receiving a first notification message sent by the upload server according to the pre-upload callback address, the first notification message including first file information of the file;
当所述上传服务端接收完所述文件时,接收所述上传服务端根据所述上传后回调地址发送的第二通知消息,所述第二通知消息包括所述文件的第二文件信息。When the upload server finishes receiving the file, receive a second notification message sent by the upload server according to the post-upload callback address, the second notification message includes second file information of the file.
第六方面,提供一种客户端,包括:In the sixth aspect, a client is provided, including:
第三发送单元,用于向上传服务端发送请求消息,所述请求消息包括请求头域;A third sending unit, configured to send a request message to the upload server, where the request message includes a request header field;
第三接收单元,用于接收所述上传服务端发送的上传响应消息,所述上传响应消息包括所述请求头域;A third receiving unit, configured to receive an upload response message sent by the upload server, where the upload response message includes the request header field;
文件上传单元,用于根据所述上传响应消息,向所述上传服务端上传文件。A file uploading unit, configured to upload a file to the upload server according to the upload response message.
结合第六方面,在第一种可能实现的方式中,所述请求头域包括应用标识,或者所述请求头域包括回调地址和所述应用标识。With reference to the sixth aspect, in a first possible implementation manner, the request header field includes an application identifier, or the request header field includes a callback address and the application identifier.
结合第六方面的第一种可能实现的方式,在第二种可能实现的方式中,还包括:In combination with the first possible implementation manner of the sixth aspect, the second possible implementation manner further includes:
在所述上传服务端通过所述回调地址向应用服务端回调成功之后,接收所述上传服务端发送的完成响应消息。After the upload server successfully calls back to the application server through the callback address, it receives a completion response message sent by the upload server.
第七方面,提供一种上传服务端,包括:In the seventh aspect, an upload server is provided, including:
第一接收器,用于接收客户端发送的请求消息,所述请求消息包括请求头域;The first receiver is configured to receive a request message sent by the client, where the request message includes a request header field;
第一处理器,用于根据所述请求消息中的请求头域判断是否满足文件的接收条件;The first processor is configured to judge whether the receiving condition of the file is satisfied according to the request header field in the request message;
所述第一接收器还用于若满足所述文件的接收条件,则接收所述文件,第一发射器并根据回调地址向应用服务端发送通知消息。The first receiver is further configured to receive the file if the receiving condition of the file is met, and the first transmitter sends a notification message to the application server according to the callback address.
结合第七方面,在第一种可能实现的方式中,所述回调地址包括上传前回调地址和上传后回调地址。With reference to the seventh aspect, in a first possible implementation manner, the callback address includes a pre-upload callback address and a post-upload callback address.
结合第七方面的第一种可能实现的方式,在第二种可能实现的方式中,所述请求头域还包括应用标识,所述应用标识是用来标识所述应用服务端的。With reference to the first possible implementation manner of the seventh aspect, in a second possible implementation manner, the request header field further includes an application identifier, and the application identifier is used to identify the application server.
结合第七方面的第二种可能实现的方式,在第三种可能实现的方式中,所述回调地址是在所述客户端发送的请求消息的请求头域中携带的,或所述回调地址是从所述应用服务端获取的。With reference to the second possible implementation manner of the seventh aspect, in the third possible implementation manner, the callback address is carried in the request header field of the request message sent by the client, or the callback address obtained from the application server.
结合第七方面的第三种可能实现的方式,在第四种可能实现的方式中,当所述回调地址是从所述应用服务端获取的时,还包括:With reference to the third possible implementation manner of the seventh aspect, in the fourth possible implementation manner, when the callback address is obtained from the application server, it further includes:
所述第一接收器还用于接收所述应用服务端发送的注册消息,所述注册消息包括所述回调地址;The first receiver is further configured to receive a registration message sent by the application server, where the registration message includes the callback address;
第一存储器用于将所述回调地址保存在数据库中。The first memory is used to store the callback address in a database.
结合第七方面的第四种可能实现的方式,在第五种可能实现的方式中,当所述回调地址是从所述应用服务端获取的时,所述第一接收器、所述第一处理器、所述第一存储器以及所述第一发射器还用于:With reference to the fourth possible implementation manner of the seventh aspect, in the fifth possible implementation manner, when the callback address is obtained from the application server, the first receiver, the first The processor, the first memory, and the first transmitter are further configured to:
若满足所述文件的接收条件,则所述第一处理器根据应用标识从所述数据库中获取所述上传前回调地址,所述第一发射器调用所述上传前回调地址向所述应用服务端发送第一通知消息,所述第一通知消息包括所述文件的第一文件信息;If the receiving condition of the file is satisfied, the first processor obtains the pre-upload callback address from the database according to the application identifier, and the first transmitter invokes the pre-upload callback address to provide the application service The terminal sends a first notification message, where the first notification message includes first file information of the file;
所述第一发射器还用于向所述客户端发送上传响应消息,所述上传响应消息包括所述请求头域,以便于所述客户端继续上传所述文件;The first transmitter is further configured to send an upload response message to the client, where the upload response message includes the request header field, so that the client can continue to upload the file;
所述第一接收器还用于接收所述客户端根据所述上传响应消息发送的所述文件,所述第一存储器还用于并存储所述文件,所述第一处理器根据所述应用标识从所述数据库中获取所述上传后回调地址,所述第一发射器调用所述上传后回调地址向所述应用服务端发送第二通知消息,所述第二通知消息包括所述文件的第二文件信息。The first receiver is further configured to receive the file sent by the client according to the upload response message, the first memory is further configured to store the file, and the first processor transmits the file according to the application Obtaining the post-upload callback address from the database, the first transmitter invokes the post-upload callback address to send a second notification message to the application server, the second notification message includes the Second file information.
结合第七方面的第三种可能实现的方式,在第六种可能实现的方式中,当所述回调地址是在所述客户端发送的请求消息的请求头域中携带的时,所述第一接收器、所述第一处理器、所述第一存储器以及第一发射器用于:With reference to the third possible implementation manner of the seventh aspect, in the sixth possible implementation manner, when the callback address is carried in the request header field of the request message sent by the client, the sixth a receiver, said first processor, said first memory, and first transmitter for:
若满足所述文件接收条件,则所述第一处理器从所述请求头域中获取所述上传前回调地址,所述第一发射器调用所述上传前回调地址向所述应用服务端发送第一通知消息,所述第一通知消息包括所述文件的第一文件信息;If the file receiving condition is met, the first processor obtains the pre-upload callback address from the request header field, and the first transmitter invokes the pre-upload callback address to send to the application server a first notification message, where the first notification message includes first file information of the file;
所述第一发射器向所述客户端发送上传响应消息,所述上传响应消息包括所述请求头域,以便于所述客户端继续上传所述文件;The first transmitter sends an upload response message to the client, where the upload response message includes the request header field, so that the client can continue to upload the file;
所述第一接收器还用于接收所述客户端根据所述上传响应消息发送的所述文件,所述第一存储器还用于并存储所述文件,所述第一处理器从所述请求头域中获取所述上传后回调地址,所述第一发射器调用所述上传后回调地址向所述应用服务端发送第二通知消息,所述第二通知消息包括所述文件的第二文件信息。The first receiver is further configured to receive the file sent by the client according to the upload response message, the first memory is further configured to store the file, and the first processor receives the file from the request Obtain the post-upload callback address in the header field, and the first transmitter invokes the post-upload callback address to send a second notification message to the application server, the second notification message includes the second file of the file information.
结合第七方面或第七方面的第一种可能实现的方式至第六种可能实现的方式,在第七种可能实现的方式中,还包括:Combining the seventh aspect or the first possible implementation manner to the sixth possible implementation manner of the seventh aspect, the seventh possible implementation manner further includes:
在接收完所述文件后,所述第一发射器还用于向所述客户端发送完成响应消息。After receiving the file, the first transmitter is further configured to send a completion response message to the client.
第八方面,提供一种应用服务端,包括:In the eighth aspect, an application server is provided, including:
第二发射器,用于向上传服务端发送注册消息,所述注册消息包括文件上传时的回调地址;The second transmitter is used to send a registration message to the upload server, and the registration message includes a callback address when the file is uploaded;
第二接收器,用于在注册完成后,接收所述上传服务端根据所述回调地址发送的所述文件上传的通知消息,以获取所述文件的文件信息。The second receiver is configured to receive the file upload notification message sent by the upload server according to the callback address after the registration is completed, so as to obtain the file information of the file.
结合第八方面,在第一种可能实现的方式中,所述回调地址包括上传前回调地址和上传后回调地址。With reference to the eighth aspect, in a first possible implementation manner, the callback address includes a pre-upload callback address and a post-upload callback address.
结合第八方面的第一种可能实现的方式,在第二种可能实现的方式中,所述第二接收器用于:With reference to the first possible implementation manner of the eighth aspect, in a second possible implementation manner, the second receiver is configured to:
接收所述上传服务端根据所述上传前回调地址发送的第一通知消息,所述第一通知消息包括所述文件的第一文件信息;receiving a first notification message sent by the upload server according to the pre-upload callback address, the first notification message including first file information of the file;
当所述上传服务端接收完所述文件时,接收所述上传服务端根据所述上传后回调地址发送的第二通知消息,所述第二通知消息包括所述文件的第二文件信息。When the upload server finishes receiving the file, receive a second notification message sent by the upload server according to the post-upload callback address, the second notification message includes second file information of the file.
第九方面,提供一种客户端,包括:In the ninth aspect, a client is provided, including:
第三发射器,用于向上传服务端发送请求消息,所述请求消息包括请求头域;A third transmitter, configured to send a request message to the upload server, where the request message includes a request header field;
第三接收器,用于接收所述上传服务端发送的上传响应消息,所述上传响应消息包括所述请求头域;A third receiver, configured to receive an upload response message sent by the upload server, where the upload response message includes the request header field;
第三处理器,用于根据所述上传响应消息,向所述上传服务端上传文件。The third processor is configured to upload the file to the upload server according to the upload response message.
结合第九方面,在第一种可能实现的方式中,所述请求头域包括应用标识,或者所述请求头域包括回调地址和所述应用标识。With reference to the ninth aspect, in a first possible implementation manner, the request header field includes an application identifier, or the request header field includes a callback address and the application identifier.
结合第九方面的第一种可能实现的方式,在第二种可能实现的方式中,在所述上传服务端通过所述回调地址向应用服务端回调成功之后,所述第三接收器还用于接收所述上传服务端发送的完成响应消息。With reference to the first possible implementation manner of the ninth aspect, in the second possible implementation manner, after the upload server successfully calls back to the application server through the callback address, the third receiver also uses and receiving the completion response message sent by the upload server.
第十方面,提供一种通信系统,包括:In a tenth aspect, a communication system is provided, including:
所述第七方面提供的所述上传服务端,所述第八方面提供的所述应用服务端和所述第九方面提供的所述客户端。The upload server provided in the seventh aspect, the application server provided in the eighth aspect, and the client provided in the ninth aspect.
本发明实施例提供一种文件上传方法、客户端和服务端,上传服务端接收客户端发送的请求消息,请求消息包括请求头域,根据请求消息中的请求头域判断是否满足文件的接收条件,若满足文件的接收条件,则接收文件,并根据回调地址向应用服务端发送通知消息,其中,回调地址是在客户端发送的请求消息的请求头域中携带的,或回调地址是从应用服务端获取的,能够简化文件上传方式,增强上传前后处理能力,且应用服务端无需购买和维护存储设备。The embodiment of the present invention provides a file upload method, a client and a server. The upload server receives the request message sent by the client. The request message includes a request header field, and judges whether the receiving condition of the file is met according to the request header field in the request message. , if the receiving condition of the file is met, the file is received, and a notification message is sent to the application server according to the callback address, where the callback address is carried in the request header field of the request message sent by the client, or the callback address is from the application It can simplify the file upload method and enhance the processing ability before and after uploading, and the application server does not need to purchase and maintain storage devices.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. Those skilled in the art can also obtain other drawings based on these drawings without creative work.
图1为本发明实施例提供的一种文件上传方法流程示意图;FIG. 1 is a schematic flow chart of a file upload method provided by an embodiment of the present invention;
图2为本发明又一实施例提供的一种文件上传方法流程示意图;Fig. 2 is a schematic flow chart of a file uploading method provided by another embodiment of the present invention;
图3为本发明又一实施例提供的一种文件上传方法流程示意图;Fig. 3 is a schematic flow chart of a file uploading method provided by another embodiment of the present invention;
图4为本发明又一实施例提供的一种文件上传方法流程示意图;Fig. 4 is a schematic flow chart of a file uploading method provided by another embodiment of the present invention;
图5为本发明又一实施例提供的一种文件上传方法流程示意图;FIG. 5 is a schematic flowchart of a method for uploading a file provided by another embodiment of the present invention;
图6为本发明又一实施例提供的一种上传服务端结构示意图;Fig. 6 is a schematic structural diagram of an upload server provided by another embodiment of the present invention;
图7为本发明又一实施例提供的另一种上传服务端结构示意图;FIG. 7 is a schematic structural diagram of another upload server provided by another embodiment of the present invention;
图8为本发明又一实施例提供的又一种上传服务端结构示意图;FIG. 8 is a schematic structural diagram of yet another upload server provided by another embodiment of the present invention;
图9为本发明又一实施例提供的又一种上传服务端结构示意图;FIG. 9 is a schematic structural diagram of yet another upload server provided by another embodiment of the present invention;
图10为本发明又一实施例提供的又一种上传服务端结构示意图;FIG. 10 is a schematic structural diagram of yet another upload server provided by another embodiment of the present invention;
图11为本发明又一实施例提供的一种应用服务端结构示意图;Fig. 11 is a schematic structural diagram of an application server provided by another embodiment of the present invention;
图12为本发明又一实施例提供的一种客户端结构示意图;Fig. 12 is a schematic structural diagram of a client provided by another embodiment of the present invention;
图13为本发明又一实施例提供的一种上传服务端结构示意图;Fig. 13 is a schematic structural diagram of an upload server provided by another embodiment of the present invention;
图14为本发明又一实施例提供的一种应用服务端结构示意图;Fig. 14 is a schematic structural diagram of an application server provided by another embodiment of the present invention;
图15为本发明又一实施例提供的一种客户端结构示意图;Fig. 15 is a schematic structural diagram of a client provided by another embodiment of the present invention;
图16为本发明又一实施例提供的一种通信系统结构示意图。Fig. 16 is a schematic structural diagram of a communication system provided by another embodiment of the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
本发明实施例中的系统架构,可以包括客户端、CDN(Content Delivery Network,内容分发网络)节点和App站点(Application,应用服务端),该客户端、CDN节点和App站点均使用HTTP(Hyper Text Transport Protocol,超文本传输协议)通信协议进行通信。客户端和CDN节点需要支持100-continue处理。The system architecture in the embodiment of the present invention may include a client, a CDN (Content Delivery Network, content distribution network) node, and an App site (Application, application server), and the client, the CDN node, and the App site all use HTTP (Hyper Text Transport Protocol, hypertext transfer protocol) communication protocol for communication. Clients and CDN nodes need to support 100-continue processing.
本发明实施例提供一种文件上传方法,如图1所示,包括:An embodiment of the present invention provides a file upload method, as shown in Figure 1, including:
101、上传服务端接收客户端发送的请求消息,请求消息包括请求头域。101. The upload server receives a request message sent by the client, where the request message includes a request header field.
其中,上传服务端可以为基于云存储的CDN(Content Delivery Network,内容分发网络)节点,该CDN节点有云存储和传统CDN的优点,提供了海量存储能力,用户可以从最近的CDN节点上传和下载文件。Among them, the upload server can be a CDN (Content Delivery Network) node based on cloud storage. This CDN node has the advantages of cloud storage and traditional CDN, and provides massive storage capacity. Users can upload and upload from the nearest CDN node. download file.
102、上传服务端根据请求消息中的请求头域判断是否满足文件的接收条件。102. The upload server judges whether the receiving condition of the file is satisfied according to the request header field in the request message.
其中,该客户端发送的请求消息中的请求头域可以包含Expect:100-continue,用来询问CDN是否愿意接收文件。Wherein, the request header field in the request message sent by the client may include Expect: 100-continue, which is used to inquire whether the CDN is willing to receive the file.
103、若满足文件的接收条件,则上传服务端接收文件,并根据回调地址向应用服务端发送通知消息。103. If the receiving condition of the file is satisfied, the upload server receives the file, and sends a notification message to the application server according to the callback address.
其中,App(Application,应用服务端)站点可以为使用了CDN节点上传、下载服务的网站。该回调地址可以包括上传前回调地址和上传后回调地址。Wherein, the App (Application, application server) site may be a website using CDN node upload and download services. The callback address may include a pre-upload callback address and a post-upload callback address.
示例性的,回调地址是在客户端发送的请求消息的请求头域中携带的,或回调地址是从应用服务端获取的。Exemplarily, the callback address is carried in the request header field of the request message sent by the client, or the callback address is obtained from the application server.
具体的,当回调地址是从应用服务端获取的时,接收应用服务端发送的注册消息,注册消息包括回调地址,将回调地址保存在数据库中。若满足文件的接收条件,则CDN节点根据应用标识从数据库中获取上传前回调地址,并调用上传前回调地址向应用服务端发送第一通知消息,第一通知消息包括文件的第一文件信息,而后向客户端发送上传响应消息,上传响应消息包括请求头域,以便于客户端继续上传文件,进而接收并存储客户端根据上传响应消息发送的文件,而后根据应用标识从数据库中获取上传后回调地址,并调用上传后回调地址向应用服务端发送第二通知消息,第二通知消息包括文件的第二文件信息。Specifically, when the callback address is acquired from the application server, the registration message sent by the application server is received, the registration message includes the callback address, and the callback address is stored in the database. If the receiving condition of the file is met, the CDN node obtains the pre-upload callback address from the database according to the application identifier, and calls the pre-upload callback address to send a first notification message to the application server, the first notification message includes the first file information of the file, Then send an upload response message to the client, the upload response message includes the request header field, so that the client can continue to upload files, and then receive and store the file sent by the client according to the upload response message, and then get the callback after uploading from the database according to the application identifier address, and call the post-upload callback address to send a second notification message to the application server, where the second notification message includes the second file information of the file.
当回调地址是在客户端发送的请求消息的请求头域中携带的时,若满足文件的接收条件,则CDN节点从请求头域中获取上传前回调地址,并调用上传前回调地址向应用服务端发送第一通知消息,第一通知消息包括文件的第一文件信息,而后向客户端发送上传响应消息,上传响应消息包括请求头域,以便于客户端继续上传文件,进而接收并存储客户端根据上传响应消息发送的文件,而后从请求头域中获取上传后回调地址,并调用上传后回调地址向应用服务端发送第二通知消息,第二通知消息包括文件的第二文件信息。When the callback address is carried in the request header field of the request message sent by the client, if the receiving condition of the file is met, the CDN node obtains the pre-upload callback address from the request header field, and calls the pre-upload callback address to the application service The end sends a first notification message, the first notification message includes the first file information of the file, and then sends an upload response message to the client, the upload response message includes a request header field, so that the client can continue to upload the file, and then receive and store the client According to the file sent by the upload response message, the post-upload callback address is obtained from the request header field, and the post-upload callback address is called to send a second notification message to the application server. The second notification message includes the second file information of the file.
本发明实施例提供一种文件上传方法,上传服务端接收客户端发送的请求消息,请求消息包括请求头域,根据请求消息中的请求头域判断是否满足文件的接收条件,若满足文件的接收条件,则接收文件,并根据回调地址向应用服务端发送通知消息,能够简化文件上传方式,增强上传前后处理能力,且应用服务端无需购买和维护存储设备。The embodiment of the present invention provides a method for uploading a file. The uploading server receives a request message sent by the client. The request message includes a request header field. According to the request header field in the request message, it is judged whether the receiving condition of the file is satisfied. conditions, the file is received and a notification message is sent to the application server according to the callback address, which can simplify the file upload method and enhance the processing ability before and after uploading, and the application server does not need to purchase and maintain storage devices.
本发明又一实施例提供一种文件上传方法,如图2所示,包括:Another embodiment of the present invention provides a file upload method, as shown in Figure 2, including:
201、上传服务端接收客户端发送的请求消息,请求消息包括请求头域。201. The upload server receives a request message sent by the client, where the request message includes a request header field.
其中,客户端可以为用户使用的手机、电脑等设备,上传服务端可以为CDN节点,提供了上传、下载服务。客户端、App站点和CDN节点均使用HTTP(Hyper Text TransportProtocol,超文本传输协议)协议通信。Wherein, the client may be a device such as a mobile phone or a computer used by the user, and the upload server may be a CDN node providing upload and download services. Clients, App sites, and CDN nodes all communicate using the HTTP (Hyper Text Transport Protocol, Hypertext Transfer Protocol) protocol.
具体的,客户端向CDN节点上传文件前,向CDN节点发送HTTP消息,该请求消息包括请求头域,用来询问CDN节点是否愿意接受客户端上传文件。该请求头域中可以包含第一状态码Expect:100-continue,即客户端和CDN节点需要支持对HTTP1.1协议中100-continue状态码的处理。该请求头域还可以包括Appid(Application IDentity,应用标识)以及回调地址。该回调地址可以包括上传前回调地址(callback_url_pre)和上传后回调地址(callback_url_post),以便于CDN节点在接收到客户端发送的请求消息后,根据该回调地址通知App站点上传的文件信息。Appid应用标识为用来标示App应用服务端的,CDN可以根据该Appid来区分App站点。因此,该请求程序代码可以如下:Specifically, before uploading a file to the CDN node, the client sends an HTTP message to the CDN node, and the request message includes a request header field, which is used to inquire whether the CDN node is willing to accept the file uploaded by the client. The request header field may contain the first status code Expect: 100-continue, that is, the client and the CDN node need to support the processing of the 100-continue status code in the HTTP1.1 protocol. The request header field may also include an Appid (Application IDentity, application identifier) and a callback address. The callback address may include a pre-upload callback address (callback_url_pre) and a post-upload callback address (callback_url_post), so that the CDN node notifies the App site of the uploaded file information according to the callback address after receiving the request message sent by the client. The Appid application identifier is used to mark the App application server, and the CDN can distinguish the App site according to the Appid. Therefore, the requestor code can be as follows:
POST/app1/path/filename.ext HTTP/1.1POST /app1/path/filename.ext HTTP/1.1
Host:upload.cdn.comHost:upload.cdn.com
Expect:100-continueExpect: 100-continue
appid:app1appid:app1
callback_url_pre:http://app1_domain_name/callback_url_precallback_url_pre: http://app1_domain_name/callback_url_pre
callback_url_post:http://app1_domain_name/callback_url_postcallback_url_post: http://app1_domain_name/callback_url_post
202、上传服务端根据请求消息中的请求头域判断是否满足文件的接收条件。202. The upload server judges whether the receiving condition of the file is satisfied according to the request header field in the request message.
具体的,CDN节点在接收到客户端的请求消息后阻塞,可以根据该请求消息中的请求头域判断该HTTP请求头域是否包含第一状态码Expect:100-continue头,若包含Expect:100-continue头,则继续与客户端进行通信,CDN节点愿意接收客户端的文件上传;若不包含Expect:100-continue头,则CDN节点断开与客户端的连接。Specifically, when the CDN node blocks after receiving the request message from the client, it can judge whether the HTTP request header field contains the first status code Expect: 100-continue header according to the request header field in the request message. If it contains the Expect: 100- continue header, the communication with the client will continue, and the CDN node is willing to accept the file upload from the client; if the Expect:100-continue header is not included, the CDN node will disconnect from the client.
203、若满足文件的接收条件,则上传服务端从请求头域中获取上传前回调地址,并调用上传前回调地址向应用服务端发送第一通知消息,第一通知消息包括文件的第一文件信息。203. If the conditions for receiving the file are met, the upload server obtains the pre-upload callback address from the request header field, and calls the pre-upload callback address to send a first notification message to the application server. The first notification message includes the first file of the file information.
具体的,若客户端发送的请求消息中包含Expect:100-continue头,即满足文件的接收条件。CDN便从客户端发送的请求消息的请求头域中获取上传前回调地址callback_url_pre,并调用该上传前回调地址向App站点应用服务端发送第一通知消息,以通知该App站点上传的文件的第一文件信息。该第一文件信息可以包括文件的大小和文件的名称等信息。Specifically, if the request message sent by the client includes the Expect: 100-continue header, the condition for receiving the file is met. The CDN obtains the pre-upload callback address callback_url_pre from the request header field of the request message sent by the client, and invokes the pre-upload callback address to send the first notification message to the App site application server to notify the App site of the first notification message of the uploaded file. A file information. The first file information may include information such as file size and file name.
该步骤过程的回调请求的程序代码可以为:The program code of the callback request of this step process can be:
POST/callback_url_pre HTTP/1.1POST /callback_url_pre HTTP/1.1
Host:app1_domain_nameHost: app1_domain_name
File_upload_infoFile_upload_info
HTTP/1.1200OKHTTP/1.1200 OK
Connection:closeConnection: close
{〞filename〞:〞filename.ext〞﹐〞success〞:〞true〞}{"filename":"filename.ext","success":"true"}
204、上传服务端向客户端发送上传响应消息,上传响应消息包括请求头域,以便于客户端继续上传文件。204. The upload server sends an upload response message to the client, where the upload response message includes a request header field, so that the client can continue to upload the file.
具体的,当CDN节点调用上传前回调地址向App站点回调成功后,可以向客户端返回响应消息,同意接收客户端发送的文件内容。其中,该响应消息可以包括100-continue头,以使得客户端继续向CDN节点上传文件。客户端在从CDN节点接收到携带100-continue的响应头后,继续向CDN节点上传文件内容。当客户端没有接收到CDN节点返回的应答头时,客户端上传文件失败。Specifically, when the CDN node invokes the pre-upload callback address to call back to the App site successfully, it can return a response message to the client, agreeing to receive the file content sent by the client. Wherein, the response message may include a 100-continue header, so that the client continues to upload files to the CDN node. After the client receives the response header carrying 100-continue from the CDN node, it continues to upload the file content to the CDN node. When the client does not receive the response header returned by the CDN node, the client fails to upload the file.
该步骤中响应过程的程序代码可以如下:The program code of the response process in this step can be as follows:
HTTP/1.1100ContinueHTTP/1.1100 Continue
205、上传服务端接收并存储客户端根据上传响应消息发送的文件,而后从请求头域中获取上传后回调地址,并调用上传后回调地址向应用服务端发送第二通知消息,第二通知消息包括文件的第二文件信息。205. The upload server receives and stores the file sent by the client according to the upload response message, then obtains the post-upload callback address from the request header field, and calls the post-upload callback address to send a second notification message to the application server. The second notification message Include second file information for the file.
具体的,CDN节点向客户端发送上传响应消息之后,继续接收客户端上传的文件,当客户端继续向CDN节点上传文件内容直至文件上传完时,CDN节点在接收完文件内容后,从客户端发送的请求头域中获取上传后回调地址callback_url_post,并调用该上传后回调地址向App站点发送第二通知消息,该第二通知消息包括客户端上传的文件的第二文件信息。该第二文件信息可以包括客户端上传文件的文件内容。其中,该第二通知消息还可以包括下载URL(Universal Resource Locator,统一资源定位符)字段,以便于用户可以使用该URL地址从CDN节点中下载该文件。Specifically, after the CDN node sends an upload response message to the client, it continues to receive the file uploaded by the client. When the client continues to upload the file content to the CDN node until the file is uploaded, the CDN node receives the file content from the client The post-upload callback address callback_url_post is obtained in the sent request header field, and the post-upload callback address is called to send a second notification message to the App site, and the second notification message includes the second file information of the file uploaded by the client. The second file information may include file content of the file uploaded by the client. Wherein, the second notification message may further include a download URL (Universal Resource Locator, Uniform Resource Locator) field, so that the user can use the URL address to download the file from the CDN node.
该步骤中的程序代码可以为:The program code in this step can be:
POST/callback_url_post HTTP/1.1POST/callback_url_post HTTP/1.1
Host:app1_domain_nameHost: app1_domain_name
file_upload_infofile_upload_info
HTTP/1.1200OKHTTP/1.1200 OK
Connection:closeConnection: close
{〞filename〞:〞filename.ext〞﹐〞success〞:〞true〞﹐〞url〞:〞http://download.cdn.com/path/to/filename.ext〞}{"filename":"filename.ext","success":"true","url":"http://download.cdn.com/path/to/filename.ext"}
206、上传服务端在接收完文件后,向客户端发送完成响应消息。206. After receiving the file, the upload server sends a completion response message to the client.
具体的,CDN节点在成功接收完客户端上传的文件内容后,将文件内容进行存储,并向客户端返回响应消息,客户端获取文件成功上传消息。这样,App站点在获取了文件信息后,假设用户在App应用站点下载该文件时,App站点可以通过上传后第二通知消息中该文件相应的URL引导用户在CDN节点中下载该文件内容。CDN节点作为上传服务端,提供了文件上传、下载服务,App站点作为应用服务端,使用CDN节点进行上传、下载服务。这样,在上传文件时,通过回调地址,文件只需要进行一次上传至CDN,从而简化了上传方式,增强了上传前后处理能力,应用服务端并无需购买和维护存储设施。Specifically, after successfully receiving the file content uploaded by the client, the CDN node stores the file content, and returns a response message to the client, and the client obtains the file upload success message. In this way, after the App site obtains the file information, assuming that the user downloads the file on the App application site, the App site can guide the user to download the file content in the CDN node through the URL corresponding to the file in the second notification message after uploading. As the upload server, the CDN node provides file upload and download services, and the App site, as the application server, uses the CDN node for upload and download services. In this way, when uploading a file, the file only needs to be uploaded to the CDN once through the callback address, which simplifies the upload method and enhances the processing ability before and after uploading. The application server does not need to purchase and maintain storage facilities.
本发明实施例提供一种文件上传方法,接收客户端发送的请求消息,请求消息包括请求头域,请求头域包括回调地址,根据请求消息中的请求头域判断是否满足文件的接收条件,若满足文件的接收条件,则上传服务端从请求头域中获取上传前回调地址,并调用上传前回调地址向应用服务端发送第一通知消息,第一通知消息包括文件的第一文件信息,向客户端发送上传响应消息,上传响应消息包括请求头域,以便于客户端继续上传文件,接收并存储客户端根据上传响应消息发送的文件,而后从请求头域中获取上传后回调地址,并调用上传后回调地址向应用服务端发送第二通知消息,第二通知消息包括文件的第二文件信息,在接收完文件后,向客户端发送完成响应消息,能够简化文件上传方式,增强上传前后处理能力,且应用服务端无需购买和维护存储设备。An embodiment of the present invention provides a method for uploading a file. The request message sent by the client is received. The request message includes a request header field, and the request header field includes a callback address. According to the request header field in the request message, it is judged whether the receiving condition of the file is met. If If the receiving condition of the file is met, the upload server obtains the pre-upload callback address from the request header field, and calls the pre-upload callback address to send the first notification message to the application server. The first notification message includes the first file information of the file and sends The client sends an upload response message, which includes the request header field, so that the client can continue to upload files, receive and store the file sent by the client according to the upload response message, and then obtain the post-upload callback address from the request header field, and call After uploading, the callback address sends a second notification message to the application server. The second notification message includes the second file information of the file. After receiving the file, a completion response message is sent to the client, which can simplify the file upload method and enhance the processing before and after uploading capabilities, and the application server does not need to purchase and maintain storage devices.
本发明又一实施例提供一种文件上传方法,如图3所示,包括:Another embodiment of the present invention provides a file upload method, as shown in Figure 3, including:
301、上传服务端接收应用服务端发送的注册消息,注册消息包括回调地址。301. The upload server receives a registration message sent by the application server, where the registration message includes a callback address.
其中,上传服务端可以为CDN节点,提供了上传、下载服务。App站点可以为使用了CDN节点上传、下载服务的网站。Wherein, the uploading server may be a CDN node, providing uploading and downloading services. The App site may be a website using CDN node upload and download services.
具体的,CDN节点可以向App站点提供回调注册接口,App站点调用该回调注册接口向CDN节点发送注册消息,该注册消息可以包括回调地址,包括上传前回调地址callback_url_pre和上传后回调地址callback_url_post。该回调地址可以通过App站点可以向CDN节点注册回调地址以获取文件上传通知。该App注册过程程序代码可以为:Specifically, the CDN node may provide the App site with a callback registration interface, and the App site calls the callback registration interface to send a registration message to the CDN node. The registration message may include a callback address, including callback address callback_url_pre before upload and callback address callback_url_post after upload. The callback address can be registered with the CDN node through the App site to obtain file upload notifications. The program code of the App registration process can be:
POST/upload/regester HTTP/1.1POST/upload/regester HTTP/1.1
Host:upload.cdn.comHost:upload.cdn.com
appid=app1﹠callback_url_pre=http℅3A℅2F℅2Fapp1_domain_nam e℅2Fcallback_url_pre﹠callback_url_post=http℅3A℅2F℅2Fapp1_domain_name℅2Fcallback_url_postappid=app1﹠callback_url_pre=http℅3A℅2F℅2Fapp1_domain_nam e℅2Fcallback_url_pre﹠callback_url_post=http℅3A℅2F℅2Fapp1_domain_name℅2Fcallback_url_post
HTTP/1.1200OKHTTP/1.1200 OK
Connection:closeConnection: close
{〞appid〞:〞app1〞﹐〞success〞:〞true〞}{"appid":"app1","success":"true"}
302、上传服务端将回调地址保存在数据库中。302. The upload server saves the callback address in the database.
具体的,当App站点向CDN节点注册成功之后,CDN节点便向App站点返回注册响应消息,通知App站点注册成功。CDN节点便将App站点注册的回调地址保存在数据库中。Specifically, after the App site successfully registers with the CDN node, the CDN node returns a registration response message to the App site, notifying the App site of successful registration. The CDN node saves the callback address registered by the App site in the database.
303、上传服务端接收客户端发送的请求消息,请求消息包括请求头域。303. The upload server receives the request message sent by the client, where the request message includes a request header field.
具体的,客户端、App站点和CDN节点均使用HTTP(Hyper Text TransportProtocol,超文本传输协议)协议通信。当客户端向CDN节点请求上传文件时,向CDN节点发送请求消息,该请求消息包括请求头域,该请求头域包括第一状态码Expect:100-continue,即客户端和CDN节点需要支持对HTTP1.1协议中100-continue状态码的处理。该请求头域还包括Appid,Appid应用标识为用来标示App应用服务端,CDN节点可以根据该Appid来区分App站点。该请求消息的程序代码可以如下:Specifically, the client, the App site, and the CDN node all use the HTTP (Hyper Text Transport Protocol, hypertext transfer protocol) protocol for communication. When the client requests a CDN node to upload a file, it sends a request message to the CDN node, the request message includes a request header field, and the request header field includes the first status code Expect: 100-continue, that is, the client and the CDN node need to support the Handling of 100-continue status code in HTTP1.1 protocol. The request header field also includes Appid, and the Appid application identifier is used to identify the App application server, and the CDN node can distinguish the App site according to the Appid. The program code of the request message can be as follows:
POST/app1/path/filename.ext HTTP/1.1POST /app1/path/filename.ext HTTP/1.1
Host:upload.cdn.comHost:upload.cdn.com
Expect:100-continueExpect: 100-continue
appid:app1appid:app1
304、上传服务端根据请求消息中的请求头域判断是否满足文件的接收条件。304. The upload server judges whether the receiving condition of the file is satisfied according to the request header field in the request message.
具体的,CDN节点在接收到客户端的请求消息后阻塞,可以根据该请求消息中的请求头域判断该HTTP请求头域是否包含第一状态码Expect:100-continue头,若包含Expect:100-continue头,则继续与客户端进行通信,CDN节点愿意接收客户端的文件上传;若不包含Expect:100-continue头,则CDN节点断开与客户端的连接。Specifically, when the CDN node blocks after receiving the request message from the client, it can judge whether the HTTP request header field contains the first status code Expect: 100-continue header according to the request header field in the request message. If it contains the Expect: 100- continue header, the communication with the client will continue, and the CDN node is willing to accept the file upload from the client; if the Expect:100-continue header is not included, the CDN node will disconnect from the client.
305、若满足文件的接收条件,则上传服务端根据应用标识从数据库中获取上传前回调地址,并调用上传前回调地址向应用服务端发送第一通知消息,第一通知消息包括文件的第一文件信息。305. If the receiving condition of the file is satisfied, the upload server obtains the pre-upload callback address from the database according to the application identifier, and calls the pre-upload callback address to send a first notification message to the application server. The first notification message includes the first notification message of the file. file information.
具体的,当客户端上传文件时的请求消息满足文件的接收条件时,则CDN节点便根据Appid应用标识从数据库中调用上传前回调地址callback_url_pre,并调用该上传前回调地址向App站点发送第一通知消息,以通知App站点客户端上传的文件的第一文件信息。该第一文件信息可以包括文件的大小和文件的名称等信息。Specifically, when the request message from the client to upload a file satisfies the receiving condition of the file, the CDN node calls the pre-upload callback address callback_url_pre from the database according to the Appid application identifier, and calls the pre-upload callback address to send the first URL to the App site. The notification message is used to notify the first file information of the file uploaded by the App site client. The first file information may include information such as file size and file name.
该步骤过程的回调请求的程序代码可以为:The program code of the callback request of this step process can be:
POST/callback_url_pre HTTP/1.1POST /callback_url_pre HTTP/1.1
Host:app1_domain_nameHost:app1_domain_name
File_upload_infoFile_upload_info
HTTP/1.1200OKHTTP/1.1200 OK
Connection:closeConnection: close
{〞filename〞:〞filename.ext〞﹐〞success〞:〞true〞}{"filename":"filename.ext","success":"true"}
306、上传服务端向客户端发送上传响应消息,上传响应消息包括请求头域,以便于客户端继续上传文件。306. The upload server sends an upload response message to the client, where the upload response message includes a request header field, so that the client can continue to upload the file.
具体的,当CDN节点调用上传前回调地址向App站点回调成功后,可以向客户端返回响应消息,同意接收客户端发送的文件内容。其中,该响应消息可以包括100-continue头,以使得客户端继续向CDN节点上传文件。Specifically, when the CDN node invokes the pre-upload callback address to call back to the App site successfully, it can return a response message to the client, agreeing to receive the file content sent by the client. Wherein, the response message may include a 100-continue header, so that the client continues to upload files to the CDN node.
该步骤中响应过程的程序代码可以如下:The program code of the response process in this step can be as follows:
HTTP/1.1100ContinueHTTP/1.1100 Continue
客户端在从CDN节点接收到携带100-continue的响应头后,继续向CDN节点上传文件内容。当客户端没有接收到CDN节点返回的应答头时,客户端上传文件失败。After the client receives the response header carrying 100-continue from the CDN node, it continues to upload the file content to the CDN node. When the client does not receive the response header returned by the CDN node, the client fails to upload the file.
307、上传服务端接收并存储客户端根据上传响应消息发送的文件,而后根据应用标识从数据库中获取上传后回调地址,并调用上传后回调地址向应用服务端发送第二通知消息,第二通知消息包括文件的第二文件信息。307. The upload server receives and stores the file sent by the client according to the upload response message, then obtains the post-upload callback address from the database according to the application identifier, and calls the post-upload callback address to send a second notification message to the application server, the second notification The message includes second file information of the file.
具体的,当客户端继续向CDN节点上传文件内容直至文件上传完时,CDN节点在接收完文件内容后,CDN节点根据该Appid应用标识在数据库中查询获取App站点注册的上传后回调地址callback_url_post,向App站点通知上传的第二文件信息。该第二文件信息可以包括客户端上传文件的文件内容。其中,该第二通知消息还可以包括下载URL字段,以便于用户可以使用该URL地址从CDN节点中下载该文件。Specifically, when the client continues to upload the file content to the CDN node until the file is uploaded, after the CDN node receives the file content, the CDN node queries the database according to the Appid application identifier to obtain the post-upload callback address registered by the App site callback_url_post, The App site is notified of the uploaded second file information. The second file information may include file content of the file uploaded by the client. Wherein, the second notification message may also include a download URL field, so that the user can use the URL address to download the file from the CDN node.
该步骤中的程序代码可以为:The program code in this step can be:
POST/callback_url_post HTTP/1.1POST/callback_url_post HTTP/1.1
Host:app1_domain_nameHost:app1_domain_name
file_upload_infofile_upload_info
HTTP/1.1200OKHTTP/1.1200 OK
Connection:closeConnection: close
{〞filename〞:〞filename.ext〞﹐〞success〞:〞true〞﹐〞url〞:〞http://download.cdn.com/path/to/filename.ext〞}{"filename":"filename.ext","success":"true","url":"http://download.cdn.com/path/to/filename.ext"}
308、上传服务端在接收完文件后,向客户端发送完成响应消息。308. After receiving the file, the upload server sends a completion response message to the client.
具体的,CDN节点在成功接收完客户端上传的文件内容后,将文件内容进行存储,并向客户端返回响应消息,客户端获取文件成功上传消息。这样,App站点在获取了文件信息后,假设用户在App应用站点下载该文件时,App站点可以通过上传后第二通知消息中该文件相应的URL使引导用户在CDN节点中下载该文件内容。CDN节点作为上传服务端,提供了文件上传、下载服务,App站点作为应用服务端,使用CDN节点进行上传、下载服务。此外,CDN节点采用了CDN和云存储结合的架构,这样,在上传文件时,客户端上传的文件只需要进行一次上传至CDN,从而简化了上传方式,增强了上传前后处理能力,App站点并无需购买和维护存储设施。Specifically, after successfully receiving the file content uploaded by the client, the CDN node stores the file content, and returns a response message to the client, and the client obtains the file upload success message. In this way, after the App site obtains the file information, assuming that the user downloads the file on the App application site, the App site can guide the user to download the file content in the CDN node through the URL corresponding to the file in the second notification message after uploading. As the upload server, the CDN node provides file upload and download services, and the App site, as the application server, uses the CDN node for upload and download services. In addition, the CDN node adopts the architecture combining CDN and cloud storage, so that when uploading files, the files uploaded by the client only need to be uploaded to the CDN once, which simplifies the uploading method and enhances the processing ability before and after uploading. There is no need to purchase and maintain storage facilities.
本发明实施例提供一种文件上传方法,接收应用服务端发送的注册消息,注册消息包括回调地址,将回调地址保存在数据库中,接收客户端发送的请求消息,请求消息包括请求头域,根据请求消息中的请求头域判断是否满足文件的接收条件,若满足文件的接收条件,则上传服务端根据应用标识从数据库中获取上传前回调地址,并调用上传前回调地址向应用服务端发送第一通知消息,第一通知消息包括文件的第一文件信息,而后向客户端发送上传响应消息,上传响应消息包括请求头域,以便于客户端继续上传文件,进而接收并存储客户端根据上传响应消息发送的文件,而后根据应用标识从数据库中获取上传后回调地址,并调用上传后回调地址向应用服务端发送第二通知消息,第二通知消息包括文件的第二文件信息,在接收完文件后,向客户端发送完成响应消息,能够简化文件上传方式,增强上传前后处理能力,且应用服务端无需购买和维护存储设备。An embodiment of the present invention provides a method for uploading a file. It receives a registration message sent by an application server. The registration message includes a callback address, saves the callback address in a database, and receives a request message sent by a client. The request message includes a request header field. According to The request header field in the request message judges whether the receiving conditions of the file are met. If the receiving conditions of the file are met, the upload server obtains the pre-upload callback address from the database according to the application ID, and calls the pre-upload callback address to send the first A notification message, the first notification message includes the first file information of the file, and then sends an upload response message to the client, the upload response message includes a request header field, so that the client can continue to upload the file, and then receive and store the client according to the upload response The file sent by the message, and then obtain the post-upload callback address from the database according to the application identifier, and call the post-upload callback address to send the second notification message to the application server. The second notification message includes the second file information of the file. After receiving the file After that, sending a completion response message to the client can simplify the file upload method, enhance the processing ability before and after uploading, and the application server does not need to purchase and maintain storage devices.
本发明又一实施例提供一种文件上传方法,如图4所示,包括:Another embodiment of the present invention provides a file upload method, as shown in Figure 4, including:
401、应用服务端向上传服务端发送注册消息,注册消息包括文件上传时的回调地址。401. The application server sends a registration message to the upload server, where the registration message includes a callback address when the file is uploaded.
其中,应用服务端为App站点,例如可以为互联网应用站点、网站等。CDN节点提供了回调注册接口,App站点可以调用该回调注册接口向CDN节点发送注册消息,该注册消息包括回调地址,包括上传前回调地址和上传后回调地址。该回调地址可以通过App站点可以向CDN节点注册回调地址以获取文件上传通知。Wherein, the application server is an App site, such as an Internet application site, a website, and the like. The CDN node provides a callback registration interface, and the App site can call the callback registration interface to send a registration message to the CDN node. The registration message includes a callback address, including a pre-upload callback address and a post-upload callback address. The callback address can be registered with the CDN node through the App site to obtain file upload notifications.
App注册过程程序代码可以为:The program code of the app registration process can be:
POST/upload/regester HTTP/1.1POST/upload/regester HTTP/1.1
Host:upload.cdn.comHost:upload.cdn.com
appid=app1﹠callback_url_pre=http℅3A℅2F℅2Fapp1_domain_nam e℅2Fcappid=app1﹠callback_url_pre=http℅3A℅2F℅2Fapp1_domain_nam e℅2Fc
allback_url_pre﹠callback_url_post=http℅3A℅2F℅2Fapp1_domain_name℅2Fcallback_url_postcallback_url_pre﹠callback_url_post=http℅3A℅2F℅2Fapp1_domain_name℅2Fcallback_url_post
HTTP/1.1200OKHTTP/1.1200 OK
Connection:closeConnection: close
{〞appid〞:〞app1〞﹐〞success〞:〞true〞}{"appid":"app1","success":"true"}
402、在应用服务端注册完成后,接收上传服务端根据回调地址发送的文件上传的通知消息,以获取文件的文件信息。402. After the registration of the application server is completed, receive the file upload notification message sent by the upload server according to the callback address, so as to obtain the file information of the file.
具体的,当App站点向CDN节点注册成功之后,CDN节点便向App站点返回注册响应消息,通知App站点注册成功。CDN节点便将App站点注册的回调地址保存在数据库中。Specifically, after the App site successfully registers with the CDN node, the CDN node returns a registration response message to the App site, notifying the App site of successful registration. The CDN node saves the callback address registered by the App site in the database.
CDN节点接收客户端发送的请求消息,请求消息包括请求头域,CDN节点根据请求消息中的请求头域判断是否满足文件的接收条件,若满足文件的接收条件,App站点接收CDN节点根据上传前回调地址发送的第一通知消息,第一通知消息包括文件的第一文件信息该第一文件信息可以包括文件的大小和文件的名称等信息。The CDN node receives the request message sent by the client. The request message includes the request header field. The CDN node judges whether the receiving condition of the file is met according to the request header field in the request message. If the receiving condition of the file is met, the App site receives the CDN node according to Call back the first notification message sent by the address. The first notification message includes the first file information of the file. The first file information may include information such as the size of the file and the name of the file.
其中,CDN节点获取的上传前回调地址可以从客户端发送的请求头域中获取,即请求消息的请求头域中携带回调地址,或通过Appid从数据库中获取。Wherein, the pre-upload callback address obtained by the CDN node can be obtained from the request header field sent by the client, that is, the callback address is carried in the request header field of the request message, or obtained from the database through the Appid.
而后,CDN节点向客户端发送上传响应消息,上传响应消息包括请求头域,以便于客户端继续上传文件。Then, the CDN node sends an upload response message to the client, and the upload response message includes a request header field, so that the client can continue to upload the file.
当CDN节点接收完文件时,CDN节点从客户端发送的请求头域中获取上传后回调地址,或通过Appid从数据库中获取上传后回调地址,并通过该上传后回调地址向App站点发送第二通知消息,即App站点接收上传服务端根据上传后回调地址发送的第二通知消息,第二通知消息包括文件的第二文件信息,该第二文件信息可以包括客户端上传文件的文件内容。。When the CDN node finishes receiving the file, the CDN node obtains the post-upload callback address from the request header field sent by the client, or obtains the post-upload callback address from the database through the Appid, and sends the second post-upload callback address to the App site through the post-upload callback address. The notification message, that is, the App site receives the second notification message sent by the upload server according to the post-upload callback address. The second notification message includes the second file information of the file, and the second file information may include the file content of the file uploaded by the client. .
本发明实施例提供一种文件上传方法,应用服务端向上传服务端发送注册消息,注册消息包括文件上传时的回调地址,在应用服务端注册完成后,接收上传服务端根据回调地址发送的文件上传的通知消息,以获取文件的文件信息,能够简化文件上传方式,增强上传前后处理能力,且应用服务端无需购买和维护存储设备。The embodiment of the present invention provides a file upload method. The application server sends a registration message to the upload server. The registration message includes the callback address when the file is uploaded. After the registration of the application server is completed, the upload server receives the file sent by the callback address. The upload notification message is used to obtain the file information of the file, which can simplify the file upload method and enhance the processing ability before and after uploading, and the application server does not need to purchase and maintain storage devices.
本发明又一实施例提供一种文件上传方法,如图5所示,包括:Another embodiment of the present invention provides a file upload method, as shown in Figure 5, including:
501、客户端向上传服务端发送请求消息,请求消息包括请求头域。501. The client sends a request message to the upload server, where the request message includes a request header field.
其中,客户端是指与服务器对应,为客户提供本地服务的程序,例如浏览器、各种手机应用。除了一些只在本地运行的应用程序之外,一般安装在普通的客户机上,需要与服务端互相配合运行。例如可以运行在用户的电脑、手机等设备中。Wherein, the client refers to a program that corresponds to the server and provides local services for the client, such as a browser and various mobile phone applications. Except for some applications that only run locally, they are generally installed on ordinary client computers and need to cooperate with the server to run. For example, it can run on the user's computer, mobile phone and other devices.
该请求头域可以包括第一状态码Expect:100-continue,客户端和CDN节点需要支持对HTTP1.1协议中100-continue状态码的处理。还包括Appid,该Appid为用来标示App应用服务端的,CDN可以根据该Appid来区分App站点。The request header field may include the first status code Expect: 100-continue, and the client and the CDN node need to support the processing of the 100-continue status code in the HTTP1.1 protocol. It also includes Appid, which is used to identify the App application server, and the CDN can distinguish App sites according to the Appid.
502、客户端接收上传服务端发送的上传响应消息。502. The client receives the upload response message sent by the upload server.
具体的,当客户端向CDN节点发送请求消息后,CDN节点根据请求消息的请求头域是否包含第一状态码Expect:100-continue,判断是否满足文件的接收条件,若满足文件接收条件,CDN节点通过上传前回调地址向客户端发送第一通知消息,第一通知消息包括文件的第一文件信息,而后向客户端发送上传响应消息。Specifically, when the client sends a request message to the CDN node, the CDN node judges whether the receiving condition of the file is satisfied according to whether the request header field of the request message contains the first status code Expect: 100-continue. If the receiving condition of the file is satisfied, the CDN The node sends a first notification message to the client through the pre-upload callback address, the first notification message includes the first file information of the file, and then sends an upload response message to the client.
其中,该上传响应消息包括客户端发送的请求消息中的请求头域,以便于客户端可以继续上传文件。回调地址可以是在客户端发送的请求消息的请求头域中携带的,或回调地址是从应用服务端获取的,包括上传前回调地址和上传后回调地址。当回调地址是从应用服务端获取的时,通过接收应用服务端发送的注册消息,注册消息包括回调地址,并将回调地址保存在数据库中。Wherein, the upload response message includes the request header field in the request message sent by the client, so that the client can continue to upload the file. The callback address can be carried in the request header field of the request message sent by the client, or the callback address can be obtained from the application server, including the pre-upload callback address and post-upload callback address. When the callback address is obtained from the application server, by receiving the registration message sent by the application server, the registration message includes the callback address, and saves the callback address in the database.
503、客户端根据上传响应消息,向上传服务端上传文件。503. The client uploads the file to the upload server according to the upload response message.
具体的,客户端在从CDN节点接收到携带100-continue的响应头后,继续向CDN节点上传文件内容。当客户端没有接收到CDN节点返回的应答头时,客户端上传文件失败。Specifically, after receiving the response header carrying 100-continue from the CDN node, the client continues to upload the file content to the CDN node. When the client does not receive the response header returned by the CDN node, the client fails to upload the file.
而后,CDN节点从请求头域中获取上传后回调地址,或从数据库中获取上传后回调地址,并调用上传后回调地址向应用服务端发送第二通知消息,第二通知消息包括文件的第二文件信息。Then, the CDN node obtains the post-upload callback address from the request header field, or obtains the post-upload callback address from the database, and calls the post-upload callback address to send a second notification message to the application server. The second notification message includes the second file information.
本发明实施例提供一种文件上传方法,客户端向上传服务端发送请求消息,在接收上传服务端发送的上传响应消息后,根据该上传响应消息向上传服务端上传文件,能够简化文件上传方式。The embodiment of the present invention provides a file upload method. The client sends a request message to the upload server, and after receiving the upload response message sent by the upload server, uploads the file to the upload server according to the upload response message, which can simplify the file upload method. .
本发明又一实施例提供一种上传服务端01,如图6所示,包括:Yet another embodiment of the present invention provides an upload server 01, as shown in FIG. 6, including:
接收单元016,用于接收客户端发送的请求消息,请求消息包括请求头域。The receiving unit 016 is configured to receive a request message sent by the client, where the request message includes a request header field.
判断单元011,用于根据请求消息中的请求头域判断是否满足文件接收条件。The judging unit 011 is configured to judge whether the file receiving condition is satisfied according to the request header field in the request message.
处理单元012,用于若满足文件接收条件,则接收文件,并根据回调地址向应用服务端发送通知消息。The processing unit 012 is configured to receive the file if the file receiving condition is satisfied, and send a notification message to the application server according to the callback address.
其中,回调地址包括上传前回调地址和上传后回调地址。Wherein, the callback address includes a pre-upload callback address and a post-upload callback address.
可选的,请求头域还包括应用标识,应用标识是用来标识应用服务端的。Optionally, the request header field also includes an application identifier, which is used to identify the application server.
可选的,回调地址是在客户端发送的请求消息的请求头域中携带的,或回调地址是从应用服务端获取的。Optionally, the callback address is carried in the request header field of the request message sent by the client, or the callback address is obtained from the application server.
可选的,如图7所示,当回调地址是从应用服务端获取的时,还包括:Optionally, as shown in Figure 7, when the callback address is obtained from the application server, it also includes:
第一接收单元014,用于在接收客户端发送的请求消息之前,接收应用服务端发送的注册消息,注册消息包括回调地址。The first receiving unit 014 is configured to receive a registration message sent by the application server before receiving the request message sent by the client, and the registration message includes a callback address.
存储单元015,用于将回调地址保存在数据库中。The storage unit 015 is configured to store the callback address in the database.
可选的,如图8所示,当回调地址是从应用服务端获取的时,处理单元012可以包括:Optionally, as shown in FIG. 8, when the callback address is obtained from the application server, the processing unit 012 may include:
第一处理子单元0121,用于若满足文件接收条件,则根据应用标识从数据库中获取上传前回调地址,并调用上传前回调地址向应用服务端发送第一通知消息,第一通知消息包括文件的第一文件信息。The first processing subunit 0121 is configured to obtain the pre-upload callback address from the database according to the application identifier if the file receiving condition is met, and call the pre-upload callback address to send a first notification message to the application server, the first notification message includes the file The first file information.
第一发送子单元0122,用于向客户端发送上传响应消息,上传响应消息包括请求头域,以便于客户端继续上传文件。The first sending subunit 0122 is configured to send an upload response message to the client, where the upload response message includes a request header field, so that the client can continue to upload files.
第二处理子单元0123,用于接收并存储客户端根据上传响应消息发送的文件,而后根据应用标识从数据库中获取上传后回调地址,并调用上传后回调地址向应用服务端发送第二通知消息,第二通知消息包括文件的第二文件信息。The second processing subunit 0123 is used to receive and store the file sent by the client according to the upload response message, then obtain the post-upload callback address from the database according to the application identifier, and call the post-upload callback address to send the second notification message to the application server , the second notification message includes second file information of the file.
可选的,如图9所示,当回调地址是在客户端发送的请求消息的请求头域中携带的时,处理单元012可以包括:Optionally, as shown in FIG. 9, when the callback address is carried in the request header field of the request message sent by the client, the processing unit 012 may include:
第三处理子单元0124,用于若满足文件的接收条件,则从请求头域中获取上传前回调地址,并调用上传前回调地址向应用服务端发送第一通知消息,第一通知消息包括文件的第一文件信息。The third processing subunit 0124 is configured to obtain the pre-upload callback address from the request header field if the receiving condition of the file is met, and call the pre-upload callback address to send a first notification message to the application server, the first notification message includes the file The first file information.
第二发送子单元0125,用于向客户端发送上传响应消息,上传响应消息包括请求头域,以便于客户端继续上传文件。The second sending subunit 0125 is configured to send an upload response message to the client, where the upload response message includes a request header field, so that the client can continue to upload files.
第四处理子单元0126,用于接收并存储客户端根据上传响应消息发送的文件,而后从请求头域中获取上传后回调地址,并调用上传后回调地址向应用服务端发送第二通知消息,第二通知消息包括文件的第二文件信息。The fourth processing subunit 0126 is configured to receive and store the file sent by the client according to the upload response message, then obtain the post-upload callback address from the request header field, and call the post-upload callback address to send the second notification message to the application server, The second notification message includes second file information of the file.
可选的,如图10所示,还可以包括:Optionally, as shown in Figure 10, may also include:
响应单元013,用于在接收完文件后,向客户端发送完成响应消息。The response unit 013 is configured to send a completion response message to the client after receiving the file.
其中,接收单元016用于执行图1所示的实施例中的步骤101,或图2所示的实施例中的步骤201,或图3所示实施例中的步骤303;判断单元011用于执行图1所示的实施例中的步骤102,或图2所示实施例中的步骤202,或图3所示实施例中的步骤304;处理单元012用于执行图1所示实施例中的步骤103,或图2所示实施例中的步骤203~步骤205,或图3所示实施例中的步骤305~步骤307;第一接收单元014用于执行图3所示实施例中的步骤301;存储单元015用于执行图3所示实施例中的步骤302;第一处理子单元0121用于执行图3所示实施例中的步骤305;第一发送子单元0122用于执行图3所示实施例中的步骤306;第二处理子单元0123用于执行图3所示实施例中的步骤307;第三处理子单元0124用于执行图2所示实施例中的步骤203;第二发送子单元0125用于执行图2所示实施例中的步骤204;第四处理子单元0126用于执行图2所示实施例中的步骤205;响应单元013用于执行图2所示实施例中的步骤206,或图3所示实施例中的步骤308。Wherein, the receiving unit 016 is configured to execute step 101 in the embodiment shown in FIG. 1, or step 201 in the embodiment shown in FIG. 2, or step 303 in the embodiment shown in FIG. 3; the judging unit 011 is used to Execute step 102 in the embodiment shown in Figure 1, or step 202 in the embodiment shown in Figure 2, or step 304 in the embodiment shown in Figure 3; processing unit 012 is used to execute in the embodiment shown in Figure 1 Step 103 in the embodiment shown in FIG. 2, or steps 203 to 205 in the embodiment shown in FIG. 2, or steps 305 to 307 in the embodiment shown in FIG. 3; the first receiving unit 014 is used to execute the Step 301; the storage unit 015 is used to execute step 302 in the embodiment shown in FIG. 3; the first processing subunit 0121 is used to execute step 305 in the embodiment shown in FIG. 3; the first sending subunit 0122 is used to execute the Step 306 in the embodiment shown in Figure 3; the second processing subunit 0123 is used to execute step 307 in the embodiment shown in Figure 3; the third processing subunit 0124 is used to execute step 203 in the embodiment shown in Figure 2; The second sending subunit 0125 is used to execute step 204 in the embodiment shown in FIG. 2; the fourth processing subunit 0126 is used to execute step 205 in the embodiment shown in FIG. Step 206 in the embodiment, or step 308 in the embodiment shown in FIG. 3 .
本发明实施例提供一种上传服务端,上传服务端接收客户端发送的请求消息,请求消息包括请求头域,根据请求消息中的请求头域判断是否满足文件的接收条件,若满足文件的接收条件,则接收文件,并根据回调地址向应用服务端发送通知消息,能够简化文件上传方式,增强上传前后处理能力,且应用服务端无需购买和维护存储设备。An embodiment of the present invention provides an upload server. The upload server receives a request message sent by a client. The request message includes a request header field. According to the request header field in the request message, it is judged whether the receiving condition of the file is satisfied. conditions, the file is received and a notification message is sent to the application server according to the callback address, which can simplify the file upload method and enhance the processing ability before and after uploading, and the application server does not need to purchase and maintain storage devices.
本发明又一实施例提供一种应用服务端02,如图11所示,包括:Yet another embodiment of the present invention provides an application server 02, as shown in FIG. 11 , including:
第二发送单元021,用于向上传服务端发送注册消息,注册消息包括文件上传时的回调地址。The second sending unit 021 is configured to send a registration message to the upload server, where the registration message includes a callback address when the file is uploaded.
第二接收单元022,用于在注册完成后,接收上传服务端根据回调地址发送的文件上传的通知消息,以获取文件的文件信息。The second receiving unit 022 is configured to receive a file upload notification message sent by the upload server according to the callback address after the registration is completed, so as to obtain file information of the file.
其中,回调地址包括上传前回调地址和上传后回调地址。Wherein, the callback address includes a pre-upload callback address and a post-upload callback address.
可选的,第二接收单元022可以用于:Optionally, the second receiving unit 022 may be used for:
接收上传服务端根据上传前回调地址发送的第一通知消息,第一通知消息包括文件的第一文件信息;receiving the first notification message sent by the upload server according to the pre-upload callback address, the first notification message includes the first file information of the file;
当上传服务端接收完文件时,接收上传服务端根据上传后回调地址发送的第二通知消息,第二通知消息包括文件的第二文件信息。When the uploading server finishes receiving the file, it receives the second notification message sent by the uploading server according to the post-upload callback address, and the second notification message includes the second file information of the file.
其中,第二发送单元021用于执行图4所示的实施例中的步骤401,第二接收单元022用于执行图4所示的实施例中的步骤402。Wherein, the second sending unit 021 is configured to execute step 401 in the embodiment shown in FIG. 4 , and the second receiving unit 022 is configured to execute step 402 in the embodiment shown in FIG. 4 .
本发明实施例提供一种应用服务端,应用服务端向上传服务端发送注册消息,注册消息包括文件上传时的回调地址,在应用服务端注册完成后,接收上传服务端根据回调地址发送的文件上传的通知消息,以获取文件的文件信息,能够简化文件上传方式,增强上传前后处理能力,且应用服务端无需购买和维护存储设备。The embodiment of the present invention provides an application server. The application server sends a registration message to the upload server. The registration message includes the callback address when the file is uploaded. After the registration of the application server is completed, the upload server receives the file sent by the callback address. The upload notification message is used to obtain the file information of the file, which can simplify the file upload method and enhance the processing ability before and after uploading, and the application server does not need to purchase and maintain storage devices.
本发明又一实施例提供一种客户端03,如图12所示,包括:Another embodiment of the present invention provides a client 03, as shown in Figure 12, including:
第三发送单元031,用于向上传服务端发送请求消息,请求消息包括请求头域。The third sending unit 031 is configured to send a request message to the upload server, where the request message includes a request header field.
第三接收单元032,用于接收上传服务端发送的上传响应消息,上传响应消息包括请求头域。The third receiving unit 032 is configured to receive an upload response message sent by the upload server, where the upload response message includes a request header field.
文件上传单元033,用于根据上传响应消息,向上传服务端上传文件。The file uploading unit 033 is configured to upload the file to the upload server according to the upload response message.
可选的,请求头域包括应用标识,或者请求头域包括回调地址和应用标识。Optionally, the request header field includes an application identifier, or the request header field includes a callback address and an application identifier.
可选的,还可以包括:Optionally, can also include:
在上传服务端通过回调地址向应用服务端回调成功之后,接收上传服务端发送的完成响应消息。After the upload server successfully calls back to the application server through the callback address, it receives the completion response message sent by the upload server.
其中,第三发送单元031用于执行图5所示的实施例中的步骤501;第三接收单元032用于执行图5所示实施例中的步骤502;文件上传单元033用于执行图5所示实施例中的步骤503。Wherein, the third sending unit 031 is used to execute step 501 in the embodiment shown in FIG. 5; the third receiving unit 032 is used to execute step 502 in the embodiment shown in FIG. Step 503 in the illustrated embodiment.
本发明实施例提供一种客户端,客户端向上传服务端发送请求消息,请求消息包括请求头域,接收上传服务端发送的上传响应消息,上传响应消息包括请求头域,根据上传响应消息,向上传服务端上传文件,能够简化文件上传方式。An embodiment of the present invention provides a client. The client sends a request message to the upload server. The request message includes a request header field, and receives an upload response message sent by the upload server. The upload response message includes a request header field. According to the upload response message, Uploading files to the upload server can simplify the file upload method.
本发明又一实施例提供一种上传服务端04,如图13所示,该上传服务端04包括:第一总线041,以及连接到第一总线041的第一处理器042、第一存储器043、第一接收器044和第一发射器045,其中,该第一存储器043用于存储指令,该第一接收器044用于执行该指令用于接收客户端发送的请求消息,请求消息包括请求头域,具体用于执行图1所示的实施例中的步骤101,或图2所示的实施例中的步骤201,或图3所示实施例中的步骤303;第一处理器042用于执行该指令用于根据请求消息中的请求头域判断是否满足文件的接收条件,具体用于执行图1所示的实施例中的步骤102,或图2所示实施例中的步骤202,或图3所示实施例中的步骤304;该第一接收器044还用于执行该指令还用于若满足文件接收条件,则接收文件,第一发射器045调用回调地址向应用服务端发送通知消息,具体用于执行图1所示实施例中的步骤103,或图2所示实施例中的步骤203~步骤205,或图3所示实施例中的步骤305~步骤307;Another embodiment of the present invention provides an upload server 04, as shown in Figure 13, the upload server 04 includes: a first bus 041, a first processor 042 connected to the first bus 041, and a first memory 043 , a first receiver 044 and a first transmitter 045, wherein the first memory 043 is used to store instructions, and the first receiver 044 is used to execute the instructions to receive a request message sent by the client, the request message includes a request The header field is specifically used to execute step 101 in the embodiment shown in FIG. 1, or step 201 in the embodiment shown in FIG. 2, or step 303 in the embodiment shown in FIG. 3; the first processor 042 uses Executing this instruction is used to judge whether the receiving condition of the file is met according to the request header field in the request message, specifically to execute step 102 in the embodiment shown in Figure 1, or step 202 in the embodiment shown in Figure 2, Or step 304 in the embodiment shown in Figure 3; the first receiver 044 is also used to execute the instruction and is also used to receive the file if the file receiving condition is met, and the first transmitter 045 calls the callback address to send the file to the application server The notification message is specifically used to execute step 103 in the embodiment shown in Figure 1, or steps 203 to 205 in the embodiment shown in Figure 2, or steps 305 to 307 in the embodiment shown in Figure 3;
在本发明实施例中,可选的,回调地址包括上传前回调地址和上传后回调地址。In this embodiment of the present invention, optionally, the callback address includes a pre-upload callback address and a post-upload callback address.
在本发明实施例中,可选的,请求头域包括应用标识,应用标识是用来标识应用服务端的。In this embodiment of the present invention, optionally, the request header field includes an application identifier, and the application identifier is used to identify the application server.
在本发明实施例中,可选的,回调地址是在客户端发送的请求消息的请求头域中携带的,或回调地址是从应用服务端获取的。In this embodiment of the present invention, optionally, the callback address is carried in the request header field of the request message sent by the client, or the callback address is obtained from the application server.
在本发明实施例中个,可选的,当回调地址是从应用服务端获取的时,第一接收器044用于执行该指令,包括:In the embodiment of the present invention, optionally, when the callback address is obtained from the application server, the first receiver 044 is used to execute the instruction, including:
在接收客户端发送的请求消息之前,第一接收器还用于接收应用服务端发送的注册消息,注册消息包括回调地址,具体用于执行图3所示实施例中的步骤301;Before receiving the request message sent by the client, the first receiver is also used to receive a registration message sent by the application server, the registration message includes a callback address, and is specifically used to execute step 301 in the embodiment shown in FIG. 3 ;
第一存储器043用于将回调地址保存在数据库中,具体用于执行图3所示实施例中的步骤302。The first memory 043 is used to save the callback address in the database, and is specifically used to execute step 302 in the embodiment shown in FIG. 3 .
在本发明实施例中,可选的,当回调地址是从应用服务端获取的时,该第一接收器044、第一处理器042和第一发射器045执行该指令还用于:In this embodiment of the present invention, optionally, when the callback address is obtained from the application server, the first receiver 044, the first processor 042 and the first transmitter 045 execute the instruction and are also used to:
若满足文件接收条件,则第一处理器042并根据应用标识从数据库中获取上传前回调地址,第一发射器045调用上传前回调地址向应用服务端发送第一通知消息,第一通知消息包括文件的第一文件信息具体用于执行图3所示实施例中的步骤305;If the file receiving condition is met, the first processor 042 obtains the pre-upload callback address from the database according to the application identifier, and the first transmitter 045 invokes the pre-upload callback address to send a first notification message to the application server. The first notification message includes The first file information of the file is specifically used to execute step 305 in the embodiment shown in FIG. 3;
第一发射器045还用于向客户端发送上传响应消息,上传响应消息包括请求头域,以便于客户端继续上传文件,具体用于执行图3所示实施例中的步骤306;The first transmitter 045 is also configured to send an upload response message to the client, where the upload response message includes a request header field, so that the client can continue to upload the file, and is specifically used to execute step 306 in the embodiment shown in FIG. 3 ;
若第一接收器044还用于接收并存储客户端根据上传响应消息发送的文件,第一存储器043还用于并存储文件,第一处理器042根据应用标识从数据库中获取上传后回调地址,第一发射器045调用上传后回调地址向应用服务端发送第二通知消息,第二通知消息包括文件的第二文件信息,具体用于执行图3所示实施例中的步骤307。If the first receiver 044 is also used to receive and store the file sent by the client according to the upload response message, and the first storage 043 is also used to store the file, the first processor 042 obtains the post-upload callback address from the database according to the application identifier, The first transmitter 045 invokes the post-upload callback address to send a second notification message to the application server. The second notification message includes the second file information of the file, and is specifically used to execute step 307 in the embodiment shown in FIG. 3 .
在本发明实施例中,可选的,当回调地址是在客户端发送的请求消息的请求头域中携带的时,该第一接收器044、第一处理器042、第一存储器043和第一发射器045执行该指令还用于:In this embodiment of the present invention, optionally, when the callback address is carried in the request header field of the request message sent by the client, the first receiver 044, the first processor 042, the first memory 043 and the first A transmitter 045 executes the command for:
若满足文件接收条件,则第一处理器042从请求头域中获取上传前回调地址,第一发射器045调用上传前回调地址向应用服务端发送第一通知消息,第一通知消息包括文件的第一文件信息,具体用于执行图2所示实施例中的步骤203;If the file receiving condition is satisfied, the first processor 042 obtains the pre-upload callback address from the request header field, and the first transmitter 045 invokes the pre-upload callback address to send a first notification message to the application server, the first notification message includes the file The first file information is specifically used to execute step 203 in the embodiment shown in FIG. 2;
第一发射器045向客户端发送上传响应消息,上传响应消息包括请求头域,以便于客户端继续上传文件,具体用于执行图2所示实施例中的步骤204;The first transmitter 045 sends an upload response message to the client, and the upload response message includes a request header field, so that the client can continue to upload the file, and is specifically used to execute step 204 in the embodiment shown in FIG. 2 ;
若第一接收器044还用于接收并存储客户端根据上传响应消息发送的文件,第一存储器043还用于并存储文件,第一处理器042从请求头域中获取上传后回调地址,第一发射器045调用上传后回调地址向应用服务端发送第二通知消息,第二通知消息包括文件的第二文件信息,具体用于执行图2所示实施例中的步骤205。If the first receiver 044 is also used to receive and store the file sent by the client according to the upload response message, and the first storage 043 is also used to store the file, the first processor 042 obtains the post-upload callback address from the request header field, and the first A transmitter 045 invokes the post-upload callback address to send a second notification message to the application server. The second notification message includes the second file information of the file, and is specifically used to execute step 205 in the embodiment shown in FIG. 2 .
在本发明实施例中,可选的,在接收完文件后,第一发射器045执行该指令还用于向客户端发送完成响应消息,具体用于执行图2所示实施例中的步骤206,或图3所示实施例中的步骤308。In this embodiment of the present invention, optionally, after receiving the file, the first transmitter 045 executes the instruction to send a completion response message to the client, specifically to execute step 206 in the embodiment shown in FIG. 2 , or step 308 in the embodiment shown in FIG. 3 .
因此,本发明实施例的上传服务端,上传服务端接收客户端发送的请求消息,请求消息包括请求头域,根据请求消息中的请求头域判断是否满足文件的接收条件,若满足文件的接收条件,则接收文件,并根据回调地址向应用服务端发送通知消息,能够简化文件上传方式,增强上传前后处理能力。Therefore, in the uploading server of the embodiment of the present invention, the uploading server receives the request message sent by the client, the request message includes the request header field, and judges whether the receiving condition of the file is satisfied according to the request header field in the request message. condition, the file is received and a notification message is sent to the application server according to the callback address, which can simplify the file upload method and enhance the processing ability before and after uploading.
本发明又一实施例提供一种应用服务端05,如图14所示,该应用服务端包括:第二总线041,以及连接到第二总线041的第二处理器042、第二存储器043、第二接收器044和第二发射器045,其中,该第二存储器043用于存储指令,该第二发射器045执行该指令用于向上传服务端发送注册消息,注册消息包括文件上传时的回调地址;该第二接收器044执行该指令用于在注册完成后,接收上传服务端根据回调地址发送的文件上传的通知消息,以获取文件的文件信息。Another embodiment of the present invention provides an application server 05. As shown in FIG. 14, the application server includes: a second bus 041, a second processor 042 connected to the second bus 041, a second memory 043, The second receiver 044 and the second transmitter 045, wherein the second memory 043 is used to store instructions, and the second transmitter 045 executes the instructions to send a registration message to the upload server, the registration message includes the file upload Callback address; the second receiver 044 executes the instruction to receive the file upload notification message sent by the upload server according to the callback address after the registration is completed, so as to obtain the file information of the file.
在本发明实施例中,可选的,回调地址包括上传前回调地址和上传后回调地址。In this embodiment of the present invention, optionally, the callback address includes a pre-upload callback address and a post-upload callback address.
在本发明实施例中,可选的,该第二接收器044执行该指令用于:In this embodiment of the present invention, optionally, the second receiver 044 executes the instruction for:
接收上传服务端根据上传前回调地址发送的第一通知消息,第一通知消息包括文件的第一文件信息;receiving the first notification message sent by the upload server according to the pre-upload callback address, the first notification message includes the first file information of the file;
当上传服务端接收完文件时,接收上传服务端根据上传后回调地址发送的第二通知消息,第二通知消息包括文件的第二文件信息。When the uploading server finishes receiving the file, it receives the second notification message sent by the uploading server according to the post-upload callback address, and the second notification message includes the second file information of the file.
其中,该第二发射器045用于执行图4所示的实施例中的步骤401,该第二接收器044用于执行图4所示的实施例中的步骤402。Wherein, the second transmitter 045 is used to execute step 401 in the embodiment shown in FIG. 4 , and the second receiver 044 is used to execute step 402 in the embodiment shown in FIG. 4 .
因此,本发明实施例的应用服务端,应用服务端向上传服务端发送注册消息,注册消息包括文件上传时的回调地址,在应用服务端注册完成后,接收上传服务端根据回调地址发送的文件上传的通知消息,以获取文件的文件信息,能够简化文件上传方式,增强上传前后处理能力,且应用服务端无需购买和维护存储设备。Therefore, in the application server of the embodiment of the present invention, the application server sends a registration message to the upload server. The registration message includes the callback address when the file is uploaded. After the registration of the application server is completed, the upload server receives the file sent by the callback address. The upload notification message is used to obtain the file information of the file, which can simplify the file upload method and enhance the processing ability before and after uploading, and the application server does not need to purchase and maintain storage devices.
本发明又一实施例提供一种客户端06,如图15所示,该客户端06包括:第三总线041,以及连接到第三总线041的第三处理器042、第三存储器043、第三接收器044和第三发射器045,其中,该第三存储器043用于存储指令;该第三发射器045执行该指令用于向上传服务端发送请求消息,请求消息包括请求头域;该第三接收器044执行该指令用于接收上传服务端发送的上传响应消息,上传响应消息包括请求头域;该第三处理器042执行该指令用于根据上传响应消息,向上传服务端上传文件。Yet another embodiment of the present invention provides a client 06. As shown in FIG. Three receivers 044 and a third transmitter 045, wherein the third memory 043 is used to store instructions; the third transmitter 045 executes the instructions to send a request message to the upload server, and the request message includes a request header field; The third receiver 044 executes the instruction to receive the upload response message sent by the upload server, the upload response message includes the request header field; the third processor 042 executes the instruction to upload the file to the upload server according to the upload response message .
在本发明实施例中,可选的,请求头域包括应用标识,或者请求头域包括回调地址和应用标识。In this embodiment of the present invention, optionally, the request header field includes an application identifier, or the request header field includes a callback address and an application identifier.
在本发明实施例中,可选的,在上传服务端通过回调地址向应用服务端回调成功之后,第三接收器044用于执行该指令还用于接收上传服务端发送的完成响应消息。In the embodiment of the present invention, optionally, after the upload server successfully calls back to the application server through the callback address, the third receiver 044 is used to execute the instruction and to receive a completion response message sent by the upload server.
其中,该第三发射器045用于执行图5所示的实施例中的步骤501;该第三接收器044用于执行图5所示实施例中的步骤502;该第三处理器042用于执行图5所示实施例中的步骤503。Wherein, the third transmitter 045 is used to execute step 501 in the embodiment shown in FIG. 5; the third receiver 044 is used to execute step 502 in the embodiment shown in FIG. 5; the third processor 042 uses Step 503 in the embodiment shown in FIG. 5 is executed.
因此,本发明实施例的客户端,客户端向上传服务端发送请求消息,请求消息包括请求头域,接收上传服务端发送的上传响应消息,上传响应消息包括请求头域,根据上传响应消息,向上传服务端上传文件,能够简化文件上传方式。Therefore, in the client of the embodiment of the present invention, the client sends a request message to the upload server, the request message includes a request header field, receives an upload response message sent by the upload server, the upload response message includes a request header field, and according to the upload response message, Uploading files to the upload server can simplify the file upload method.
本发明又一实施例提供一种通信系统1,如图16所示,包括:前述实施例提供的上传服务端04、应用服务端05和客户端06。Another embodiment of the present invention provides a communication system 1 , as shown in FIG. 16 , including: the upload server 04 , the application server 05 and the client 06 provided in the foregoing embodiments.
其中,上传服务端04用于执行图1所示实施例中的步骤101~步骤103,或图2所示实施例中的步骤201~步骤206,或图3所示实施例中的步骤301~308;应用服务端05用于执行图4所示实施例中的步骤401~步骤402;客户端06用于执行图5所示实施例中的步骤501~步骤503。Wherein, the upload server 04 is used to execute steps 101 to 103 in the embodiment shown in FIG. 1, or steps 201 to 206 in the embodiment shown in FIG. 2, or steps 301 to 206 in the embodiment shown in FIG. 308 ; the application server 05 is used to execute steps 401 to 402 in the embodiment shown in FIG. 4 ; the client 06 is used to execute steps 501 to 503 in the embodiment shown in FIG. 5 .
本发明实施例提供一种通信系统,上传服务端接收客户端发送的请求消息,请求消息包括请求头域,根据请求消息中的请求头域判断是否满足文件接收条件,若满足文件的接收条件,则接收文件,并根据回调地址向应用服务端发送通知消息,回调地址包括上传前回调地址和上传后回调地址,若接收完文件,则将文件存储在上传服务端中,并向客户端发送完成响应消息,其中,回调地址是在客户端发送的请求消息的请求头域中携带的,或回调地址是从应用服务端获取的,能够简化文件上传方式,增强上传前后处理能力,且应用服务端无需购买和维护存储设备。The embodiment of the present invention provides a communication system. The uploading server receives the request message sent by the client. The request message includes a request header field, and judges whether the file receiving condition is satisfied according to the request header field in the request message. If the file receiving condition is satisfied, Then receive the file and send a notification message to the application server according to the callback address. The callback address includes the callback address before upload and the callback address after upload. If the file is received, the file will be stored in the upload server and sent to the client. Response message, in which the callback address is carried in the request header field of the request message sent by the client, or the callback address is obtained from the application server, which can simplify the file upload method, enhance the processing ability before and after uploading, and the application server There is no need to purchase and maintain storage devices.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,客户端、服务端和方法,可以通过其它的方式实现。例如,以上所描述的设备实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, client, server and method can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
另外,在本发明各个实施例中的设备和系统中,各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理包括,也可以两个或两个以上单元集成在一个单元中。且上述的各单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。In addition, in the devices and systems in various embodiments of the present invention, each functional unit may be integrated into one processing unit, each unit may be physically included separately, or two or more units may be integrated into one unit. Moreover, each of the above-mentioned units can be implemented in the form of hardware, or can be implemented in the form of hardware plus software functional units.
实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,简称ROM)、随机存取存储器(Random Access Memory,简称RAM)、磁碟或者光盘等各种可以存储程序代码的介质。All or part of the steps for realizing the above-mentioned method embodiments can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium, and when the program is executed, the steps including the above-mentioned method embodiments are executed; The aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read Only Memory, ROM for short), random access memory (Random Access Memory, RAM for short), magnetic disk or optical disk, etc., which can store program codes. medium.
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以所述权利要求的保护范围为准。The above is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Anyone skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present invention. Should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be determined by the protection scope of the claims.
Claims (22)
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| PCT/CN2013/075331 WO2014179950A1 (en) | 2013-05-08 | 2013-05-08 | File uploading method, client, and server |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN103547339A CN103547339A (en) | 2014-01-29 |
| CN103547339B true CN103547339B (en) | 2017-01-25 |
Family
ID=49970070
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201380000611.XA Active CN103547339B (en) | 2013-05-08 | 2013-05-08 | File uploading method, client side and server side |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN103547339B (en) |
| WO (1) | WO2014179950A1 (en) |
Families Citing this family (9)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105991751A (en) * | 2015-03-06 | 2016-10-05 | 天津铂创国茂电子科技发展有限公司 | Direct access method through center server based on embed cloud branch server |
| CN105141696A (en) * | 2015-09-17 | 2015-12-09 | 成都华为技术有限公司 | File uploading method and device |
| CN107092635B (en) * | 2017-02-15 | 2020-08-04 | 北京星选科技有限公司 | Data query method, device, server, request terminal and system |
| CN107707616B (en) * | 2017-08-21 | 2019-02-12 | 贵州白山云科技股份有限公司 | A kind of data transmission method and system |
| CN109450990A (en) * | 2018-10-19 | 2019-03-08 | 深圳点猫科技有限公司 | A kind of cloud storage implementation method and electronic equipment based on educational system |
| CN110012055A (en) * | 2018-12-29 | 2019-07-12 | 北京乐我无限科技有限责任公司 | File uploading method, apparatus and system |
| CN109951550A (en) * | 2019-03-21 | 2019-06-28 | 浪潮软件集团有限公司 | Method and system for object storage |
| CN111083222B (en) * | 2019-12-13 | 2022-11-18 | 中富通集团股份有限公司 | Data uploading method and terminal |
| CN118646750A (en) * | 2024-08-15 | 2024-09-13 | 深圳市智慧城市科技发展集团有限公司 | Data uploading method, data processing device and readable storage medium |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102196012A (en) * | 2010-03-17 | 2011-09-21 | 华为技术有限公司 | Service opening method, system and service opening server |
| CN102546836A (en) * | 2012-03-09 | 2012-07-04 | 腾讯科技(深圳)有限公司 | Method, terminal, server and system for uploading files |
| CN102833337A (en) * | 2012-08-30 | 2012-12-19 | 北京星网锐捷网络技术有限公司 | FTP (File Transfer Protocol) file uploading, downloading method and device |
| CN103002029A (en) * | 2012-11-26 | 2013-03-27 | 北京百度网讯科技有限公司 | Management method, system and client for uploading files |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103023881B (en) * | 2012-11-26 | 2016-05-25 | 北京奇虎科技有限公司 | Information Security determination methods and system |
-
2013
- 2013-05-08 WO PCT/CN2013/075331 patent/WO2014179950A1/en active Application Filing
- 2013-05-08 CN CN201380000611.XA patent/CN103547339B/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102196012A (en) * | 2010-03-17 | 2011-09-21 | 华为技术有限公司 | Service opening method, system and service opening server |
| CN102546836A (en) * | 2012-03-09 | 2012-07-04 | 腾讯科技(深圳)有限公司 | Method, terminal, server and system for uploading files |
| CN102833337A (en) * | 2012-08-30 | 2012-12-19 | 北京星网锐捷网络技术有限公司 | FTP (File Transfer Protocol) file uploading, downloading method and device |
| CN103002029A (en) * | 2012-11-26 | 2013-03-27 | 北京百度网讯科技有限公司 | Management method, system and client for uploading files |
Also Published As
| Publication number | Publication date |
|---|---|
| CN103547339A (en) | 2014-01-29 |
| WO2014179950A1 (en) | 2014-11-13 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN103547339B (en) | File uploading method, client side and server side | |
| CN106230896B (en) | A message push method, device and system | |
| EP3298806B1 (en) | Methods and apparatus for analyzing and grouping service layer subscriptions and notifications for enhanced efficiency | |
| CN102932352B (en) | The method of communicating with the client and the server | |
| CN103795689A (en) | Resource subscription method and device | |
| CN111885093B (en) | Event request transmission method and device, storage medium and electronic equipment | |
| CN108200165B (en) | request transmission system, method, device and storage medium | |
| WO2017174026A1 (en) | Client connection method and system | |
| CN102904903B (en) | Communication system and communication means | |
| JP2004112319A (en) | Relay device, information transmission device, and information transmission method | |
| US20120014321A1 (en) | Messaging activity feed | |
| CN102111437A (en) | Simple object access protocol (SOAP) extension-based WEB service transmission compression method | |
| CN105657000A (en) | Message transmission method and device | |
| CN108282846A (en) | A kind of service request processing method and device | |
| CN110674172A (en) | Data query method and device | |
| CN100377522C (en) | OMA download realizing method in content distributing network | |
| CN105100230A (en) | File transmission method and device | |
| CN101159676A (en) | Method and system for data transmission | |
| CN105069012B (en) | A kind of file access method and system | |
| WO2019201111A1 (en) | Information processing method, apparatus and device, and computer-readable storage medium | |
| CN106341342A (en) | Communication connection maintaining method and device, terminal and server | |
| CN104243522B (en) | Method and wideband network gateway for HTTP network | |
| WO2014194526A1 (en) | Method, device and system for obtaining mobile network data resources | |
| CN104462223B (en) | A kind of Web browser method and device based on peer-to-peer network pattern | |
| CN104618517B (en) | A kind of method, system and device of PUSH message |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant |