WO2014179950A1 - 一种文件上传方法、客户端和服务端 - Google Patents

一种文件上传方法、客户端和服务端 Download PDF

Info

Publication number
WO2014179950A1
WO2014179950A1 PCT/CN2013/075331 CN2013075331W WO2014179950A1 WO 2014179950 A1 WO2014179950 A1 WO 2014179950A1 CN 2013075331 W CN2013075331 W CN 2013075331W WO 2014179950 A1 WO2014179950 A1 WO 2014179950A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
upload
callback address
uploading
server
Prior art date
Application number
PCT/CN2013/075331
Other languages
English (en)
French (fr)
Inventor
李晓明
李进
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2013/075331 priority Critical patent/WO2014179950A1/zh
Priority to CN201380000611.XA priority patent/CN103547339B/zh
Publication of WO2014179950A1 publication Critical patent/WO2014179950A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]

Definitions

  • the present invention relates to the field of Internet, and in particular, to a file uploading method, a client, and a server.
  • CDN Content Delivery Network
  • cloud storage mainly provides upload acceleration and download acceleration.
  • the upload acceleration method is as follows: The user uploads the file to the CDN node, and the CDN node transfers the file to the website, so that the user needs to perform two file uploads before uploading the file to the website.
  • the cloud storage system integrates a large number of different types of storage devices in the network through application software to jointly provide data storage and service access services. When using the cloud storage method, users can upload files to the website, and then upload the files to the cloud storage.
  • the user's files need to be uploaded twice, and in the CDN upload acceleration method, the storage facility needs to be purchased and maintained.
  • the cloud storage method after uploading the file, there may be a browser that needs to perform another interaction with the web server. If the application is in the CDN system, a relatively large modification of the application logic is required, and Amazon S3 ( Amazon Simple Storage Service, a centrally centralized service, is inconvenient for users to upload files.
  • Embodiments of the present invention provide a file uploading method, a client, and a server, which can simplify a file uploading manner and enhance post-uploading processing capabilities, and the application server does not need to purchase and maintain a storage device.
  • a file uploading method including: Receiving a request message sent by the client, where the request message includes a request header field; according to the request; the request header field in the % information determines whether the file receiving condition is met; and if the receiving condition of the file is met, receiving the request File, and send a notification message to the application server based on the callback address.
  • the callback address includes a pre-uplink callback address and an post-upload callback address.
  • the request header field further includes an application identifier, where the application identifier is used to identify the application server.
  • the callback address is carried in a request header field of a request message sent by the client, or the callback address It is obtained from the application server.
  • the method further includes: receiving, sent by the application server a registration message, the registration message including the callback address;
  • Receiving the file, and sending the notification message to the application server according to the callback address includes:
  • the pre-uploading callback address is obtained from the database according to the application identifier, and the first pre-uploading callback address is sent to the application server to send a first notification message, where the first The notification message includes first file information of the file; sending an upload response message to the client, where the upload response message includes the request header field, so that the client continues to upload the file; receiving and storing the file Determining, by the client, the file sent according to the upload response message, and then acquiring the post-upload callback address from the database according to the application identifier, and calling 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.
  • Receiving the file, and receiving the file according to the callback address, and sending the notification message to the application server according to the callback address includes: acquiring the pre-upload callback from the request header field if the receiving condition of the file is met Sending a first notification message to the application server, where the first notification message includes the first file information of the file;
  • the method further includes:
  • a completion response message is sent to the client.
  • the second aspect provides a file uploading method, including: sending a registration message to an uploading server, where the registration message includes a callback address when the file is uploaded; after the registration is completed, receiving the uploading server sends the callback address according to the callback address A file upload notification message to obtain file information for the file.
  • the callback address includes a pre-uplink callback address and an post-upload callback address.
  • the receiving, by the uploading server, a file uploading notification message sent according to the callback address, to obtain the file File information includes: Receiving, by the uploading server, a first notification message that is sent according to the pre-uploading callback address, where the first notification message includes first file information of the file;
  • the uploading server receives the file, receiving a second notification message sent by the uploading server according to the post-uploading callback address, where the second notification message includes second file information of the file.
  • the third aspect provides a method for uploading a file, including: sending a request message to an upload server, where the request message includes a request header field; and receiving an upload response message sent by the upload server, where the upload response message includes the Requesting a header field; uploading a file to the upload server according to the upload response message.
  • the request header field includes an application identifier, or the request header field includes a callback address and the application identifier.
  • the method further includes:
  • the fourth aspect provides an upload server, including:
  • a receiving unit configured to receive a request message sent by the client, where the request message includes a request header field
  • a determining unit configured to determine, according to the request header field in the request message, whether the receiving condition of the file is met
  • the processing unit is configured to: if the receiving condition of the file is met, receive the file, and send a notification message to the application server according to the callback address.
  • the callback address includes a pre-uplink callback address and an post-upload callback address.
  • the request header field further includes an application identifier, where the application identifier is used to identify the application server.
  • the callback address is carried in a request header field of the request message sent by the client, or the callback address It is obtained from the application server.
  • the method 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 save the callback address in a database.
  • the processing unit when the callback address is obtained from the application server, the processing unit includes: a first processing subunit And if the file receiving condition is met, obtaining the pre-uploading callback address from the database according to the application identifier, and calling the pre-uploading callback address to send a first notification message to the application server, where The first notification message includes the first file information of the file, and the first sending subunit is configured to send an upload response message to the client, where the upload response message includes the request header field, to facilitate the client And continuing 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 from the database according to the application identifier An address, and sending the post-upload callback address to send the second notification message to the application server, where the second notification message includes The second file information of the file.
  • a third processing sub-unit configured to: obtain the pre-upload callback address from the request header field, and invoke the pre-upload callback address to send the first to the application server if the receiving condition of the file is met a notification message, where 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 continues to upload the file
  • a fourth processing subunit 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 request header field, and invoke 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.
  • the method further includes:
  • a response unit configured to send a completion response message to the client after receiving the file.
  • the fifth aspect provides an application server, including: a second sending unit, configured to send a registration message to the uploading server, where the registration message includes a callback address when the file is uploaded;
  • the callback address includes a pre-uplink callback address and an post-upload callback address.
  • the second receiving unit is configured to: receive, by the uploading server, a first notification sent according to the pre-upload callback address a message, the first notification message includes first file information of the file;
  • the uploading server receives the file, receiving a second notification message sent by the uploading server according to the post-uploading callback address, where the second notification message includes second file information of the file.
  • a client including: a third sending unit, configured to send a request message to an uploading server, where the request message includes a request header field;
  • a third receiving unit configured to receive an upload response message sent by the uploading server, where the upload response message includes the request header field
  • a file uploading unit configured to send, according to the upload response message, the uploading server On send file.
  • the request header field includes an application identifier, or the request header field includes a callback address and the application identifier.
  • the method further includes:
  • an upload server including:
  • a first receiver configured to receive a request message sent by the client, where the request message includes a request header field
  • a first processor configured to determine, according to the request header field in the request message, whether a file receiving condition is met
  • the first receiver is further configured to: if the receiving condition of the file is met, receive the file, and the first transmitter sends a notification message to the application server according to the callback address.
  • the callback address includes a pre-uplink callback address and an post-upload callback address.
  • the request header field further includes an application identifier, where the application identifier is used to identify the application server.
  • the callback address is carried in a request header field of the request message sent by the client, or the callback address It is obtained from the application server.
  • the method further includes: the first receiver is further used Receiving a registration message sent by the application server, where the registration message includes the callback address;
  • the first memory is used to save the callback address in a database.
  • the first receiver, the first processor, the first memory, and the first transmitter are further configured to: when the callback address is obtained from the application server,
  • the first processor acquires the pre-uploading callback address from the database according to the application identifier, and the first transmitter invokes the pre-uploading callback address to serve the application.
  • Sending 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 Requesting a header field, so that the client continues to upload the file;
  • the first receiver is further configured to receive the file that is sent by the client according to the upload response message, where the first memory is further used to And storing the file
  • the first processor acquiring the post-upload callback address from the database according to the application identifier, where the first transmitter sends the post-upload callback address to the application server a second notification message, the second notification message including second file information of the file.
  • a receiver, the first processor, the first memory, and the first transmitter are configured to:
  • the first processor acquires the pre-uploading callback address from the request header field, and the first transmitter sends the pre-uploading callback address 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 And continuing to upload the file to the client
  • the first receiver is further configured to receive the file that is sent by the client according to the upload response message, where the first memory is further used to store the file
  • the first processor obtains the post-upload callback address from the request header field, and the first transmitter sends the second callback message to the application server by using the post-upload callback address, where the first The second notification message includes the second file information of the file.
  • the method further includes: After receiving the file, the first transmitter is further configured to send a completion response message to the client.
  • an application server is provided, including:
  • a second transmitter configured to send a registration message to the uploading server, where the registration message includes a callback address when the file is uploaded;
  • the callback address includes a pre-uplink callback address and an post-upload callback address.
  • the second receiver is configured to: receive a first notification message that is sent by the uploading server according to the pre-upload callback address
  • the first notification message includes first file information of the file
  • a client including: a third transmitter, configured to send a request message to an upload server, where the request message includes a request header field, and a third receiver, configured to receive, send, by the upload server The upload response message, the upload response message includes the request header field, and the third processor is configured to upload a file to the upload server according to the upload response message.
  • the request header field includes an application identifier, or the request header field includes a callback address and the application identifier.
  • the third receiver after the uploading server successfully calls back to the application server by using the callback address, the third receiver further uses Receiving a completion response message sent by the upload server.
  • a communication system including:
  • the embodiment of the present invention provides a file uploading method, a client, and a server.
  • the upload server receives a request message sent by the client, and the request message includes a request header field, and determines whether the file receiving condition 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 the 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. Obtained by the server, it can simplify the file uploading mode, enhance the processing ability before and after uploading, and the application server does not need to purchase and maintain the storage device.
  • FIG. 1 is a schematic flowchart of a file uploading method according to an embodiment of the present invention
  • FIG. 2 is a schematic flowchart of a file uploading method according to another embodiment of the present invention
  • FIG. 3 is a schematic diagram of a file according to another embodiment of the present invention
  • FIG. 4 is a schematic flowchart of a file uploading method according to another embodiment of the present invention
  • FIG. 5 is a schematic flowchart of a file uploading method according to another embodiment of the present invention
  • FIG. 7 is a schematic structural diagram of another upload server according to another embodiment of the present invention
  • FIG. 8 is still another upload server structure according to another embodiment of the present invention
  • FIG. 9 is a schematic diagram of another structure of an upload server according to another embodiment of the present invention
  • FIG. 10 is a schematic diagram of another structure of an upload server according to another embodiment of the present invention
  • FIG. 12 is a schematic structural diagram of a client according to another embodiment of the present invention
  • FIG. 13 is a schematic structural diagram of an upload server according to another embodiment of the present invention
  • FIG. 15 is a schematic structural diagram of a client according to another embodiment of the present invention
  • FIG. 16 is a schematic structural diagram of a communication system according to another embodiment of the present invention.
  • the system architecture in the embodiment of the present invention may include a client, a CDN (Content Delivery Network) node, and an App site (Application, application server), where the client, the CDN node, and the App site use HTTP (Hyper).
  • the Text Transport Protocol the communication protocol, communicates.
  • the client and CDN nodes need to support 100-continue processing.
  • An embodiment of the present invention provides a file uploading method, as shown in FIG. 1 , including:
  • the upload server receives a request message sent by the client, where the request message includes a request header field.
  • the upload server may be a cloud storage-based CDN (Content Delivery Network) node.
  • CDN Content Delivery Network
  • the CDN node has the advantages of cloud storage and traditional CDN, and provides mass storage capability, and the user can upload and upload from the nearest CDN node. download file.
  • the uploading server determines, according to the request header field in the request message, whether the receiving condition of the file is met.
  • the request header field in the request message sent by the client may include Expect: 100-continue, which is used to ask whether the CDN is willing to receive the file.
  • the uploading server receives the file, and sends a notification message to the application server according to the callback address.
  • the App (Application, Application Server) site can be a website that uses a CDN node to upload and download services.
  • the callback address may include a pre-upload callback address and an post-upload callback address. Exemplarily, the callback address is carried in the request header field sent by the client, or the callback address is obtained from the application server.
  • the registration message sent by the application server is received, and the registration message includes a callback address, and the callback address is saved in the database. If the receiving condition of the file is met, the CDN node obtains the pre-uploading callback address from the database according to the application identifier, and sends a first notification message to the application server by calling the pre-uploading callback address, where the first notification message includes the first file information of the file.
  • the upload response message is sent to the client, and the upload response message includes the request header field, so that the client continues to upload the file, and then receives and stores the file sent by the client according to the upload response message, and then obtains the post-upload callback from the database according to the application identifier.
  • the address, and calling the post-upload callback address sends a second notification message to the application server, where the second notification message includes the second file information of the file.
  • the CDN node When the callback address is carried in the request header field of the request message sent by the client, if the file receiving condition is met, the CDN node obtains the pre-upload callback address from the request header field, and invokes the pre-upload callback address to apply to the application.
  • the first notification message is sent, and the first notification message includes the first file information of the file, and then sends an upload response message to the client, where the upload response message includes a request header field, so that the client continues to upload the file, and then receives and stores the client.
  • the post-upload callback address is obtained from the request header field, and the post-upload callback address is sent to the application server to send a second notification message, where the second notification message includes the second file information of the file.
  • the embodiment of the present invention provides a file uploading method, where the uploading server receives the request message sent by the client, and the request message includes a request header field, and determines whether the file receiving condition is satisfied according to the request header field in the request message, if the file is received. The condition is that the file is received, and the notification message is sent to the application server according to the callback address, which can simplify the file uploading manner and enhance the pre-uploading processing capability, and the application server does not need to purchase and maintain the storage device.
  • a further embodiment of the present invention provides a file uploading method, as shown in FIG. 2, including:
  • the upload server receives the request message sent by the client, where the request message includes a request header field.
  • the client can use the mobile phone, computer and other devices used by the user, and the upload server can provide uploading and downloading services for the CDN node.
  • Clients, App Sites, and CDN nodes communicate using the HTTP (Hyper Text Transport Protocol) protocol.
  • the client sends an HTTP message to the CDN node, where the request message includes a request header field, and is used to query whether the CDN node is willing to accept the client to upload the file.
  • the request header field may contain a first status code Expect: 100-continue, ie the client and the CDN node need to support the processing of the 100-continue status code in the HTTP 1.1 protocol.
  • the request header field may also include an Appid (Application IDentity) and a callback address.
  • the callback address may include a pre-upload callback address (callback_url_pre) and an post-upload callback address (callback_url_post), so that the CDN node notifies the App according to the callback address after receiving the request message sent by the client.
  • File information uploaded by the site The Appid application identifier is used to indicate the App application server, and the CDN can distinguish the App site according to the Appid. Therefore, the requestor code can be as follows:
  • the uploading server determines, according to the request header field in the request message, whether the receiving condition of the file is met.
  • the CDN node blocks after receiving the request message of the client, and can determine, according to the request header field in the request message, whether the HTTP request header field includes the first status code Expect: 100-continue header, if the Expect: 100- The continue header continues to communicate with the client, and the CDN node is willing to receive the client's file upload; if the Expect: 100-continue header is not included, the CDN node disconnects from the client.
  • the uploading server obtains the pre-uploading callback address from the request header field, and sends a pre-uploading callback address to the application server to send a first notification message, where the first notification message includes the first file of the file. information. Specifically, if the request message sent by the client includes an Expect: 100-continue header, the receiving condition of the file is satisfied.
  • 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 calls the pre-upload callback address to send a first notification message to the App site application server to notify the App site to upload.
  • the first file information may include information such as the size of the file and the name of the file.
  • the program code of the callback request for this step process can be:
  • the upload server sends an upload response message to the client, and the upload response message includes a request header field, so that the client continues to upload the file.
  • the CDN node may return a response message to the client, and agree to receive the file content sent by the client.
  • the response message may include a 100-continue header to cause the client to continue to upload files to the CDN node.
  • the client continues to upload the file content to the CDN node.
  • the client fails to upload the file.
  • the program code for the response process in this step can be as follows:
  • the uploading server receives and stores the file sent by the client according to the upload response message, and then obtains the post-upload callback address from the request header field, and sends the post-upload callback address to the application server to send a second notification message, the second notification message. Includes the second file information of the file.
  • the CDN node continues to receive the file uploaded by the client.
  • the CDN node receives the file content from the client.
  • the sent request header field obtains the post-upload callback address callback_url_post, and calls the post-upload callback address to send to the App site.
  • Sending a second notification message where the second notification message includes second file information of the file uploaded by the client.
  • the second file information may include file content of the client uploaded file.
  • the second notification message may further include a download URL (Universal Resource Locator) field, so that the user can download the file from the CDN node by using the URL address.
  • the program code in this step can be:
  • the uploading server After receiving the file, the uploading server sends a completion response message to the client. 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 successfully uploading the message. In this way, after the App site obtains the file information, it is assumed that when the user downloads the file at the App application site, the App site can guide the user to download the file content in the CDN node by using the corresponding URL of the file in the second notification message after the upload.
  • the CDN node provides a file uploading and downloading service.
  • the App site serves as an application server, and uses a CDN node to upload and download services.
  • the embodiment of the present invention provides a file uploading method, which receives a request message sent by a client, where the request message includes a request header field, and the request header field includes a callback address, and determines whether the file receiving condition is met according to the request header field in the request message.
  • the uploading server After the receiving condition of the file is satisfied, the uploading server obtains the pre-uploading callback address from the request header field, and sends a pre-uploading callback address to the application server to send a first notification message, where the first notification message includes the first file information of the file,
  • the client sends an upload response message, and the upload response message includes a request header field to facilitate the client.
  • the terminal continues to upload the file, receives and stores the file sent by the client according to the upload response message, and then obtains the post-upload callback address from the request header field, and calls the post-upload callback address to send the second notification message to the application server, the second notification message.
  • a further embodiment of the present invention provides a file uploading method, as shown in FIG. 3, including:
  • the upload server receives the registration message sent by the application server, where the registration message includes a callback address.
  • the upload server can provide upload and download services for the CDN node.
  • the App site can be a website that uses CDN nodes to upload and download services.
  • the CDN node may provide a callback registration interface to the App site, and the App site invokes the callback registration interface to send a registration message to the CDN node, where the registration message may include a callback address, including a callback_url_pre and a callback after the upload. Address callback — url — post.
  • the callback address can be used by the Ap site to register a callback address with the CDN node to obtain a file upload notification.
  • the App registration process code can be:
  • the upload server saves the callback address in the database. Specifically, after the App site successfully registers with the CDN node, the CDN node returns a registration response message to the App site to notify the App site that the registration is successful. The CDN node saves the callback address of the App site registration in the database.
  • the upload server receives the request message sent by the client, where the request message includes the request header. area.
  • the client, the App site, and the CDN node communicate using the HTTP (Hyper Text Transport Protocol) protocol.
  • HTTP Hyper Text Transport Protocol
  • the request message is sent to the CDN node, where the request message includes a request header field, where the request header field includes a first status code Expect: 100-continue, that is, the client and the CDN node need to support the pair. Processing of the 100-continue status code in the HTTP 1.1 protocol.
  • the request header field further includes an Appid, and the Appid application identifier is used to indicate 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:
  • the uploading server determines, according to the request header field in the request message, whether the receiving condition of the file is met.
  • the CDN node blocks, according to the request header field in the request message, whether the HTTP request header field includes the first status code Expect: 100 -continue header, if the Expect: 100- The continue header continues to communicate with the client, and the CDN node is willing to receive the client's file upload; if the Expect: 100-continue header is not included, the CDN node disconnects from the client.
  • the uploading server obtains the pre-uploading callback address from the database according to the application identifier, and sends a first notification message to the application server by calling the pre-uploading callback address, where the first notification message includes the first file.
  • File information If the receiving condition of the file is met, the uploading server obtains the pre-uploading callback address from the database according to the application identifier, and sends a first notification message to the application server by calling the pre-uploading callback address, where the first notification message includes the first file.
  • the CDN node invokes the pre-upload callback address callback_url_pre from the database according to the Appid application identifier, and invokes the pre-upload callback address to the Ap.
  • the website sends a first notification message to notify the first file information of the file uploaded by the App site client.
  • the first file information may include information such as the size of the file and the name of the file.
  • the program code of the callback request for this step process can be:
  • the upload server sends an upload response message to the client, and the upload response message includes a request header field, so that the client continues to upload the file.
  • the CDN node may return a response message to the client, and agree to receive the file content sent by the client.
  • the response message may include a 100-continue header to cause the client to continue to upload files to the CDN node.
  • the program code for the response process in this step can be as follows:
  • the HTTP/1.1 100 Continue client continues to upload file content to the CDN node after receiving a 100-continue response header from the CDN node.
  • the client fails to upload the file.
  • the uploading server receives and stores the file sent by the client according to the upload response message, and then obtains the post-upload callback address from the database according to the application identifier, and sends the second callback message to the application server by calling the post-upload callback address, the second notification.
  • the message includes the second file information of the file.
  • the CDN node queries the database according to the Appid application identifier to obtain the post-callback callback address of the Ap site registration callback— Url_post, notifies the App site of the uploaded second file information.
  • the second file information may include the file content of the file uploaded by the client.
  • the second notification message may further include a download URL field, so that the user can download the file from the CDN node by using the URL address.
  • the program code in this step can be:
  • the uploading server sends a completion response message to the client.
  • the CDN node stores the file content, and returns a response message to the client, and the client obtains the file successfully uploading the message.
  • the App site can enable the guiding user to download the file content in the CDN node by uploading the corresponding URL in the second notification message.
  • the CDN node provides file uploading and downloading services.
  • the App site serves as an application server and uses CDN nodes to upload and download services.
  • the CDN node uses a combination of CDN and cloud storage architecture. In this way, 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 file uploading method, which receives a registration message sent by an application server, where the registration message includes a callback address, stores the callback address in a database, and receives a request message sent by the client, where the request message includes a request header field, according to The request header field in the request message determines whether the file receiving condition is met. If the file receiving condition is met, the uploading server obtains the pre-uploading callback address from the database according to the application identifier, and sends the pre-uploading callback address to the application server.
  • the first notification message includes the first file information of the file, and then sends an upload response message to the client, where the upload response message includes a request header field, so that the client continues to upload the file, and then receives and stores the client according to the upload response.
  • the file sent by the message and then obtaining the post-upload callback address from the database according to the application identifier, and calling 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, after receiving the file
  • the client sends a completion response message, which simplifies the file uploading mode and enhances the pre-uploading and processing capabilities, and the application server does not need to purchase and maintain the storage device.
  • the application server sends a registration message to the upload server, where the registration message includes a callback address when the file is uploaded.
  • the application server is an App site, for example, an Internet application site, a website, or 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, where the registration message includes a callback address, including a pre-upload callback address and an upload-back callback address.
  • the callback address can be used by the Ap site to register a callback address with the CDN node to obtain a file upload notification.
  • the App registration process code can be:
  • the notification message sent by the upload server according to the file sent by the callback address is received to obtain the file information of the file.
  • the CDN node After the App site successfully registers with the CDN node, the CDN node returns a registration response message to the App site to notify the App site that the registration is successful.
  • the CDN node saves the callback address of the App site registration in the database.
  • the CDN node receives the request message sent by the client, and the request message includes a request header field.
  • the CDN node determines whether the file receiving condition is met according to the request header field in the request message. If the file receiving condition is met, the App site receives the CDN node according to the uploading condition.
  • the first notification message sent by the callback address, the first notification message includes the first file information of the file, and the first file information may include information such as the size of the file and the name of the file.
  • the request header sent by the client may be sent from the client by the pre-upload callback address obtained by the CDN node. Get in the domain, that is, the request header field of the request message carries the callback address, or is obtained from the database through Appid.
  • 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 continues to upload 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 Appid, and sends the second call 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, and the second notification message includes the second file information of the file, and the second file information may include the file content of the client upload file. .
  • the embodiment of the present invention provides a file uploading method, where the application server sends a registration message to the uploading server, where the registration message includes a callback address when the file is uploaded, and after the application server registers, the file sent by the uploading server according to the callback address is received.
  • the uploaded notification message can obtain the file information of the file, which can simplify the file uploading mode, enhance the processing capability before and after uploading, and the application server does not need to purchase and maintain the storage device.
  • a further embodiment of the present invention provides a file uploading method, as shown in FIG. 5, including:
  • a client sends a request message to an upload server, where the request message includes a request header field.
  • the client refers to a program that provides a local service to the client, such as a browser and various mobile applications. In addition to some applications that run only locally, they are typically installed on a regular client and need to work with the server. For example, it can be run on a user's computer, mobile phone, etc.
  • the request header field may include a first status code Expect: 100-continue, and the client and CDN nodes need to support processing of the 100-continue status code in the HTTP 1.1 protocol. Also included is an Appid, which is used to mark the App application server, and the CDN can distinguish the Ap site according to the Appid.
  • the client receives an upload response message sent by the upload server. Specifically, after the client sends the request message to the CDN node, the CDN node determines whether the file receiving condition is met according to whether the request header field of the request message includes the first status code Expect: 100-continue, and if the file receiving condition is met, the CDN Node callback before uploading
  • the address sends a first notification message to the client, where 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 in the request message sent by the client, so that the client can continue to upload the file.
  • the callback address may be carried in the request header field of the request message sent by the client, or the callback address is obtained from the application server, including the pre-upload callback address and the post-upload callback address.
  • the callback address is obtained from the application server, by receiving the registration message sent by the application server, the registration message includes a callback address, and the callback address is saved in the database.
  • the client uploads a file to the upload server according to the upload response message.
  • the client after receiving the response header carrying the 100-continue from the CDN node, the client continues to upload the file content to the CDN node.
  • the client fails to upload the file.
  • 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, where the second notification message includes the second file.
  • File information The embodiment of the present invention provides a file uploading method, in which the client sends a request message to the uploading server, and after receiving the uploading response message sent by the uploading server, uploading the file to the uploading server according to the uploading response message, the file uploading manner can be simplified. .
  • a further embodiment of the present invention provides an upload server 01, as shown in FIG. 6, comprising: a receiving unit 016, configured to receive a request message sent by a client, where the request message includes a request header field.
  • the determining unit 011 is configured to determine, according to the request header field in the request message, whether the file receiving condition is met.
  • the processing unit 012 is configured to: if the file receiving condition is met, receive the file, and send a notification message to the application server according to the callback address.
  • the callback address includes a callback address before uploading and a callback address after uploading.
  • the request header field further includes an application identifier, where the application identifier is used to identify the application server.
  • 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 method further includes:
  • the first receiving unit 014 is configured to receive, before receiving the request message sent by the client, a registration message sent by the application server, where the registration message includes a callback address.
  • the storage unit 015 is used to save the callback address in the database.
  • the processing unit 012 may include:
  • the first processing sub-unit 0121 is configured to: before the file receiving condition is met, obtain the pre-uploading callback address from the database according to the application identifier, and send the first notification message to the application server by calling the pre-uploading callback address, where the first notification message includes the file.
  • 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 continues to upload the file.
  • the second processing sub-unit 0123 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 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.
  • the processing unit 012 may include: a third processing subunit 0124, configured to satisfy the receiving of the file.
  • the condition is that the pre-upload callback address is obtained from the request header field, and the pre-upload callback address is sent to the application server to send a first notification message, where the first notification message includes the first file information of the file.
  • the second sending sub-unit 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 continues to upload the file.
  • the fourth processing sub-unit 0126 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 request header field, and send 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.
  • the method further includes: a response unit 013, configured to send a completion response message to the client after receiving the file.
  • the receiving unit 016 is configured to perform 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; Step 102 in the embodiment shown in FIG. 1 or step 202 in the embodiment shown in FIG. 2 or step 304 in the embodiment shown in FIG.
  • processing unit 012 is used to execute the embodiment shown in FIG. Step 103, or step 203 to step 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 configured to perform the embodiment in the embodiment shown in FIG. Step 301:
  • the storage unit 015 is configured to perform step 302 in the embodiment shown in FIG. 3;
  • the first processing sub-unit 0121 is configured to perform step 305 in the embodiment shown in FIG. 3;
  • the first sending sub-unit 0122 is used to execute the figure.
  • Step 306 in the embodiment shown in Figure 3; the second processing sub-unit 0123 is used to perform step 307 in the embodiment shown in Figure 3; the third processing sub-unit 0124 is used to perform step 203 in the embodiment shown in Figure 2;
  • the second sending sub-unit 0125 is configured to perform step 204 in the embodiment shown in FIG. 2; the fourth processing sub-unit 0126 Step 205 for performing the embodiment shown in FIG. 2; response unit 013 is used to perform step 206 in the embodiment shown in FIG. 2, or step 308 in the embodiment shown in FIG.
  • the embodiment of the present invention provides an uploading server, and the uploading server receives a request message sent by the client, where the request message includes a request header field, and determines whether the file receiving condition is met according to the request header field in the request message, if the file is received.
  • the condition is that the file is received, and the notification message is sent to the application server according to the callback address, which can simplify the file uploading manner and enhance the pre-uploading processing capability, and the application server does not need to purchase and maintain the storage device.
  • a further embodiment of the present invention provides an application server 02.
  • the method includes: a second sending unit 021, configured to send a registration message to the uploading server, where the registration message includes a callback address when the file is uploaded.
  • the second receiving unit 022 is configured to: after the registration is completed, receive a notification message that the uploading server sends the file according to the callback address to obtain the file information of the file.
  • the callback address includes a callback address before uploading and a callback address after uploading.
  • the second receiving unit 022 is configured to: receive a first notification message sent by the uploading server according to the pre-uploading callback address, the first pass The notification message includes the first file information of the file; when the uploading server receives the file, receiving the second notification message sent by the uploading server according to the post-uploading callback address, where the second notification message includes the second file information of the file.
  • the second sending unit 021 is configured to perform step 401 in the embodiment shown in FIG. 4, and the second receiving unit 022 is configured to perform step 402 in the embodiment shown in FIG.
  • An embodiment of the present invention provides an application server, where the application server sends a registration message to the upload server, where the registration message includes a callback address when the file is uploaded, and after the application server is registered, the file sent by the upload server according to the callback address is received.
  • the uploaded notification message can obtain the file information of the file, which can simplify the file uploading mode, enhance the processing capability before and after uploading, and the application server does not need to purchase and maintain the storage device.
  • a further embodiment of the present invention provides a client 03, as shown in FIG. 12, including: a third sending unit 031, configured to send a request message to the uploading server, where the request message includes a request header field.
  • the third receiving unit 032 is configured to receive an upload response message sent by the uploading server, where the upload response message includes a request header field.
  • the file uploading unit 033 is configured to upload a file to the uploading server according to the upload response message.
  • the request header field includes an application identifier, or the request header field includes a callback address and an application identifier.
  • it may also include:
  • the uploading server After the uploading server successfully calls back to the application server through the callback address, it receives the completion response message sent by the uploading server.
  • the third sending unit 031 is configured to perform step 501 in the embodiment shown in FIG. 5; the third receiving unit 032 is configured to perform step 502 in the embodiment shown in FIG. 5; and the file uploading unit 033 is configured to execute FIG. 5.
  • An embodiment of the present invention provides a client, where a client sends a request message to an upload server, where the request message includes a request header field, and receives an upload response message sent by the upload server, where the upload response message includes a request header field, and according to the upload response message, Upload files to the upload server, can Simplified file uploading method.
  • a further embodiment of the present invention provides an upload server 04. As shown in FIG.
  • the upload server 04 includes: a first bus 041, and a first processor 042 and a first memory 043 connected to the first bus 041. a first receiver 044 and a first transmitter 045, wherein the first memory 043 is configured to store an instruction, and the first receiver 044 is configured to execute the instruction for receiving a request message sent by a client, where the request message includes a request
  • the header field is specifically used to perform 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 The instruction is executed to determine whether the receiving condition of the file is satisfied according to the request header field in the request message, specifically for performing step 102 in the embodiment shown in FIG.
  • the first receiver 044 is further configured to execute the instruction, and if the file receiving condition is met, the file is received, and the first transmitter 045 calls the callback address to send to the application server.
  • Notification message Specifically, it is used to perform step 103 in the embodiment shown in FIG. 1 or step 203 to step 205 in the embodiment shown in FIG. 2 or step 305 to step 307 in the embodiment shown in FIG. 3;
  • the callback address includes the pre-upload callback address and the post-upload callback address.
  • the request header field includes an application identifier, and the application identifier is used to identify the application server.
  • the callback address is carried in a request header field of the request message sent by the client, or the callback address is obtained from the application server.
  • the first receiver 044 is configured to execute the instruction, including: before receiving the request message sent by the client, the first receiving The device is further configured to receive a registration message sent by the application server, where the registration message includes a callback address, specifically for performing step 301 in the embodiment shown in FIG. 3; the first memory 043 is configured to save the callback address in the database, specifically Step 302 in the embodiment shown in FIG. 3 is performed.
  • the first receiver 044, the first processor 042, and the first transmitter 045 execute the instruction, and is further configured to: If the file receiving condition is met, the first processor 042 obtains the pre-uploading callback address from the database according to the application identifier, and the first transmitter 045 calls the pre-uploading callback address to send the first notification message to the application server, where the first notification message includes The first file information of the file is specifically used to perform step 305 in the embodiment shown in FIG.
  • the first transmitter 045 is further configured to send an upload response message to the client, where the upload response message includes a request header field, so that the client continues
  • the uploading file is specifically used to perform step 306 in the embodiment shown in FIG. 3.
  • the first receiver 044 is further configured to receive and store a file sent by the client according to the upload response message
  • the first memory 043 is also used to store and store the file.
  • the first processor 042 obtains the post-upload callback address from the database according to the application identifier, and the first transmitter 045 calls 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. Specifically, it is used to perform step 307 in the embodiment shown in FIG.
  • the execution of the instruction by the transmitter 045 is further configured to: if the file receiving condition is met, the first processor 042 obtains the pre-uploading callback address from the request header field, and the first transmitter 045 calls the pre-uploading callback address to send the first to the application server.
  • a notification message the first notification message includes the first file information of the file, specifically for performing step 203 in the embodiment shown in FIG. 2; the first transmitter 045 sends an upload response message to the client, where the upload response message includes the request header.
  • a domain in order for the client to continue uploading the file, specifically for performing step 204 in the embodiment shown in FIG. 2;
  • a transmitter 045 sends a second notification message to the application server by calling the post-upload callback address.
  • the second notification message includes the second file information of the file, which is specifically used to perform step 205 in the embodiment shown in FIG.
  • the first transmitter 045 executes the instruction and is further configured to send a completion response message to the client, specifically for performing step 206 in the embodiment shown in FIG. , or step 308 in the embodiment shown in FIG.
  • the upload server receives the request message sent by the client, and the request message includes a request header field, and determines whether the file receiving condition is met according to the request header field in the request message, if the file is received.
  • the condition is that the file is received, and the notification message is sent to the application server according to the callback address, which can simplify the file uploading manner and enhance the processing capability before and after the uploading.
  • a further embodiment of the present invention provides an application server 05.
  • the application server includes: a second bus 041, and a second processor 042 and a second memory 043 connected to the second bus 041.
  • the second receiver 044 executes the instruction to send a registration message to the uploading server, where the registration message includes a file uploading
  • the second receiver 044 executes the instruction for receiving the notification message of the file upload sent by the uploading server according to the callback address after the registration is completed, to obtain the file information of the file.
  • the callback address includes a pre-upload callback address and an upload post-callback address.
  • the second receiver 044 is configured to: receive the first notification message sent by the uploading server according to the pre-uploading callback address, where the first notification message includes the first file information of the file. ;
  • the receiving server When the uploading server receives the file, the receiving server sends a second notification message sent according to the post-uploading callback address, and the second notification message includes the second file information of the file.
  • the second transmitter 045 is configured to perform step 401 in the embodiment shown in FIG. 4, and the second receiver 044 is configured to perform step 402 in the embodiment shown in FIG. Therefore, in the application server of the embodiment of the present invention, the application server sends a registration message to the upload server, where the registration message includes a callback address when the file is uploaded, and after the application server is registered, the file sent by the upload server according to the callback address is received.
  • the uploaded notification message can obtain the file information of the file, which can simplify the file uploading mode, enhance the processing capability before and after uploading, and the application server does not need to purchase and maintain the storage device.
  • a further embodiment of the present invention provides a client 06. As shown in FIG.
  • the client 06 includes: a third bus 041, and a third processor 042, a third memory 043, and a third terminal connected to the third bus 041.
  • the request header field includes an application identifier, or the request header i or includes a callback address and an application identifier.
  • the third receiver 044 is configured to execute the instruction and is further configured to receive the completion response message sent by the upload server.
  • the third transmitter 045 is configured to perform step 501 in the embodiment shown in FIG. 5; the third receiver 044 is configured to perform step 502 in the embodiment shown in FIG. 5; Step 503 in the embodiment shown in FIG. 5 is executed.
  • the client sends a request message to the upload server, where the request message includes a request header field, and receives an upload response message sent by the upload server, where the upload response message includes a request header field, and according to the upload response message, Uploading files to the upload server simplifies file uploading.
  • a further embodiment of the present invention provides a communication system 1, as shown in FIG. 16, comprising: an upload server 04, an application server 05, and a client 06 provided by the foregoing embodiments.
  • the uploading server 04 is used to perform steps 101 to 103 in the embodiment shown in FIG. 1, or steps 201 to 206 in the embodiment shown in FIG. 2, or step 301 in the embodiment shown in FIG.
  • the application server 05 is configured to perform steps 401 to 402 in the embodiment shown in FIG. 4; the client 06 is configured to perform steps 501 to 503 in the embodiment shown in FIG.
  • the embodiment of the present invention provides a communication system, where the uploading server receives the request message sent by the client, and the request message includes a request header field, and determines whether the file receiving condition is met according to the request header field in the request message, and if the file receiving condition is met, Receiving the file, and sending a notification message to the application server according to the callback address, where the callback address includes the pre-upload callback address and the post-upload callback address. If the file is received, the file is stored in the upload server and sent to the client.
  • the response message where 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 mode, enhance the pre-upload processing capability, and apply the server end. No need to purchase and maintain storage Ready.
  • the disclosed system, client, client, and method may be implemented in other manners.
  • the device embodiments described above are only schematic.
  • the division of the unit is only a logical function division.
  • there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not executed.
  • the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be electrical, mechanical or otherwise.
  • each functional unit may be integrated in one processing unit, or each unit may be physically included separately, or two or more units may be integrated in one unit.
  • the above units can be implemented in the form of hardware or in the form of hardware plus software functional units.
  • All or part of the steps of implementing the above method embodiments may be performed by hardware related to the program instructions.
  • the foregoing program may be stored in a computer readable storage medium, and when executed, the program includes the steps of the foregoing method embodiments;
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read only memory (ROM), a random access memory (RAM), a disk or an optical disk, and the like, which can store program codes. medium.

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

本发明实施例提供一种文件上传方法、客户端和服务端,涉及互联网领域,能够简化文件上传方式,增强上传前后处理能力,且应用服务端无需购买和维护存储设备。其方法为:上传服务端接收客户端发送的请求消息,请求消息包括请求头域,根据请求消息中的请求头域判断是否满足文件的接收条件,若满足文件的接收条件,则接收文件,并根据回调地址向应用服务端发送通知消息,其中,回调地址是在客户端发送的请求消息的请求头域中携带的,或回调地址是从应用服务端获取的。本发明实施例用于上传文件。

Description

一种文件上传方法、 客户端和服务端 技术领域 本发明涉及互联网领域, 尤其涉及一种文件上传方法、 客户端和 服务端。
背景技术
随着互联网的高速发展, 越来越多的网站提供上传工具, 鼓励用户 上传文件。 但是由于网站上传服务器的性能、 带宽、 安全等的限制, 用 户上传文件的效率受到了严重影响, 现有技术中, 能够改善上传体验的 方法, 主要有两种:一种是 CDN ( Content Delivery Network , 内容分发网 络) 上传加速功能, 一种是使用云存储。 具体的, CDN主要提供了上传加速和下载加速功能。 其中, 上传加 速的方法为: 用户将文件上传到 CDN节点, CDN节点将文件传输到网 站, 这样, 用户需要进行 2 次文件上传, 才能将文件上传到网站。 而云 存储是将网络中大量的各种不同类型的存储设备通过应用软件集合起来 协同工作, 共同对外提供数据存储和业务访问服务。 当使用云存储的方 法时, 用户可以将文件上传到网站, 网站再将文件上传至云存储。
因此,在上述两种方法中,用户的文件都需要进行 2次上传,在 CDN 上传加速方法中, 还需要购买和维护存储设施。 另外, 在云存储方法中, 当上传完文件后, 可能存在浏览器还需要与网络服务器再进行一次交互, 如果是应用在 CDN 系统中, 需要对应用逻辑做比较大的修改, 并且 Amazon S3 ( Amazon Simple Storage Service , 亚马逊简易储存服务 ) 为 中心集中式服务, 给用户上传文件带来不便。
发明内容 本发明的实施例提供一种文件上传方法、 客户端和服务端, 能够简 化文件上传方式, 增强上传前后处理能力, 且应用服务端无需购买和维 护存储设备。
为达到上述目的, 本发明的实施例釆用如下技术方案:
第一方面, 提供一种文件上传方法, 包括: 接收客户端发送的请求消息, 所述请求消息包括请求头域; 根据所述请求; %息中的请求头域判断是否满足文件的接收条件; 若满足所述文件的接收条件, 则接收所述文件, 并根据回调地址向 应用服务端发送通知消息。
结合第一方面, 在第一种可能实现的方式中, 所述回调地址包括上 传前回调地址和上传后回调地址。
结合第一方面的第一种可能实现的方式, 在第二种可能实现的方式 中, 所述请求头域还包括应用标识, 所述应用标识是用来标识所述应用 服务端的。 结合第一方面的第二种可能实现的方式, 在第三种可能实现的方式 中, 所述回调地址是在所述客户端发送的请求消息的请求头域中携带的, 或所述回调地址是从所述应用服务端获取的。 结合第一方面的第三种可能实现的方式, 在第四种可能实现的方式 中, 当所述回调地址是从所述应用服务端获取的时, 还包括: 接收所述应用服务端发送的注册消息, 所述注册消息包括所述回调 地址;
将所述回调地址保存在数据库中。 结合第一方面的第四种可能实现的方式, 在第五种可能实现的方式 中, 当所述回调地址是从所述应用服务端获取的时, 所述若满足所述文 件的接收条件, 则接收所述文件, 并根据回调地址向应用服务端发送通 知消息包括:
若满足所述文件的接收条件, 则根据应用标识从所述数据库中获取 所述上传前回调地址, 并调用所述上传前回调地址向所述应用服务端发 送第一通知消息, 所述第一通知消息包括所述文件的第一文件信息; 向所述客户端发送上传响应消息, 所述上传响应消息包括所述请求 头域, 以便于所述客户端继续上传所述文件; 接收并存储所述客户端根据所述上传响应消息发送的所述文件, 而 后根据所述应用标识从所述数据库中获取所述上传后回调地址, 并调用 所述上传后回调地址向所述应用服务端发送第二通知消息, 所述第二通 知消息包括所述文件的第二文件信息。 结合第一方面的第三种可能实现的方式, 在第六种可能实现的方式 中, 当所述回调地址是在所述客户端发送的请求消息的请求头域中携带 的时, 所述若满足所述文件的接收条件, 则接收所述文件, 并根据回调 地址向应用服务端发送通知消息包括: 若满足所述文件的接收条件, 则从所述请求头域中获取所述上传前 回调地址, 并调用所述上传前回调地址向所述应用服务端发送第一通知 消息, 所述第一通知消息包括所述文件的第一文件信息;
向所述客户端发送上传响应消息, 所述上传响应消息包括所述请求 头域, 以便于所述客户端继续上传所述文件; 接收并存储所述客户端根据所述上传响应消息发送的所述文件, 而 后从所述请求头域中获取所述上传后回调地址, 并调用所述上传后回调 地址向所述应用服务端发送第二通知消息, 所述第二通知消息包括所述 文件的第二文件信息。 结合第一方面或第一方面的第一种可能实现的方式至第六种可能实 现的方式, 在第七种可能实现的方式中, 所述方法还包括:
在接收完所述文件后, 向所述客户端发送完成响应消息。
第二方面, 提供一种文件上传方法, 包括: 向上传服务端发送注册消息, 所述注册消息包括文件上传时的回调 地址; 在注册完成后, 接收所述上传服务端根据所述回调地址发送的文件 上传的通知消息, 以获取所述文件的文件信息。
结合第二方面, 在第一种可能实现的方式中, 所述回调地址包括上 传前回调地址和上传后回调地址。
结合第二方面的第一种可能实现的方式, 在第二种可能实现的方式 中, 所述接收所述上传服务端根据所述回调地址发送的文件上传的通知 消息, 以获取所述文件的文件信息包括: 接收所述上传服务端根据所述上传前回调地址发送的第一通知消 息, 所述第一通知消息包括所述文件的第一文件信息;
当所述上传服务端接收完所述文件时, 接收所述上传服务端根据所 述上传后回调地址发送的第二通知消息, 所述第二通知消息包括所述文 件的第二文件信息。
第三方面, 提供一种文件上传方法, 包括: 向上传服务端发送请求消息, 所述请求消息包括请求头域; 接收所述上传服务端发送的上传响应消息, 所述上传响应消息包括 所述请求头域; 根据所述上传响应消息, 向所述上传服务端上传文件。
结合第三方面, 在第一种可能实现的方式中, 所述请求头域包括应 用标识, 或者所述请求头域包括回调地址和所述应用标识。
结合第三方面的第一种可能实现的方式, 在第二种可能实现的方式 中, 所述方法还包括:
接收所述上传服务端发送的完成响应消息。 第四方面, 提供一种上传服务端, 包括:
接收单元, 用于接收客户端发送的请求消息, 所述请求消息包括请 求头域;
判断单元, 用于根据所述请求消息中的请求头域判断是否满足文件 的接收条件;
处理单元, 用于若满足所述文件的接收条件, 则接收所述文件, 并 根据回调地址向应用服务端发送通知消息。 结合第四方面, 在第一种可能实现的方式中, 所述回调地址包括上 传前回调地址和上传后回调地址。
结合第四方面的第一种可能实现的方式, 在第二种可能实现的方式 中, 所述请求头域还包括应用标识, 所述应用标识是用来标识所述应用 服务端的。 结合第四方面的第二种可能实现的方式, 在第三种可能实现的方式 中, 所述回调地址是在所述客户端发送的请求消息的请求头域中携带的, 或所述回调地址是从所述应用服务端获取的。 结合第四方面的第三种可能实现的方式, 在第四种可能实现的方式 中, 当所述回调地址是从所述应用服务端获取的时, 还包括:
第一接收单元, 用于接收所述应用服务端发送的注册消息, 所述注 册消息包括所述回调地址;
存储单元, 用于将所述回调地址保存在数据库中。
结合第四方面的第四种可能实现的方式, 在第五种可能实现的方式 中, 当所述回调地址是从所述应用服务端获取的时, 所述处理单元包括: 第一处理子单元, 用于若满足所述文件接收条件, 则根据应用标识 从所述数据库中获取所述上传前回调地址, 并调用所述上传前回调地址 向所述应用服务端发送第一通知消息, 所述第一通知消息包括所述文件 的第一文件信息; 第一发送子单元, 用于向所述客户端发送上传响应消息, 所述上传 响应消息包括所述请求头域, 以便于所述客户端继续上传所述文件; 第二处理子单元, 用于接收并存储所述客户端根据所述上传响应消 息发送的所述文件, 而后根据所述应用标识从所述数据库中获取所述上 传后回调地址, 并调用所述上传后回调地址向所述应用服务端发送第二 通知消息, 所述第二通知消息包括所述文件的第二文件信息。 结合第四方面或第四方面的第三种可能实现的方式, 在第六种可能 实现的方式中, 当所述回调地址是在所述客户端发送的请求消息的请求 头域中携带的时, 所述处理单元包括:
第三处理子单元, 用于若满足所述文件的接收条件, 则从所述请求 头域中获取所述上传前回调地址, 并调用所述上传前回调地址向所述应 用服务端发送第一通知消息, 所述第一通知消息包括所述文件的第一文 件信息;
第二发送子单元, 用于向所述客户端发送上传响应消息, 所述上传 响应消息包括所述请求头域, 以便于所述客户端继续上传所述文件; 第四处理子单元, 用于接收并存储所述客户端根据所述上传响应消 息发送的所述文件, 而后从所述请求头域中获取所述上传后回调地址, 并调用所述上传后回调地址向所述应用服务端发送第二通知消息, 所述 第二通知消息包括所述文件的第二文件信息。
结合第四方面或第四方面的第一种可能实现的方式至第六种可能实 现的方式, 在第七种可能实现的方式中, 还包括:
响应单元, 用于在接收完所述文件后, 向所述客户端发送完成响应 消息。
第五方面, 提供一种应用服务端, 包括: 第二发送单元, 用于向上传服务端发送注册消息, 所述注册消息包 括文件上传时的回调地址;
第二接收单元, 用于在注册完成后, 接收所述上传服务端根据所述 回调地址发送的所述文件上传的通知消息, 以获取所述文件的文件信息。 结合第五方面, 在第一种可能实现的方式中, 所述回调地址包括上 传前回调地址和上传后回调地址。
结合第五方面的第一种可能实现的方式, 在第二种可能实现的方式 中, 所述第二接收单元用于: 接收所述上传服务端根据所述上传前回调地址发送的第一通知消 息, 所述第一通知消息包括所述文件的第一文件信息;
当所述上传服务端接收完所述文件时, 接收所述上传服务端根据所 述上传后回调地址发送的第二通知消息, 所述第二通知消息包括所述文 件的第二文件信息。
第六方面, 提供一种客户端, 包括: 第三发送单元, 用于向上传服务端发送请求消息, 所述请求消息包 括请求头域;
第三接收单元, 用于接收所述上传服务端发送的上传响应消息, 所 述上传响应消息包括所述请求头域; 文件上传单元, 用于根据所述上传响应消息, 向所述上传服务端上 传文件。
结合第六方面, 在第一种可能实现的方式中, 所述请求头域包括应 用标识, 或者所述请求头域包括回调地址和所述应用标识。 结合第六方面的第一种可能实现的方式, 在第二种可能实现的方式 中, 还包括:
接收所述上传服务端发送的完成响应消息。 第七方面, 提供一种上传服务端, 包括:
第一接收器, 用于接收客户端发送的请求消息, 所述请求消息包括 请求头域; 第一处理器, 用于根据所述请求消息中的请求头域判断是否满足文 件的接收条件;
所述第一接收器还用于若满足所述文件的接收条件, 则接收所述文 件, 第一发射器并根据回调地址向应用服务端发送通知消息。
结合第七方面, 在第一种可能实现的方式中, 所述回调地址包括上 传前回调地址和上传后回调地址。 结合第七方面的第一种可能实现的方式, 在第二种可能实现的方式 中, 所述请求头域还包括应用标识, 所述应用标识是用来标识所述应用 服务端的。 结合第七方面的第二种可能实现的方式, 在第三种可能实现的方式 中, 所述回调地址是在所述客户端发送的请求消息的请求头域中携带的, 或所述回调地址是从所述应用服务端获取的。 结合第七方面的第三种可能实现的方式, 在第四种可能实现的方式 中, 当所述回调地址是从所述应用服务端获取的时, 还包括: 所述第一接收器还用于接收所述应用服务端发送的注册消息, 所述 注册消息包括所述回调地址;
第一存储器用于将所述回调地址保存在数据库中。
结合第七方面的第四种可能实现的方式, 在第五种可能实现的方式 中, 当所述回调地址是从所述应用服务端获取的时, 所述第一接收器、 所述第一处理器、 所述第一存储器以及所述第一发射器还用于:
若满足所述文件的接收条件, 则所述第一处理器根据应用标识从所 述数据库中获取所述上传前回调地址, 所述第一发射器调用所述上传前 回调地址向所述应用服务端发送第一通知消息, 所述第一通知消息包括 所述文件的第一文件信息; 所述第一发射器还用于向所述客户端发送上传响应消息, 所述上传 响应消息包括所述请求头域, 以便于所述客户端继续上传所述文件; 所述第一接收器还用于接收所述客户端根据所述上传响应消息发送 的所述文件, 所述第一存储器还用于并存储所述文件, 所述第一处理器 根据所述应用标识从所述数据库中获取所述上传后回调地址, 所述第一 发射器调用所述上传后回调地址向所述应用服务端发送第二通知消息, 所述第二通知消息包括所述文件的第二文件信息。 结合第七方面的第三种可能实现的方式, 在第六种可能实现的方式 中, 当所述回调地址是在所述客户端发送的请求消息的请求头域中携带 的时, 所述第一接收器、 所述第一处理器、 所述第一存储器以及第一发 射器用于:
若满足所述文件接收条件, 则所述第一处理器从所述请求头域中获 取所述上传前回调地址, 所述第一发射器调用所述上传前回调地址向所 述应用服务端发送第一通知消息, 所述第一通知消息包括所述文件的第 一文件信息; 所述第一发射器向所述客户端发送上传响应消息, 所述上传响应消 息包括所述请求头域, 以便于所述客户端继续上传所述文件; 所述第一接收器还用于接收所述客户端根据所述上传响应消息发送 的所述文件, 所述第一存储器还用于并存储所述文件, 所述第一处理器 从所述请求头域中获取所述上传后回调地址, 所述第一发射器调用所述 上传后回调地址向所述应用服务端发送第二通知消息, 所述第二通知消 息包括所述文件的第二文件信息。
结合第七方面或第七方面的第一种可能实现的方式至第六种可能实 现的方式, 在第七种可能实现的方式中, 还包括: 在接收完所述文件后, 所述第一发射器还用于向所述客户端发送完 成响应消息。 第八方面, 提供一种应用服务端, 包括:
第二发射器, 用于向上传服务端发送注册消息, 所述注册消息包括 文件上传时的回调地址;
第二接收器, 用于在注册完成后, 接收所述上传服务端根据所述回 调地址发送的所述文件上传的通知消息, 以获取所述文件的文件信息。 结合第八方面, 在第一种可能实现的方式中, 所述回调地址包括上 传前回调地址和上传后回调地址。
结合第八方面的第一种可能实现的方式, 在第二种可能实现的方式 中, 所述第二接收器用于: 接收所述上传服务端根据所述上传前回调地址发送的第一通知消 息, 所述第一通知消息包括所述文件的第一文件信息;
当所述上传服务端接收完所述文件时, 接收所述上传服务端根据所 述上传后回调地址发送的第二通知消息, 所述第二通知消息包括所述文 件的第二文件信息。 第九方面, 提供一种客户端, 包括: 第三发射器, 用于向上传服务端发送请求消息, 所述请求消息包括 请求头域; 第三接收器, 用于接收所述上传服务端发送的上传响应消息, 所述 上传响应消息包括所述请求头域; 第三处理器, 用于根据所述上传响应消息, 向所述上传服务端上传 文件。
结合第九方面, 在第一种可能实现的方式中, 所述请求头域包括应 用标识, 或者所述请求头域包括回调地址和所述应用标识。 结合第九方面的第一种可能实现的方式, 在第二种可能实现的方式 中, 在所述上传服务端通过所述回调地址向应用服务端回调成功之后, 所述第三接收器还用于接收所述上传服务端发送的完成响应消息。 第十方面, 提供一种通信系统, 包括:
所述第七方面提供的所述上传服务端, 所述第八方面提供的所述应 用服务端和所述第九方面提供的所述客户端。 本发明实施例提供一种文件上传方法、 客户端和服务端, 上传服务 端接收客户端发送的请求消息, 请求消息包括请求头域, 根据请求消息 中的请求头域判断是否满足文件的接收条件, 若满足文件的接收条件, 则接收文件, 并根据回调地址向应用服务端发送通知消息, 其中, 回调 地址是在客户端发送的请求消息的请求头域中携带的, 或回调地址是从 应用服务端获取的, 能够简化文件上传方式, 增强上传前后处理能力, 且应用服务端无需购买和维护存储设备。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案, 下 面将对实施例或现有技术描述中所需要使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是本发明的一些实施例, 对于 本领域普通技术人员来讲, 在不付出创造性劳动的前提下, 还可以 根据这些附图获得其他的附图。 图 1为本发明实施例提供的一种文件上传方法流程示意图; 图 2为本发明又一实施例提供的一种文件上传方法流程示意图; 图 3为本发明又一实施例提供的一种文件上传方法流程示意图; 图 4为本发明又一实施例提供的一种文件上传方法流程示意图; 图 5为本发明又一实施例提供的一种文件上传方法流程示意图; 图 6为本发明又一实施例提供的一种上传服务端结构示意图; 图 7为本发明又一实施例提供的另一种上传服务端结构示意图; 图 8为本发明又一实施例提供的又一种上传服务端结构示意图; 图 9为本发明又一实施例提供的又一种上传服务端结构示意图; 图 10为本发明又一实施例提供的又一种上传服务端结构示意图; 图 11为本发明又一实施例提供的一种应用服务端结构示意图; 图 12为本发明又一实施例提供的一种客户端结构示意图; 图 13为本发明又一实施例提供的一种上传服务端结构示意图; 图 14为本发明又一实施例提供的一种应用服务端结构示意图; 图 15为本发明又一实施例提供的一种客户端结构示意图;
图 16为本发明又一实施例提供的一种通信系统结构示意图。
具体实施方式
下面将结合本发明实施例中的附图, 对本发明实施例中的技术 方案进行清楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明 一部分实施例, 而不是全部的实施例。 基于本发明中的实施例, 本 领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他 实施例, 都属于本发明保护的范围。
本发明实施例中的系统架构, 可以包括客户端、 CDN ( Content Delivery Network, 内容分发网络) 节点和 App站点 (Application, 应用 服务端 ) , 该客户端、 CDN节点和 App站点均使用 HTTP ( Hyper Text Transport Protocol , 超文本传输协议 )通信协议进行通信。 客户端和 CDN 节点需要支持 100-continue处理。
本发明实施例提供一种文件上传方法, 如图 1所示, 包括:
101、 上传服务端接收客户端发送的请求消息, 请求消息包括请求头 域。
其中, 上传服务端可以为基于云存储的 CDN ( Content Delivery Network, 内容分发网络)节点, 该 CDN节点有云存储和传统 CDN的优 点,提供了海量存储能力,用户可以从最近的 CDN节点上传和下载文件。
102、上传服务端根据请求消息中的请求头域判断是否满足文件的接 收条件。
其中 , 该客户 端发送的请求消息中 的请求头域可以 包含 Expect: 100-continue , 用来询问 CDN是否愿意接收文件。
103、 若满足文件的接收条件, 则上传服务端接收文件, 并根据回调 地址向应用服务端发送通知消息。 其中, App ( Application, 应用服务端) 站点可以为使用了 CDN节 点上传、 下载服务的网站。 该回调地址可以包括上传前回调地址和上传 后回调地址。 示例性的, 回调地址是在客户端发送的请求消 , 的请求头域中携带 的, 或回调地址是从应用服务端获取的。
具体的, 当回调地址是从应用服务端获取的时, 接收应用服务端发 送的注册消息, 注册消息包括回调地址, 将回调地址保存在数据库中。 若满足文件的接收条件, 则 CDN节点根据应用标识从数据库中获取上传 前回调地址, 并调用上传前回调地址向应用服务端发送第一通知消息, 第一通知消息包括文件的第一文件信息, 而后向客户端发送上传响应消 息, 上传响应消息包括请求头域, 以便于客户端继续上传文件, 进而接 收并存储客户端根据上传响应消息发送的文件, 而后根据应用标识从数 据库中获取上传后回调地址, 并调用上传后回调地址向应用服务端发送 第二通知消息, 第二通知消息包括文件的第二文件信息。
当回调地址是在客户端发送的请求消息的请求头域中携带的时, 若 满足文件的接收条件, 则 CDN节点从请求头域中获取上传前回调地址, 并调用上传前回调地址向应用服务端发送第一通知消息, 第一通知消息 包括文件的第一文件信息, 而后向客户端发送上传响应消息, 上传响应 消息包括请求头域, 以便于客户端继续上传文件, 进而接收并存储客户 端根据上传响应消息发送的文件, 而后从请求头域中获取上传后回调地 址, 并调用上传后回调地址向应用服务端发送第二通知消息, 第二通知 消息包括文件的第二文件信息。 本发明实施例提供一种文件上传方法, 上传服务端接收客户端发送 的请求消息, 请求消息包括请求头域, 根据请求消息中的请求头域判断 是否满足文件的接收条件, 若满足文件的接收条件, 则接收文件, 并根 据回调地址向应用服务端发送通知消息, 能够简化文件上传方式, 增强 上传前后处理能力, 且应用服务端无需购买和维护存储设备。 本发明又一实施例提供一种文件上传方法, 如图 2所示, 包括:
201、 上传服务端接收客户端发送的请求消息, 请求消息包括请求头 域。 其中, 客户端可以为用户使用的手机、 电脑等设备, 上传服务端可 以为 CDN节点, 提供了上传、 下载服务。 客户端、 App站点和 CDN节 点均使用 HTTP ( Hyper Text Transport 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站点。 因此, 该请求程序代码可以如下:
POST /app 1 /path/filename . ext HTTP/1.1
Host:upload. cdn.com
Expect: 100-continue
appid: app 1
callback— url— pre :http:〃 app 1—domain— name/callback— url_pre
callback— url— post:http:〃 app 1— domain— name/callback— url— post
202、上传服务端根据请求消息中的请求头域判断是否满足文件的接 收条件。
具体的, CDN节点在接收到客户端的请求消息后阻塞, 可以根据该 请求消息中的请求头域判断该 HTTP 请求头域是否包含第一状态码 Expect: 100-continue头, 若包含 Expect: 100-continue头, 则继续与客户端 进行通信, CDN 节点愿意接收客户端的文件上传; 若不包含 Expect: 100-continue头, 则 CDN节点断开与客户端的连接。
203、 若满足文件的接收条件, 则上传服务端从请求头域中获取上传 前回调地址, 并调用上传前回调地址向应用服务端发送第一通知消息, 第一通知消息包括文件的第一文件信息。 具体的, 若客户端发送的请求消息中包含 Expect: 100-continue 头, 即满足文件的接收条件。 CDN便从客户端发送的请求消息的请求头域中 获取上传前回调地址 callback— url— pre , 并调用该上传前回调地址向 App 站点应用服务端发送第一通知消息, 以通知该 App站点上传的文件的第 一文件信息。 该第一文件信息可以包括文件的大小和文件的名称等信息。 该步骤过程的回调请求的程序代码可以为:
POST /callback— url— pre HTTP/ 1.1
Host: appl— domain— name
File— upload— info
HTTP/1.1 200 OK
Connection: close
{ " filename " ·. " filename. ext" , " success" ·. " true " }
204、 上传服务端向客户端发送上传响应消息, 上传响应消息包括请 求头域, 以便于客户端继续上传文件。 具体的, 当 CDN节点调用上传前回调地址向 App站点回调成功后, 可以向客户端返回响应消息, 同意接收客户端发送的文件内容。 其中, 该响应消息可以包括 100-continue头, 以使得客户端继续向 CDN节点上 传文件。 客户端在从 CDN节点接收到携带 100-continue的响应头后, 继 续向 CDN节点上传文件内容。 当客户端没有接收到 CDN节点返回的应 答头时, 客户端上传文件失败。 该步骤中响应过程的程序代码可以如下:
HTTP/ 1.1 100 Continue
205、 上传服务端接收并存储客户端根据上传响应消息发送的文件, 而后从请求头域中获取上传后回调地址, 并调用上传后回调地址向应用 服务端发送第二通知消息, 第二通知消息包括文件的第二文件信息。
具体的, CDN节点向客户端发送上传响应消息之后, 继续接收客户 端上传的文件, 当客户端继续向 CDN节点上传文件内容直至文件上传完 时, CDN节点在接收完文件内容后, 从客户端发送的请求头域中获取上 传后回调地址 callback— url_post, 并调用该上传后回调地址向 App站点发 送第二通知消息, 该第二通知消息包括客户端上传的文件的第二文件信 息。 该第二文件信息可以包括客户端上传文件的文件内容。 其中, 该第 二通知消息还可以包括下载 URL ( Universal Resource Locator , 统一资源 定位符) 字段, 以便于用户可以使用该 URL地址从 CDN节点中下载该 文件。 该步骤中的程序代码可以为:
POST /callback— url— post HTTP/1.1
Host: app 1—domain— name file— upload— info
HTTP/1.1 200 OK
Connectionxlose
{ " filename " :" filename. ext" , " success " :" true " , " url" :" http:// download. cdn. com/path /to/ filename . ext " }
206、 上传服务端在接收完文件后, 向客户端发送完成响应消息。 具体的, CDN节点在成功接收完客户端上传的文件内容后, 将文件 内容进行存储, 并向客户端返回响应消息, 客户端获取文件成功上传消 息。 这样, App站点在获取了文件信息后, 假设用户在 App应用站点下 载该文件时, App 站点可以通过上传后第二通知消息中该文件相应的 URL引导用户在 CDN节点中下载该文件内容。 CDN节点作为上传服务 端, 提供了文件上传、 下载服务, App站点作为应用服务端, 使用 CDN 节点进行上传、 下载服务。 这样, 在上传文件时, 通过回调地址, 文件 只需要进行一次上传至 CDN, 从而简化了上传方式, 增强了上传前后处 理能力, 应用服务端并无需购买和维护存储设施。 本发明实施例提供一种文件上传方法,接收客户端发送的请求消息, 请求消息包括请求头域, 请求头域包括回调地址, 根据请求消息中的请 求头域判断是否满足文件的接收条件, 若满足文件的接收条件, 则上传 服务端从请求头域中获取上传前回调地址, 并调用上传前回调地址向应 用服务端发送第一通知消息, 第一通知消息包括文件的第一文件信息, 向客户端发送上传响应消息, 上传响应消息包括请求头域, 以便于客户 端继续上传文件, 接收并存储客户端根据上传响应消息发送的文件, 而 后从请求头域中获取上传后回调地址, 并调用上传后回调地址向应用服 务端发送第二通知消息, 第二通知消息包括文件的第二文件信息, 在接 收完文件后, 向客户端发送完成响应消息, 能够简化文件上传方式, 增 强上传前后处理能力, 且应用服务端无需购买和维护存储设备。 本发明又一实施例提供一种文件上传方法, 如图 3所示, 包括:
301、 上传服务端接收应用服务端发送的注册消息, 注册消息包括回 调地址。 其中, 上传服务端可以为 CDN节点, 提供了上传、 下载服务。 App 站点可以为使用了 CDN节点上传、 下载服务的网站。
具体的, CDN节点可以向 App站点提供回调注册接口, App站点调 用该回调注册接口向 CDN节点发送注册消息, 该注册消息可以包括回调 地址, 包括上传前回调地址 callback— url— pre 和上传后回调地址 callback— url— post。 该回调地址可以通过 Ap 站点可以向 CDN节点注册 回调地址以获取文件上传通知。 该 App注册过程程序代码可以为:
POST /upload/regester HTTP/1.1
Host: upload.cdn.com appid=app 1 & callback— url— pre=http % 3A % 2F % 2Fappl— domain— nam e % 2Fcallback_url_pre & callback— url— post=http % 3A% 2F
% 2Fappl_ domain— name % 2Fcallback_url_post
HTTP/1.1 200 OK
Connection: close
{ " app id" : " app 1 " , " success" : " true " }
302、 上传服务端将回调地址保存在数据库中。 具体的,当 App站点向 CDN节点注册成功之后, CDN节点便向 App 站点返回注册响应消息 , 通知 App站点注册成功。 CDN节点便将 App站 点注册的回调地址保存在数据库中。
303、 上传服务端接收客户端发送的请求消息, 请求消息包括请求头 域。
具体的, 客户端、 App站点和 CDN节点均使用 HTTP ( Hyper Text Transport Protocol , 超文本传输协议) 协议通信。 当客户端向 CDN节点 请求上传文件时,向 CDN节点发送请求消息,该请求消息包括请求头域, 该请求头域包括第一状态码 Expect: 100-continue , 即客户端和 CDN节 点需要支持对 HTTP1.1协议中 100-continue状态码的处理。 该请求头域 还包括 Appid, Appid应用标识为用来标示 App应用服务端, CDN节点 可以根据该 Appid来区分 App站点。 该请求消息的程序代码可以如下:
POST /app 1 /path/filename . ext HTTP/1.1
Host:upload. cdn.com
Expect: 100-continue
appid: app 1
304、上传服务端根据请求消息中的请求头域判断是否满足文件的接 收条件。
具体的, CDN节点在接收到客户端的请求消息后阻塞, 可以根据该 请求消息中的请求头域判断该 HTTP 请求头域是否包含第一状态码 Expect: 100 -continue头, 若包含 Expect: 100-continue头, 则继续与客户端 进行通信, CDN 节点愿意接收客户端的文件上传; 若不包含 Expect: 100-continue头, 则 CDN节点断开与客户端的连接。
305、 若满足文件的接收条件, 则上传服务端根据应用标识从数据库 中获取上传前回调地址, 并调用上传前回调地址向应用服务端发送第一 通知消息, 第一通知消息包括文件的第一文件信息。
具体的, 当客户端上传文件时的请求消息满足文件的接收条件时, 则 CDN 节点便根据 Appid 应用标识从数据库中调用上传前回调地址 callback— url— pre , 并调用该上传前回调地址向 Ap 站点发送第一通知消 息, 以通知 App站点客户端上传的文件的第一文件信息。 该第一文件信 息可以包括文件的大小和文件的名称等信息。 该步骤过程的回调请求的程序代码可以为:
POST /callback— url— pre HTTP/ 1.1
Host: appl— domain— name File— upload— info
HTTP/1.1 200 OK
Connection: close
{ " filename " '. " filename. ext" , " success" '. " true " }
306、 上传服务端向客户端发送上传响应消息, 上传响应消息包括请 求头域, 以便于客户端继续上传文件。 具体的, 当 CDN节点调用上传前回调地址向 App站点回调成功后, 可以向客户端返回响应消息, 同意接收客户端发送的文件内容。 其中, 该响应消息可以包括 100-continue头, 以使得客户端继续向 CDN节点上 传文件。
该步骤中响应过程的程序代码可以如下:
HTTP/ 1.1 100 Continue 客户端在从 CDN节点接收到携带 100-continue的响应头后, 继续向 CDN节点上传文件内容。 当客户端没有接收到 CDN节点返回的应答头 时, 客户端上传文件失败。
307、 上传服务端接收并存储客户端根据上传响应消息发送的文件, 而后根据应用标识从数据库中获取上传后回调地址, 并调用上传后回调 地址向应用服务端发送第二通知消息, 第二通知消息包括文件的第二文 件信息。
具体的, 当客户端继续向 CDN 节点上传文件内容直至文件上传完 时, CDN节点在接收完文件内容后, CDN节点根据该 Appid应用标识在 数据库中查询获取 Ap 站点注册的上传后回调地址 callback— url— post , 向 App 站点通知上传的第二文件信息。 该第二文件信息可以包括客户端上 传文件的文件内容。 其中, 该第二通知消息还可以包括下载 URL字段, 以便于用户可以使用该 URL地址从 CDN节点中下载该文件。 该步骤中的程序代码可以为:
POST /callback— url— post HTTP/1.1
Host: app 1—domain— name file— upload— info
HTTP/1.1 200 OK
Connectionxlose
{ " filename " :" filename. ext" , " success " :" true " , " url" :" http:// download. cdn. com/path /to/ filename . ext " }
308、 上传服务端在接收完文件后, 向客户端发送完成响应消息。 具体的, CDN节点在成功接收完客户端上传的文件内容后, 将文件 内容进行存储, 并向客户端返回响应消息, 客户端获取文件成功上传消 息。 这样, App站点在获取了文件信息后, 假设用户在 App应用站点下 载该文件时, App 站点可以通过上传后第二通知消息中该文件相应的 URL使引导用户在 CDN节点中下载该文件内容。 CDN节点作为上传服 务端,提供了文件上传、 下载服务, App站点作为应用服务端, 使用 CDN 节点进行上传、 下载服务。 此外, CDN节点釆用了 CDN和云存储结合 的架构, 这样, 在上传文件时, 客户端上传的文件只需要进行一次上传 至 CDN, 从而简化了上传方式, 增强了上传前后处理能力, App站点并 无需购买和维护存储设施。
本发明实施例提供一种文件上传方法, 接收应用服务端发送的注册 消息, 注册消息包括回调地址, 将回调地址保存在数据库中, 接收客户 端发送的请求消息, 请求消息包括请求头域, 根据请求消息中的请求头 域判断是否满足文件的接收条件, 若满足文件的接收条件, 则上传服务 端根据应用标识从数据库中获取上传前回调地址, 并调用上传前回调地 址向应用服务端发送第一通知消息, 第一通知消息包括文件的第一文件 信息, 而后向客户端发送上传响应消息, 上传响应消息包括请求头域, 以便于客户端继续上传文件, 进而接收并存储客户端根据上传响应消息 发送的文件, 而后根据应用标识从数据库中获取上传后回调地址, 并调 用上传后回调地址向应用服务端发送第二通知消息, 第二通知消息包括 文件的第二文件信息, 在接收完文件后, 向客户端发送完成响应消息, 能够简化文件上传方式, 增强上传前后处理能力, 且应用服务端无需购 买和维护存储设备。 本发明又一实施例提供一种文件上传方法, 如图 4所示, 包括: 401、 应用服务端向上传服务端发送注册消息, 注册消息包括文件上 传时的回调地址。 其中, 应用月良务端为 App站点, 例如可以为互联网应用站点、 网站 等。 CDN节点提供了回调注册接口, App站点可以调用该回调注册接口 向 CDN节点发送注册消息, 该注册消息包括回调地址, 包括上传前回调 地址和上传后回调地址。该回调地址可以通过 Ap 站点可以向 CDN节点 注册回调地址以获取文件上传通知。
App注册过程程序代码可以为:
POST /upload/regester HTTP/1.1
Host: upload.cdn.com appid=app 1 & callback— url—pre=http % 3A % 2F % 2Fappl— domain— nam e % 2Fc
allback url pre & callback— url—post=http % 3A % 2F % 2Fappl_ domain— name % 2Fcallback_url_post
HTTP/1.1 200 OK
Figure imgf000021_0001
402、 在应用服务端注册完成后, 接收上传服务端根据回调地址发送 的文件上传的通知消息, 以获取文件的文件信息。 具体的,当 App站点向 CDN节点注册成功之后, CDN节点便向 App 站点返回注册响应消息 , 通知 App站点注册成功。 CDN节点便将 App站 点注册的回调地址保存在数据库中。
CDN 节点接收客户端发送的请求消息, 请求消息包括请求头域, CDN节点根据请求消息中的请求头域判断是否满足文件的接收条件, 若 满足文件的接收条件, App站点接收 CDN节点根据上传前回调地址发送 的第一通知消息, 第一通知消息包括文件的第一文件信息该第一文件信 息可以包括文件的大小和文件的名称等信息。
其中, CDN节点获取的上传前回调地址可以从客户端发送的请求头 域中获取, 即请求消息的请求头域中携带回调地址, 或通过 Appid从数 据库中获取。
而后, CDN节点向客户端发送上传响应消息, 上传响应消息包括请 求头域, 以便于客户端继续上传文件。 当 CDN节点接收完文件时, CDN节点从客户端发送的请求头域中 获取上传后回调地址, 或通过 Appid从数据库中获取上传后回调地址, 并通过该上传后回调地址向 App站点发送第二通知消息, 即 App站点接 收上传服务端根据上传后回调地址发送的第二通知消息, 第二通知消息 包括文件的第二文件信息, 该第二文件信息可以包括客户端上传文件的 文件内容。 。
本发明实施例提供一种文件上传方法, 应用服务端向上传服务端发 送注册消息, 注册消息包括文件上传时的回调地址, 在应用服务端注册 完成后, 接收上传服务端根据回调地址发送的文件上传的通知消息, 以 获取文件的文件信息, 能够简化文件上传方式, 增强上传前后处理能力, 且应用服务端无需购买和维护存储设备。 本发明又一实施例提供一种文件上传方法, 如图 5所示, 包括:
501、 客户端向上传服务端发送请求消息, 请求消息包括请求头域。 其中, 客户端是指与服务器对应, 为客户提供本地服务的程序, 例 如浏览器、 各种手机应用。 除了一些只在本地运行的应用程序之外, 一 般安装在普通的客户机上, 需要与服务端互相配合运行。 例如可以运行 在用户的电脑、 手机等设备中。
该请求头域可以包括第一状态码 Expect: 100-continue , 客户端和 CDN节点需要支持对 HTTP1.1协议中 100-continue状态码的处理。 还包 括 Appid,该 Appid为用来标示 App应用服务端的, CDN可以根据该 Appid 来区分 Ap 站点。
502、 客户端接收上传服务端发送的上传响应消息。 具体的, 当客户端向 CDN节点发送请求消息后, CDN节点根据请 求消息的请求头域是否包含第一状态码 Expect: 100-continue , 判断是否 满足文件的接收条件, 若满足文件接收条件, CDN节点通过上传前回调 地址向客户端发送第一通知消息, 第一通知消息包括文件的第一文件信 息, 而后向客户端发送上传响应消息。 其中, 该上传响应消息包括客户端发送的请求消息中的请求头域, 以便于客户端可以继续上传文件。 回调地址可以是在客户端发送的请求 消息的请求头域中携带的, 或回调地址是从应用服务端获取的, 包括上 传前回调地址和上传后回调地址。 当回调地址是从应用 Λ良务端获取的时, 通过接收应用服务端发送的注册消息, 注册消息包括回调地址, 并将回 调地址保存在数据库中。
503、 客户端根据上传响应消息, 向上传服务端上传文件。
具体的,客户端在从 CDN节点接收到携带 100-continue的响应头后, 继续向 CDN节点上传文件内容。 当客户端没有接收到 CDN节点返回的 应答头时, 客户端上传文件失败。
而后, CDN节点从请求头域中获取上传后回调地址, 或从数据库中 获取上传后回调地址, 并调用上传后回调地址向应用服务端发送第二通 知消息, 第二通知消息包括文件的第二文件信息。 本发明实施例提供一种文件上传方法, 客户端向上传服务端发送请 求消息, 在接收上传服务端发送的上传响应消息后, 根据该上传响应消 息向上传服务端上传文件, 能够简化文件上传方式。
本发明又一实施例提供一种上传服务端 01 , 如图 6所示, 包括: 接收单元 016 , 用于接收客户端发送的请求消息, 请求消息包括请 求头域。
判断单元 011 , 用于根据请求消息中的请求头域判断是否满足文件 接收条件。
处理单元 012 , 用于若满足文件接收条件, 则接收文件, 并根据回 调地址向应用服务端发送通知消息。
其中, 回调地址包括上传前回调地址和上传后回调地址。 可选的, 请求头域还包括应用标识, 应用标识是用来标识应用服务 端的。 可选的,回调地址是在客户端发送的请求消息的请求头域中携带的, 或回调地址是从应用服务端获取的。 可选的, 如图 7所示, 当回调地址是从应用服务端获取的时, 还包 括:
第一接收单元 014 , 用于在接收客户端发送的请求消息之前, 接收 应用服务端发送的注册消息, 注册消息包括回调地址。
存储单元 015 , 用于将回调地址保存在数据库中。
可选的, 如图 8所示, 当回调地址是从应用服务端获取的时, 处理 单元 012可以包括:
第一处理子单元 0121 , 用于若满足文件接收条件, 则根据应用标识 从数据库中获取上传前回调地址, 并调用上传前回调地址向应用服务端 发送第一通知消息, 第一通知消息包括文件的第一文件信息。 第一发送子单元 0122 , 用于向客户端发送上传响应消息, 上传响应 消息包括请求头域, 以便于客户端继续上传文件。
第二处理子单元 0123 , 用于接收并存储客户端根据上传响应消息发 送的文件, 而后根据应用标识从数据库中获取上传后回调地址, 并调用 上传后回调地址向应用服务端发送第二通知消息, 第二通知消息包括文 件的第二文件信息。
可选的, 如图 9所示, 当回调地址是在客户端发送的请求消息的请 求头域中携带的时, 处理单元 012可以包括: 第三处理子单元 0124 , 用于若满足文件的接收条件, 则从请求头域 中获取上传前回调地址, 并调用上传前回调地址向应用服务端发送第一 通知消息, 第一通知消息包括文件的第一文件信息。
第二发送子单元 0125 , 用于向客户端发送上传响应消息, 上传响应 消息包括请求头域, 以便于客户端继续上传文件。
第四处理子单元 0126 , 用于接收并存储客户端根据上传响应消息发 送的文件, 而后从请求头域中获取上传后回调地址, 并调用上传后回调 地址向应用服务端发送第二通知消息, 第二通知消息包括文件的第二文 件信息。 可选的, 如图 10所示, 还可以包括: 响应单元 013 , 用于在接收完文件后, 向客户端发送完成响应消息。 其中, 接收单元 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。 本发明实施例提供一种上传服务端, 上传服务端接收客户端发送的 请求消息, 请求消息包括请求头域, 根据请求消息中的请求头域判断是 否满足文件的接收条件, 若满足文件的接收条件, 则接收文件, 并根据 回调地址向应用服务端发送通知消息, 能够简化文件上传方式, 增强上 传前后处理能力, 且应用服务端无需购买和维护存储设备。 本发明又一实施例提供一种应用服务端 02 , 如图 11所示, 包括: 第二发送单元 021 , 用于向上传服务端发送注册消息, 注册消息包 括文件上传时的回调地址。 第二接收单元 022 , 用于在注册完成后, 接收上传服务端根据回调 地址发送的文件上传的通知消息, 以获取文件的文件信息。
其中, 回调地址包括上传前回调地址和上传后回调地址。 可选的, 第二接收单元 022可以用于: 接收上传服务端根据上传前回调地址发送的第一通知消息, 第一通 知消息包括文件的第一文件信息; 当上传服务端接收完文件时, 接收上传服务端根据上传后回调地址 发送的第二通知消息, 第二通知消息包括文件的第二文件信息。
其中, 第二发送单元 021用于执行图 4所示的实施例中的步骤 401 , 第二接收单元 022用于执行图 4所示的实施例中的步骤 402。 本发明实施例提供一种应用服务端, 应用服务端向上传服务端发送 注册消息, 注册消息包括文件上传时的回调地址, 在应用服务端注册完 成后, 接收上传服务端根据回调地址发送的文件上传的通知消息, 以获 取文件的文件信息, 能够简化文件上传方式, 增强上传前后处理能力, 且应用服务端无需购买和维护存储设备。 本发明又一实施例提供一种客户端 03 , 如图 12所示, 包括: 第三发送单元 031 , 用于向上传服务端发送请求消息, 请求消息包 括请求头域。
第三接收单元 032 , 用于接收上传服务端发送的上传响应消息, 上 传响应消息包括请求头域。 文件上传单元 033 , 用于根据上传响应消息, 向上传服务端上传文 件。
可选的, 请求头域包括应用标识, 或者请求头域包括回调地址和应 用标识。
可选的, 还可以包括:
在上传服务端通过回调地址向应用服务端回调成功之后, 接收上传 服务端发送的完成响应消息。
其中, 第三发送单元 031用于执行图 5所示的实施例中的步骤 501 ; 第三接收单元 032用于执行图 5所示实施例中的步骤 502;文件上传单元 033用于执行图 5所示实施例中的步骤 503。 本发明实施例提供一种客户端,客户端向上传服务端发送请求消息, 请求消息包括请求头域, 接收上传服务端发送的上传响应消息, 上传响 应消息包括请求头域, 根据上传响应消息, 向上传服务端上传文件, 能 够简化文件上传方式。 本发明又一实施例提供一种上传服务端 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 ; 在本发明实施例中, 可选的, 回调地址包括上传前回调地址和上传 后回调地址。 在本发明实施例中, 可选的, 请求头域包括应用标识, 应用标识是 用来标识应用服务端的。 在本发明实施例中, 可选的, 回调地址是在客户端发送的请求消息 的请求头域中携带的, 或回调地址是从应用服务端获取的。 在本发明实施例中个, 可选的, 当回调地址是从应用服务端获取的 时, 第一接收器 044用于执行该指令, 包括: 在接收客户端发送的请求消息之前, 第一接收器还用于接收应用服 务端发送的注册消息, 注册消息包括回调地址, 具体用于执行图 3 所示 实施例中的步骤 301 ; 第一存储器 043用于将回调地址保存在数据库中, 具体用于执行图 3所示实施例中的步骤 302。 在本发明实施例中, 可选的, 当回调地址是从应用服务端获取的时, 该第一接收器 044、第一处理器 042和第一发射器 045执行该指令还用于: 若满足文件接收条件, 则第一处理器 042并根据应用标识从数据库 中获取上传前回调地址, 第一发射器 045 调用上传前回调地址向应用服 务端发送第一通知消息, 第一通知消息包括文件的第一文件信息具体用 于执行图 3所示实施例中的步骤 305 ; 第一发射器 045还用于向客户端发送上传响应消息, 上传响应消息 包括请求头域, 以便于客户端继续上传文件, 具体用于执行图 3 所示实 施例中的步骤 306 ; 若第一接收器 044还用于接收并存储客户端根据上传响应消息发送 的文件, 第一存储器 043还用于并存储文件, 第一处理器 042根据应用 标识从数据库中获取上传后回调地址, 第一发射器 045 调用上传后回调 地址向应用服务端发送第二通知消息, 第二通知消息包括文件的第二文 件信息, 具体用于执行图 3所示实施例中的步骤 307。 在本发明实施例中, 可选的, 当回调地址是在客户端发送的请求消 息的请求头域中携带的时, 该第一接收器 044、 第一处理器 042、 第一存 储器 043和第一发射器 045执行该指令还用于: 若满足文件接收条件, 则第一处理器 042从请求头域中获取上传前 回调地址, 第一发射器 045 调用上传前回调地址向应用服务端发送第一 通知消息, 第一通知消息包括文件的第一文件信息, 具体用于执行图 2 所示实施例中的步骤 203 ; 第一发射器 045向客户端发送上传响应消息, 上传响应消息包括请 求头域, 以便于客户端继续上传文件, 具体用于执行图 2 所示实施例中 的步骤 204 ;
若第一接收器 044还用于接收并存储客户端根据上传响应消息发送 的文件, 第一存储器 043还用于并存储文件, 第一处理器 042从请求头 域中获取上传后回调地址, 第一发射器 045 调用上传后回调地址向应用 服务端发送第二通知消息, 第二通知消息包括文件的第二文件信息, 具 体用于执行图 2所示实施例中的步骤 205。 在本发明实施例中, 可选的, 在接收完文件后, 第一发射器 045执 行该指令还用于向客户端发送完成响应消息, 具体用于执行图 2 所示实 施例中的步骤 206 , 或图 3所示实施例中的步骤 308。 因此, 本发明实施例的上传服务端, 上传服务端接收客户端发送的 请求消息, 请求消息包括请求头域, 根据请求消息中的请求头域判断是 否满足文件的接收条件, 若满足文件的接收条件, 则接收文件, 并根据 回调地址向应用服务端发送通知消息, 能够简化文件上传方式, 增强上 传前后处理能力。 本发明又一实施例提供一种应用服务端 05 , 如图 14 所示, 该应用 服务端包括: 第二总线 041 ,以及连接到第二总线 041的第二处理器 042、 第二存储器 043、 第二接收器 044和第二发射器 045 , 其中, 该第二存储 器 043用于存储指令, 该第二发射器 045执行该指令用于向上传服务端 发送注册消息, 注册消息包括文件上传时的回调地址; 该第二接收器 044 执行该指令用于在注册完成后, 接收上传服务端根据回调地址发送的文 件上传的通知消息, 以获取文件的文件信息。 在本发明实施例中, 可选的, 回调地址包括上传前回调地址和上传 后回调地址。 在本发明实施例中, 可选的, 该第二接收器 044执行该指令用于: 接收上传服务端根据上传前回调地址发送的第一通知消息, 第一通 知消息包括文件的第一文件信息;
当上传服务端接收完文件时, 接收上传服务端根据上传后回调地址 发送的第二通知消息, 第二通知消息包括文件的第二文件信息。
其中, 该第二发射器 045用于执行图 4所示的实施例中的步骤 401 , 该第二接收器 044用于执行图 4所示的实施例中的步骤 402。 因此, 本发明实施例的应用服务端, 应用服务端向上传服务端发送 注册消息, 注册消息包括文件上传时的回调地址, 在应用服务端注册完 成后, 接收上传服务端根据回调地址发送的文件上传的通知消息, 以获 取文件的文件信息, 能够简化文件上传方式, 增强上传前后处理能力, 且应用服务端无需购买和维护存储设备。 本发明又一实施例提供一种客户端 06 , 如图 15所示, 该客户端 06 包括: 第三总线 041 , 以及连接到第三总线 041的第三处理器 042、 第三 存储器 043、第三接收器 044和第三发射器 045 ,其中,该第三存储器 043 用于存储指令; 该第三发射器 045 执行该指令用于向上传服务端发送请 求消息, 请求消息包括请求头域; 该第三接收器 044 执行该指令用于接 收上传服务端发送的上传响应消息, 上传响应消息包括请求头域; 该第 三处理器 042 执行该指令用于根据上传响应消息, 向上传服务端上传文 件。
在本发明实施例中, 可选的, 请求头域包括应用标识, 或者请求头 i或包括回调地址和应用标识。 在本发明实施例中, 可选的, 在上传服务端通过回调地址向应用服 务端回调成功之后, 第三接收器 044 用于执行该指令还用于接收上传服 务端发送的完成响应消息。 其中, 该第三发射器 045用于执行图 5所示的实施例中的步骤 501 ; 该第三接收器 044用于执行图 5所示实施例中的步骤 502;该第三处理器 042用于执行图 5所示实施例中的步骤 503。 因此, 本发明实施例的客户端, 客户端向上传服务端发送请求消息, 请求消息包括请求头域, 接收上传服务端发送的上传响应消息, 上传响 应消息包括请求头域, 根据上传响应消息, 向上传服务端上传文件, 能 够简化文件上传方式。 本发明又一实施例提供一种通信系统 1 , 如图 16所示, 包括: 前述 实施例提供的上传服务端 04、 应用服务端 05和客户端 06。 其中, 上传服务端 04用于执行图 1 所示实施例中的步骤 101〜步骤 103 , 或图 2所示实施例中的步骤 201〜步骤 206 , 或图 3所示实施例中的 步骤 301~308; 应用服务端 05用于执行图 4所示实施例中的步骤 401〜步 骤 402; 客户端 06用于执行图 5所示实施例中的步骤 501〜步骤 503。 本发明实施例提供一种通信系统, 上传服务端接收客户端发送的请 求消息, 请求消息包括请求头域, 根据请求消息中的请求头域判断是否 满足文件接收条件, 若满足文件的接收条件, 则接收文件, 并根据回调 地址向应用服务端发送通知消息, 回调地址包括上传前回调地址和上传 后回调地址, 若接收完文件, 则将文件存储在上传服务端中, 并向客户 端发送完成响应消息, 其中, 回调地址是在客户端发送的请求消息的请 求头域中携带的, 或回调地址是从应用服务端获取的, 能够简化文件上 传方式, 增强上传前后处理能力, 且应用服务端无需购买和维护存储设 备。
在本申请所提供的几个实施例中, 应该理解到, 所揭露的系统, 客 户端、 Λ良务端和方法, 可以通过其它的方式实现。 例如, 以上所描述的 设备实施例仅仅是示意性的, 例如, 所述单元的划分, 仅仅为一种逻辑 功能划分, 实际实现时可以有另外的划分方式, 例如多个单元或组件可 以结合或者可以集成到另一个系统, 或一些特征可以忽略, 或不执行。 另一点, 所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是 通过一些接口, 装置或单元的间接耦合或通信连接, 可以是电性, 机械 或其它的形式。 另外, 在本发明各个实施例中的设备和系统中, 各功能单元可以集 成在一个处理单元中, 也可以是各个单元单独物理包括, 也可以两个或 两个以上单元集成在一个单元中。 且上述的各单元既可以釆用硬件的形 式实现, 也可以釆用硬件加软件功能单元的形式实现。
实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬 件来完成, 前述的程序可以存储于一计算机可读取存储介质中, 该程序 在执行时, 执行包括上述方法实施例的步骤; 而前述的存储介质包括: U 盘、 移动硬盘、 只读存储器 (Read Only Memory, 简称 ROM ) 、 随机存 取存储器( Random Access Memory , 简称 RAM ) 、 磁碟或者光盘等各种 可以存储程序代码的介质。
以上所述, 仅为本发明的具体实施方式, 但本发明的保护范围并不 局限于此, 任何熟悉本技术领域的技术人员在本发明揭露的技术范围内, 可轻易想到变化或替换, 都应涵盖在本发明的保护范围之内。 因此, 本 发明的保护范围应所述以权利要求的保护范围为准。

Claims

权 利 要 求 书
1、 一种文件上传方法, 其特征在于, 包括:
接收客户端发送的请求消息, 所述请求消息包括请求头域; 根据所述请求消息中的请求头域判断是否满足文件的接收条件; 若满足所述文件的接收条件, 则接收所述文件, 并根据回调地址向 应用服务端发送通知消息。
2、 根据权利要求 1所述的方法, 其特征在于, 所述回调地址包括上 传前回调地址和上传后回调地址。
3、 根据权利要求 2所述的方法, 其特征在于, 所述请求头域还包括 应用标识, 所述应用标识是用来标识所述应用服务端的。
4、 根据权利要求 3所述的方法, 其特征在于, 所述回调地址是在所 述客户端发送的请求消息的请求头域中携带的, 或所述回调地址是从所 述应用服务端获取的。
5、 根据权利要求 4所述的方法, 其特征在于, 当所述回调地址是从 所述应用服务端获取的时, 所述方法还包括:
接收所述应用服务端发送的注册消息, 所述注册消息包括所述回调 地址;
将所述回调地址保存在数据库中。
6、 根据权利要求 5所述的方法, 其特征在于, 当所述回调地址是从 所述应用服务端获取的时, 所述若满足所述文件的接收条件, 则接收所 述文件, 并根据回调地址向应用服务端发送通知消息包括:
若满足所述文件的接收条件, 则根据应用标识从所述数据库中获取 所述上传前回调地址, 并调用所述上传前回调地址向所述应用服务端发 送第一通知消息, 所述第一通知消息包括所述文件的第一文件信息; 向所述客户端发送上传响应消息, 所述上传响应消息包括所述请求 头域, 以便于所述客户端继续上传所述文件;
接收并存储所述客户端根据所述上传响应消息发送的所述文件, 而 后根据所述应用标识从所述数据库中获取所述上传后回调地址, 并调用 所述上传后回调地址向所述应用服务端发送第二通知消息, 所述第二通 知消息包括所述文件的第二文件信息。
7、 根据权利要求 4所述的方法, 其特征在于, 当所述回调地址是在 所述客户端发送的请求消息的请求头域中携带的时, 所述若满足所述文 件的接收条件, 则接收所述文件, 并根据回调地址向应用服务端发送通 知消息包括:
若满足所述文件的接收条件, 则从所述请求头域中获取所述上传前 回调地址, 并调用所述上传前回调地址向所述应用服务端发送第一通知 消息, 所述第一通知消息包括所述文件的第一文件信息;
向所述客户端发送上传响应消息, 所述上传响应消息包括所述请求 头域, 以便于所述客户端继续上传所述文件;
接收并存储所述客户端根据所述上传响应消息发送的所述文件, 而 后从所述请求头域中获取所述上传后回调地址, 并调用所述上传后回调 地址向所述应用服务端发送第二通知消息, 所述第二通知消息包括所述 文件的第二文件信息。
8、 根据权利要求 1至 7任意一项所述的方法, 其特征在于, 所述方 法还包括:
在接收完所述文件后, 向所述客户端发送完成响应消息。
9、 一种文件上传方法, 其特征在于, 包括:
向上传服务端发送注册消息, 所述注册消息包括文件上传时的回调 地址;
在注册完成后, 接收所述上传服务端根据所述回调地址发送的文件 上传的通知消息, 以获取所述文件的文件信息。
10、 根据权利要求 9所述的方法, 其特征在于, 所述回调地址包括 上传前回调地址和上传后回调地址。
11、 根据权利要求 10所述的方法, 其特征在于, 所述接收所述上传 服务端根据所述回调地址发送的文件上传的通知消息, 以获取所述文件 的文件信息包括:
接收所述上传服务端根据所述上传前回调地址发送的第一通知消 息, 所述第一通知消息包括所述文件的第一文件信息;
当所述上传服务端接收完所述文件时, 接收所述上传服务端根据所 述上传后回调地址发送的第二通知消息, 所述第二通知消息包括所述文 件的第二文件信息。
12、 一种文件上传方法, 其特征在于, 包括:
向上传服务端发送请求消息, 所述请求消息包括请求头域; 接收所述上传服务端发送的上传响应消息, 所述上传响应消息包括 所述请求头域;
根据所述上传响应消息, 向所述上传服务端上传文件。
13、 根据权利要求 12所述的方法, 其特征在于, 所述请求头域包括 应用标识, 或者所述请求头域包括回调地址和所述应用标识。
14、 根据权利要求 13所述的方法, 其特征在于, 所述方法还包括: 在所述上传服务端通过所述回调地址向应用服务端回调成功之后, 接收所述上传服务端发送的完成响应消息。
15、 一种上传服务端, 其特征在于, 结合了云存储功能, 包括: 接收单元, 用于接收客户端发送的请求消息, 所述请求消息包括请 求头域;
判断单元, 用于根据所述请求消息中的请求头域判断是否满足文件 的接收条件;
处理单元, 用于若满足所述文件的接收条件, 则接收所述文件, 并 根据回调地址向应用服务端发送通知消息。
16、 根据权利要求 15所述的上传服务端, 其特征在于, 所述回调地 址包括上传前回调地址和上传后回调地址。
17、 根据权利要求 16所述的上传服务端, 其特征在于, 所述请求头 域还包括应用标识, 所述应用标识是用来标识所述应用服务端的。
18、 根据权利要求 17所述的上传服务端, 其特征在于, 所述回调地 址是在所述客户端发送的请求消息的请求头域中携带的, 或所述回调地 址是从所述应用服务端获取的。
19、 根据权利要求 18所述的上传服务端, 其特征在于, 当所述回调 地址是从所述应用服务端获取的时, 还包括:
第一接收单元, 用于接收所述应用服务端发送的注册消息, 所述注 册消息包括所述回调地址;
存储单元, 用于将所述回调地址保存在数据库中。
20、 根据权利要求 19所述的上传服务端, 其特征在于, 当所述回调 地址是从所述应用服务端获取的时, 所述处理单元包括:
第一处理子单元, 用于若满足所述文件接收条件, 则根据应用标识 从所述数据库中获取所述上传前回调地址, 并调用所述上传前回调地址 向所述应用服务端发送第一通知消息, 所述第一通知消息包括所述文件 的第一文件信息; 第一发送子单元, 用于向所述客户端发送上传响应消息, 所述上传 响应消息包括所述请求头域, 以便于所述客户端继续上传所述文件; 第二处理子单元, 用于接收并存储所述客户端根据所述上传响应消 息发送的所述文件, 而后根据所述应用标识从所述数据库中获取所述上 传后回调地址, 并调用所述上传后回调地址向所述应用服务端发送第二 通知消息, 所述第二通知消息包括所述文件的第二文件信息。
21、 根据权利要求 18所述的上传服务端, 其特征在于, 当所述回调 地址是在所述客户端发送的请求消息的请求头域中携带的时, 所述处理 单元包括:
第三处理子单元, 用于若满足所述文件的接收条件, 则从所述请求 头域中获取所述上传前回调地址, 并调用所述上传前回调地址向所述应 用服务端发送第一通知消息, 所述第一通知消息包括所述文件的第一文 件信息;
第二发送子单元, 用于向所述客户端发送上传响应消息, 所述上传 响应消息包括所述请求头域, 以便于所述客户端继续上传所述文件; 第四处理子单元, 用于接收并存储所述客户端根据所述上传响应消 息发送的所述文件, 而后从所述请求头域中获取所述上传后回调地址, 并调用所述上传后回调地址向所述应用服务端发送第二通知消息, 所述 第二通知消息包括所述文件的第二文件信息。
22、 根据权利要求 15至 21任意一项所述的上传服务端, 其特征在 于, 还包括:
响应单元, 用于在接收完所述文件后, 向所述客户端发送完成响应 消息。
23、 一种应用服务端, 其特征在于, 包括:
第二发送单元, 用于向上传服务端发送注册消息, 所述注册消息包 括文件上传时的回调地址;
第二接收单元, 用于在注册完成后, 接收所述上传服务端根据所述 回调地址发送的文件上传的通知消息, 以获取所述文件的文件信息。
24、 根据权利要求 23所述的应用服务端, 其特征在于, 所述回调地 址包括上传前回调地址和上传后回调地址。
25、 根据权利要求 24所述的应用服务端, 其特征在于, 所述第二接 收单元用于: 接收所述上传服务端根据所述上传前回调地址发送的第一通知消 息, 所述第一通知消息包括所述文件的第一文件信息;
当所述上传服务端接收完所述文件时, 接收所述上传服务端根据所 述上传后回调地址发送的第二通知消息, 所述第二通知消息包括所述文 件的第二文件信息。
26、 一种客户端, 特征在于, 包括:
第三发送单元, 用于向上传服务端发送请求消息, 所述请求消息包 括请求头域;
第三接收单元, 用于接收所述上传服务端发送的上传响应消息, 所 述上传响应消息包括所述请求头域;
文件上传单元, 用于根据所述上传响应消息, 向所述上传服务端上 传文件。
27、 根据权利要求 26所述的客户端, 其特征在于, 所述请求头域包 括应用标识, 或者所述请求头域包括回调地址和所述应用标识。
28、 根据权利要求 27所述的客户端, 其特征在于, 还包括: 在所述上传服务端通过所述回调地址向应用服务端回调成功之后, 接收所述上传服务端发送的完成响应消息。
29、 一种上传服务端, 其特征在于, 包括:
第一接收器, 用于接收客户端发送的请求消息, 所述请求消息包括 请求头域;
第一处理器, 用于根据所述请求消息中的请求头域判断是否满足文 件的接收条件;
所述第一接收器还用于若满足所述文件的接收条件, 则接收所述文 件, 第一发射器并根据回调地址向应用服务端发送通知消息。
30、 根据权利要求 29所述的上传服务端, 其特征在于, 所述回调地 址包括上传前回调地址和上传后回调地址。
31、 根据权利要求 30所述的上传服务端, 其特征在于, 所述请求头 域还包括应用标识, 所述应用标识是用来标识所述应用服务端的。
32、 根据权利要求 31所述的上传服务端, 其特征在于, 所述回调地 址是在所述客户端发送的请求消息的请求头域中携带的, 或所述回调地 址是从所述应用服务端获取的。
33、 根据权利要求 32所述的上传服务端, 其特征在于, 当所述回调 地址是从所述应用服务端获取的时, 还包括:
所述第一接收器还用于接收所述应用服务端发送的注册消息, 所述 注册消息包括所述回调地址;
第一存储器用于将所述回调地址保存在数据库中。
34、 根据权利要求 33所述的上传服务端, 其特征在于, 当所述回调 地址是从所述应用服务端获取的时, 所述第一接收器、 所述第一处理器、 所述第一存储器以及所述第一发射器还用于:
若满足所述文件的接收条件, 则所述第一处理器根据应用标识从所 述数据库中获取所述上传前回调地址, 所述第一发射器调用所述上传前 回调地址向所述应用服务端发送第一通知消息, 所述第一通知消息包括 所述文件的第一文件信息;
所述第一发射器还用于向所述客户端发送上传响应消息, 所述上传 响应消息包括所述请求头域, 以便于所述客户端继续上传所述文件;
所述第一接收器还用于接收所述客户端根据所述上传响应消息发送 的所述文件, 所述第一存储器还用于并存储所述文件, 所述第一处理器 根据所述应用标识从所述数据库中获取所述上传后回调地址, 所述第一 发射器调用所述上传后回调地址向所述应用服务端发送第二通知消息, 所述第二通知消息包括所述文件的第二文件信息。
35、 根据权利要求 32所述的上传服务端, 其特征在于, 当所述回调 地址是在所述客户端发送的请求消息的请求头域中携带的时, 所述第一 接收器、 所述第一处理器、 所述第一存储器以及所述第一发射器用于: 若满足所述文件的接收条件, 则所述第一处理器从所述请求头域中 获取所述上传前回调地址, 所述第一发射器调用所述上传前回调地址向 所述应用服务端发送第一通知消息, 所述第一通知消息包括所述文件的 第一文件信息;
所述第一发射器向所述客户端发送上传响应消息, 所述上传响应消 息包括所述请求头域, 以便于所述客户端继续上传所述文件;
所述第一接收器还用于接收所述客户端根据所述上传响应消息发送 的所述文件, 所述第一存储器还用于并存储所述文件, 所述第一处理器 从所述请求头域中获取所述上传后回调地址, 所述第一发射器调用所述 上传后回调地址向所述应用服务端发送第二通知消息, 所述第二通知消 息包括所述文件的第二文件信息。
36、 根据权利要求 29至 35任意一项所述的上传服务端, 其特征在 于, 还包括:
在接收完所述文件后, 所述第一发射器还用于向所述客户端发送完 成响应消息。
37、 一种应用服务端, 其特征在于, 包括:
第二发射器, 用于向上传服务端发送注册消息, 所述注册消息包括 文件上传时的回调地址;
第二接收器, 用于在注册完成后, 接收所述上传服务端根据所述回 调地址发送的文件上传的通知消息, 以获取所述文件的文件信息。
38、 根据权利要求 37所述的应用服务端, 其特征在于, 所述回调地 址包括上传前回调地址和上传后回调地址。
39、 根据权利要求 38所述的应用服务端, 其特征在于, 所述第二接 收器用于:
接收所述上传服务端根据所述上传前回调地址发送的第一通知消 息, 所述第一通知消息包括所述文件的第一文件信息;
当所述上传服务端接收完所述文件时, 接收所述上传服务端根据所 述上传后回调地址发送的第二通知消息, 所述第二通知消息包括所述文 件的第二文件信息。
40、 一种客户端, 其特征在于, 包括:
第三发射器, 用于向上传服务端发送请求消息, 所述请求消息包括 请求头域;
第三接收器, 用于接收所述上传服务端发送的上传响应消息, 所述 上传响应消息包括所述请求头域;
第三处理器, 用于根据所述上传响应消息, 向所述上传服务端上传 文件。
41、 根据权利要求 40所述的客户端, 其特征在于, 所述请求头域包 括应用标识, 或者所述请求头域包括回调地址和所述应用标识。
42、 根据权利要求 41所述的客户端, 其特征在于, 还包括: 在所述上传服务端通过所述回调地址向应用服务端回调成功之后, 所述第三接收器还用于接收所述上传服务端发送的完成响应消息。
43、 一种通信系统, 其特征在于, 包括:
如权利要求 29至 36所述的上传服务端; 权利要求 37至 39所述的 应用服务端; 权利要求 40至 42所述的客户端。
PCT/CN2013/075331 2013-05-08 2013-05-08 一种文件上传方法、客户端和服务端 WO2014179950A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2013/075331 WO2014179950A1 (zh) 2013-05-08 2013-05-08 一种文件上传方法、客户端和服务端
CN201380000611.XA CN103547339B (zh) 2013-05-08 2013-05-08 一种文件上传方法、客户端和服务端

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2013/075331 WO2014179950A1 (zh) 2013-05-08 2013-05-08 一种文件上传方法、客户端和服务端

Publications (1)

Publication Number Publication Date
WO2014179950A1 true WO2014179950A1 (zh) 2014-11-13

Family

ID=49970070

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/075331 WO2014179950A1 (zh) 2013-05-08 2013-05-08 一种文件上传方法、客户端和服务端

Country Status (2)

Country Link
CN (1) CN103547339B (zh)
WO (1) WO2014179950A1 (zh)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105991751A (zh) * 2015-03-06 2016-10-05 天津铂创国茂电子科技发展有限公司 基于云分支服务器通过中心服务器直接访问的方法
CN105141696A (zh) * 2015-09-17 2015-12-09 成都华为技术有限公司 文件上传方法和装置
CN107092635B (zh) * 2017-02-15 2020-08-04 北京星选科技有限公司 数据查询方法、装置、服务器、请求端及系统
CN107707616B (zh) * 2017-08-21 2019-02-12 贵州白山云科技股份有限公司 一种数据传输方法及系统
CN109450990A (zh) * 2018-10-19 2019-03-08 深圳点猫科技有限公司 一种基于教育系统的云存储实现方法及电子设备
CN110012055A (zh) * 2018-12-29 2019-07-12 北京乐我无限科技有限责任公司 文件上传方法、装置及系统
CN109951550A (zh) * 2019-03-21 2019-06-28 浪潮软件集团有限公司 一种对象存储的方法及系统
CN111083222B (zh) * 2019-12-13 2022-11-18 中富通集团股份有限公司 数据上传方法及终端

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102546836A (zh) * 2012-03-09 2012-07-04 腾讯科技(深圳)有限公司 一种上传文件的方法、终端、服务器及系统
CN102833337A (zh) * 2012-08-30 2012-12-19 北京星网锐捷网络技术有限公司 一种ftp文件上传、下载方法及装置
CN103002029A (zh) * 2012-11-26 2013-03-27 北京百度网讯科技有限公司 上传文件的管理方法、系统和客户端
CN103023881A (zh) * 2012-11-26 2013-04-03 北京奇虎科技有限公司 数据安全性判断方法及系统

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102196012B (zh) * 2010-03-17 2013-08-07 华为技术有限公司 服务开放方法及系统、服务开放服务器

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102546836A (zh) * 2012-03-09 2012-07-04 腾讯科技(深圳)有限公司 一种上传文件的方法、终端、服务器及系统
CN102833337A (zh) * 2012-08-30 2012-12-19 北京星网锐捷网络技术有限公司 一种ftp文件上传、下载方法及装置
CN103002029A (zh) * 2012-11-26 2013-03-27 北京百度网讯科技有限公司 上传文件的管理方法、系统和客户端
CN103023881A (zh) * 2012-11-26 2013-04-03 北京奇虎科技有限公司 数据安全性判断方法及系统

Also Published As

Publication number Publication date
CN103547339B (zh) 2017-01-25
CN103547339A (zh) 2014-01-29

Similar Documents

Publication Publication Date Title
WO2014179950A1 (zh) 一种文件上传方法、客户端和服务端
WO2017114206A1 (zh) 短链接处理方法、装置及短链接服务器
CN110999260B (zh) 在基于代理的网络通信中的控制数据的传输
JP2017529793A5 (zh)
WO2015043455A1 (zh) 数据传输方法、设备及系统
US9197575B2 (en) Handling of snapshot messages as a result of delivery failure in a two-way push connection
WO2017174026A1 (zh) 一种客户端连接方法及系统
WO2019210675A1 (en) NF SERVICE CONSUMER RESTART DETECTION USING DIRECT SIGNALING BETWEEN NFs
WO2012083620A1 (zh) 一种流媒体文件的下载方法、装置及系统
WO2014078989A1 (zh) 消息处理方法及服务器
WO2017101186A1 (zh) 用于为用户设备的应用建立无线连接的方法
WO2011038628A1 (zh) 数据获取方法、接入节点和系统
CN111885093B (zh) 事件请求的传输方法和装置、存储介质及电子设备
WO2010133097A1 (zh) 微技系统的数据共享方法、服务器以及数据共享系统
WO2015180241A1 (zh) 业务数据处理方法、装置、终端设备及计算机存储介质
CN108886533B (zh) 加速与主机服务器的连接
WO2012130048A1 (zh) 设备管理系统中对网关进行初始化的方法及装置
WO2011009339A1 (zh) 一种数据传输的方法、系统和装置
CN113765774B (zh) 消息实时同步方法、装置、电子设备及介质
WO2013135173A1 (zh) 一种推送网络内容的方法、设备和系统
WO2014015525A1 (zh) 一种用户在线状态的查询方法和装置
WO2012173899A2 (en) Remotely retrieving information from consumer devices
CN110545453B (zh) 内容分发网络的内容发布方法、装置和系统
WO2012159291A1 (zh) 识别终端类型的方法及无线接入网设备
WO2015085531A1 (zh) Qos提升方法、装置及系统

Legal Events

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

Ref document number: 13883912

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 13883912

Country of ref document: EP

Kind code of ref document: A1