The content of the invention
In view of the foregoing deficiencies of prior art, it is an object of the invention to provide one kind based on unified in http protocolThe service interface providing method and system of Resource Locator, for solving to provide the network number for meeting Real-time Transport Protocol in the prior artModule interface according to stream broadcasting service is few, and function is simple, and called frequency is low and is limited in a small range use, and the moduleIt can not be by different processes, the problem of different file, different language, the module accesses of different platform.
In order to achieve the above objects and other related objects, one aspect of the present invention provides a kind of based on unified money in http protocolThe service interface providing method of source finger URL, applied to client and server end composition communication network in, including:Pass through fingerFixed end mouthful sends the HTTP request with uniform resource locator form to network, described with uniform resource locator formHTTP request refers to the request header of http protocol, and the HTTP request of uniform resource locator form can be expressed in service processesPerformed request task, provides required parameter;HTTP request of the parsing with uniform resource locator form, and check haveThe command format of the HTTP request of uniform resource locator form is to judge whether it is legal, if so, the legal response of form is replied,Perform the HTTP request with uniform resource locator form;If it is not, then reply the illegal response of form;Detecting and feeding back hasThe execution state of the HTTP request of uniform resource locator form;Wherein, the HTTP with uniform resource locator formThe execution state of request does not bring into operation including the HTTP request, the HTTP request is among operation and the HTTP request terminatesOperation.
Preferably, the step of sending the HTTP request with uniform resource locator form to network by designated port is gone backIncluding generating the HTTP request with uniform resource locator form;HTTP request of the generation with uniform resource locator formIt is according to starting to send network data flow, terminate to send network data flow or inquiry network data flow status requirements filling HTTPThe uniform resource locator part of request, wherein, the uniform resource locator part includes HTTP method, order line and ginsengNumber;Wherein HTTP method is GET methods;Order row format is [client ip address]:[client port]/client service intoJourney.
Preferably, HTTP request of the parsing with uniform resource locator form is with the GET methods tail of stringFor order line start, using question mark in the parameter as order line endings, client ip address, the visitor of the HTTP request are parsedFamily end port and client service process.
Preferably, judge the HTTP request with uniform resource locator form command format it is whether legal according toAccording to being whether there is according to the required parameter, and parameter value is not sky.
Preferably, sending the HTTP request with uniform resource locator form to network by designated port includes:It is logicalIt crosses specified first port and sends to start to send to network and meet real-time transport protocol network data flow and with unified resource positioningAccord with the HTTP request of form;And meet real-time transport protocol network data by the way that second port is specified to send to terminate to send to networkIt flows and has the HTTP request of uniform resource locator form or met by the way that third port is specified to send inquiry transmission to networkReal-time transport protocol network data stream mode and the HTTP request with uniform resource locator form.
Preferably, start to send the network data flow for meeting real-time transport protocol by the way that first port is specified to send to networkAnd the HTTP request with uniform resource locator form;Wherein, start to send the network data flow for meeting real-time transport protocolAnd the required parameter of the HTTP request offer with uniform resource locator form includes source files, the network of network data flowTarget port, the encoding and decoding of network data current load and the network number that the destination address of data flow transmission, network data flow are sentWhether need to cycle through according to stream;Parsing starts to send the network data flow for meeting real-time transport protocol and determine with unified resourceThe HTTP request of position symbol form;It checks and starts to send the network data flow for meeting real-time transport protocol and be positioned with unified resourceAccord with the command format of the HTTP request of form;Judge to start to send the network data flow for meeting real-time transport protocol and have unifiedWhether the command format of the HTTP request of Resource Locator form is legal, if so, replying the legal response of form, execution starts to sendMeet the network data flow of real-time transport protocol and the HTTP request with uniform resource locator form, and obtain the HTTP and askSeek the mark Universally Unique Identifier of execution;If it is not, then reply the illegal response of form;It detects and feeds back to start to send and meet realityWhen transport protocol network data flow and with uniform resource locator form HTTP request execution state.
Preferably, by specify second port to network send terminate send meet real-time transport protocol network data flow andHTTP request with uniform resource locator form;Wherein, terminate to send to meet real-time transport protocol network data flow and toolThe required parameter that the HTTP request for having uniform resource locator form provides is included from by the way that first port is specified to be sent to networkStart the process for sending the network data flow for meeting real-time transport protocol and the HTTP request with uniform resource locator formThe Universally Unique Identifier of middle acquisition;Parsing, which terminates to send, to be met real-time transport protocol network data flow and determines with unified resourceThe HTTP request of position symbol form;It checks and terminates to send the network data flow for meeting real-time transport protocol and be positioned with unified resourceAccord with the command format of the HTTP request of form;Judge to terminate to send to meet real-time transport protocol network data flow and with unified moneyWhether the command format of the HTTP request of source finger URL form is legal, if so, replying the legal response of form, performing the HTTP pleaseIt asks, and detects the execution state of the HTTP request;If it is not, then reply the illegal response of form;It detects and feeds back end and send symbolClose the execution state of real-time transport protocol network data flow and the HTTP request with uniform resource locator form.
Preferably, real-time transport protocol network data flow shape is met by the way that third port is specified to send inquiry to network and sendState and the HTTP request with uniform resource locator form;Wherein, inquiry, which is sent, meets real-time transport protocol network data flowState and with uniform resource locator form HTTP request provide required parameter include from by specify first port toNetwork transmission starts to send the network data flow for meeting real-time transport protocol and has the HTTP of uniform resource locator form pleaseThe Universally Unique Identifier obtained during asking;Parsing inquiry, which is sent, meets real-time transport protocol network data stream mode and toolThere is the HTTP request of uniform resource locator form;It checks that inquiry is sent and meets real-time transport protocol network data stream mode and toolThere is the command format of the HTTP request of uniform resource locator form;Judge that inquiry is sent and meet real-time transport protocol network dataStream mode and with uniform resource locator form HTTP request command format it is whether legal, if so, reply form it is legalResponse, performs the HTTP request;If it is not, then reply the illegal response of form;It detects and feedback query transmission meets real-time TransmissionProtocol network data flow state and with uniform resource locator form HTTP request execution state.
Another aspect of the present invention also provides a kind of service interface based on uniform resource locator in http protocol and provides systemSystem, including:Client, for generating the HTTP request with uniform resource locator form, sending has unified resource positioningAccord with the HTTP request of form;And the execution state for detecting and feeding back the HTTP request with uniform resource locator form;Server end, for receiving the HTTP request with uniform resource locator form, parsing has uniform resource locator formHTTP request;Check the command format of the HTTP request with uniform resource locator form;Judge to determine with unified resourceWhether the command format of the HTTP request of position symbol form is legal, if so, replying the legal response of form, performs and determines with unified resourcePosition accords with the HTTP request of form, and the execution shape of the HTTP request with uniform resource locator form is obtained from the clientState;If it is not, then reply the illegal response of form;The server end has designated port;Wherein, it is described to determine with unified resourceThe HTTP request of position symbol form refers to the request header of http protocol, and the HTTP request of uniform resource locator form can be expressedPerformed request task, provides required parameter in service processes;The HTTP request with uniform resource locator formExecution state do not bring into operation including the HTTP request, the HTTP request is among operation and the HTTP request terminates to run.
Preferably, the designated port includes first port, second port and third port, wherein, the client is led toIt crosses the first port and sends to start to send to network and meet real-time transport protocol network data flow and with unified resource positioningAccord with the HTTP request of form;The client sends to terminate to send to network by the second port meets real-time transport protocolNetwork data flow and HTTP request with uniform resource locator form or the client are by the third port to netNetwork, which sends inquiry and sends, to be met real-time transport protocol network data stream mode and has the HTTP of uniform resource locator form pleaseIt asks.
As described above, the service interface providing method based on uniform resource locator in http protocol of the present invention and beingSystem, has the advantages that:
1st, present invention utilizes http protocol operating system independence, any operating system can realize HTTP clientsAnd HTTP server;The language independence of http protocol is make use of, any language can realize HTTP clients and HTTP clothesBusiness device;Http protocol is network-based, so can access between different processes.It is similar that a small amount of interface is only provided, noThe media playback service being frequently used provides service interface using http protocol URL format, that is, realizes cross operating system and put downPlatform, across language, striding course, across file system, by not having to realize or quoting complicated frame.
2nd, transferring content is not required using http protocol transmission in the present invention, it is only necessary to which the content of URL can express interfaceContent, this service interface across language have very big practicability.
Embodiment one
The present embodiment provides a kind of service interface providing methods based on uniform resource locator in http protocol, are applied toIn the communication network of client and server end composition, referring to Fig. 1, being shown as based on uniform resource locator in http protocolService interface providing method flow chart, the service interface providing method bag based on uniform resource locator in http protocolIt includes:
Step S1, the client sends the HTTP with uniform resource locator form by designated port to network pleaseIt asks;The HTTP request with uniform resource locator form refers to the request header of http protocol, uniform resource locatorThe HTTP request of form can express request task performed in service processes, provide required parameter.It also wraps in step slInclude HTTP request of the generation with uniform resource locator form;There is the HTTP request of uniform resource locator form to be for generationIt is asked according to transmission network data flow, end transmission network data flow or inquiry network data flow status requirements filling HTTP is startedThe uniform resource locator part asked, wherein, the uniform resource locator part includes HTTP method, order line and parameter;Wherein HTTP method is GET methods;Order row format is [client ip address]:[client port]/client service process.
Step S2, the HTTP request of the server end parsing with uniform resource locator form.Parsing has unifiedThe HTTP request of Resource Locator form is using the GET methods tail of string as order line start, to be asked in the parameterNumber for order line endings, the client ip address, client port and client service process of the HTTP request are parsed.Argument section be fromNumber start, character string HTTP/1.1 beginning for ending, using & as line of demarcation, each parameter is respectively with parameter item=parameter value represents, therefore, starts to send data flow, terminates to send data flow, query service status is all the shape with parameterFormula represents.
Step S3, the server end inspection have the command format of the HTTP request of uniform resource locator form;
Step S4, whether the command format of the HTTP request of the server end judgement with uniform resource locator formIt is legal, if so, performing step S5;If it is not, performing step S7, that is, the illegal response of form is replied, then terminates process.Wherein,The whether legal foundation of the command format of HTTP request with uniform resource locator form described in judging is please according toParameter is asked to whether there is, and parameter value is not sky.
Step S5, the server end replys the legal response of form to the client, and performs and determine with unified resourceThe HTTP request of position symbol form.
Step S6, the client detect and feed back the execution state of the HTTP request with uniform resource locator formTo the server end.Wherein, the execution state of the HTTP request with uniform resource locator form includes the HTTPRequest does not bring into operation, the HTTP request is among operation and the HTTP request terminates to run.
In abovementioned steps S1, the client is sent by the designated port on server end to network has unified resourceThe HTTP request of finger URL form includes starting to send to network transmission by first port meeting real-time transport protocol network numberAccording to the HTTP request for flowing and having uniform resource locator form;And terminate to send symbol by the way that second port is specified to send to networkClose real-time transport protocol network data flow and with uniform resource locator form HTTP request or pass through specify third portMeet real-time transport protocol network data stream mode to network transmission inquiry transmission and there is uniform resource locator formHTTP request.
2 are referred to, is shown as starting to send the net for meeting real-time transport protocol by the way that first port is specified to send to networkNetwork data flow and with uniform resource locator form HTTP request process, wherein, start send meet real-time Transmission associationThe network data flow of view and the required parameter that there is the HTTP request of uniform resource locator form to provide include network data flowSource files (file), network data flow send destination address (destip), network data flow send target port(desport), whether the encoding and decoding (codec) of network data current load and network data flow need to cycle through (loop).It opensIt originates and the network data flow for meeting real-time transport protocol and the HTTP request with uniform resource locator form is sent to be identified asstart.The process specifically includes:
Step S1 ' starts to send the network data for meeting real-time transport protocol by the way that first port is specified to send to networkStream and the HTTP request with uniform resource locator form;Step S1 ' further include generation start send meet real-time Transmission associationThe network data flow of view and the HTTP request with uniform resource locator form are according to the need for starting transmission network data flowThe uniform resource locator part of filling HTTP request is asked, wherein, the uniform resource locator part includes HTTP method, lifeOrder row and parameter;Value.
Step S2 ', parsing start to send the network data flow for meeting real-time transport protocol and have uniform resource locatorThe HTTP request of form.Parsing starts to send the network data flow for meeting real-time transport protocol and has uniform resource locator latticeThe HTTP request of formula is using the GET methods tail of string as order line start, using question mark in the parameter as order line knotTail parses the client ip address, client port and client service process of the HTTP request.Argument section be fromNumber start, character string HTTP/1.1 beginning for ending, using & as line of demarcation, each parameter carrys out table with parameter item=parameter value respectivelyShow.
Step S3 ' is checked and is started to send the network data flow for meeting real-time transport protocol and have uniform resource locatorThe command format of the HTTP request of form;
Step S4 ' judges whether the command format of the HTTP request is legal, if so, performing step S5 ';If it is not, it then performsStep S7 ' replys the illegal response of form, terminates process.
Step S5 ' replys the legal response of form, performs and starts to send the network data flow and tool for meeting real-time transport protocolThere is the HTTP request of uniform resource locator form, and obtain the mark Universally Unique Identifier of HTTP request execution(UUID);Wherein, the whether legal foundation of the command format of the HTTP request with uniform resource locator form is judgedIt is that whether there is according to the required parameter, and parameter value is not sky.With HTTP://[MediaPlayIP]:[MediaPlayPort]/MediaPlayCmd=start&file=busytone.wav&loop=1&codec=g711a&Exemplified by destip=192.168.1.1&destport=4000, judge whether to have in required parameter cmd=start andThis four parameters of file, codec, destip, destport whether there is, and be worth for sky, if cmd=start andThis four parameters of file, codec, destip, destport all exist, and are worth not for sky, then are legal.
In the present embodiment, server end can concurrently perform multiple tasks, in order to identify the uniqueness of task, start to send outIt is that server program uses the IP address of client access, end that UUID, this UUID can be used during SCN Space Cable Network data flowMouthful, receive three parameters of time generation of request, the algorithm of generation is UUID=client ip address character string+client endThe time character string of mouthful character string+receive request.
Step S6 ', detects and feeds back and start to send the network data flow that meets real-time transport protocol and with unified resourceThe execution state of the HTTP request of finger URL form, which does not bring into operation including the HTTP request, the HTTP requestAmong operation and the HTTP request terminates to run.
Start to send to network transmission by specified first port and meet the network data flow of real-time transport protocol and haveThe HTTP request of uniform resource locator form is by taking table 1 as an example:
Table 1:It sends and starts to send the network data flow for meeting real-time transport protocol and there is uniform resource locator formHTTP request embodiment
3 are referred to, is shown as terminating to send the net for meeting real-time transport protocol by the way that second port is specified to send to networkNetwork data flow and with uniform resource locator form HTTP request process, wherein, terminate send meets real-time Transmission associationThe network data flow of view and the required parameter that there is the HTTP request of uniform resource locator form to provide are included from by specifyingFirst port starts to send the network data flow for meeting real-time transport protocol and with uniform resource locator lattice to network transmissionThe Universally Unique Identifier obtained during the HTTP request of formula.Terminate to send the network data flow for meeting real-time transport protocolAnd the HTTP request with uniform resource locator form is identified as stop.The process specifically includes:
S1 ", by specify second port to network send terminate send meet real-time transport protocol network data flow andHTTP request with uniform resource locator form;Generation end is further included in this step and is sent meets real-time transport protocolNetwork data flow and with uniform resource locator form HTTP request, be according to terminate send network data flow demand fill outThe uniform resource locator part of HTTP request is filled,
S2 ", parsing terminate to send the network data flow for meeting real-time transport protocol and have uniform resource locator formHTTP request;
S3 " is checked and is terminated to send the network data flow for meeting real-time transport protocol and have uniform resource locator formHTTP request command format;
S4 " judges to terminate to send the network data flow for meeting real-time transport protocol and has uniform resource locator formHTTP request command format it is whether legal, if so, performing step S5 ";If it is not, then perform step S7 ".
S5 " replys the legal response of form, performs the HTTP request,.Wherein, terminate to send to meet real-time transport protocolNetwork data flow and the execution state of HTTP request with uniform resource locator form do not start to transport including the HTTP requestRow, the HTTP request is among operation and the HTTP request terminates to run.Judging to terminate to send to meet real-time transport protocolNetwork data flow and with uniform resource locator form HTTP request command format it is whether legal when HTTP://[MediaPlayIP]:[MediaPlayPort]/MediaPlayExemplified by cmd=stop&uuid=2003, judge be in parameterIt is no with the presence of cmd=stop and UUID, and be worth for sky.If cmd=stop, and UUID exists, and the value of UUID is not sky,It is then legal.
S6 " is detected and fed back and terminates to send the network data flow for meeting real-time transport protocol and be positioned with unified resourceThe execution state of the HTTP request of form is accorded with, which does not bring into operation including the HTTP request, the HTTP request is being transportedIn the trade and the HTTP request terminates to run.
S7 " replys the illegal response of form, terminates process.
By the way that second port is specified to meet the network data flow of real-time transport protocol to network transmission end transmission and is hadThe HTTP request of uniform resource locator form is by taking table 2 as an example:
Table 2:It sends and terminates to send the network data flow for meeting real-time transport protocol and there is uniform resource locator formHTTP request embodiment
4 are referred to, is shown as meeting real-time transport protocol network by the way that third port is specified to send inquiry to network and sendData flow state and with uniform resource locator form HTTP request process, wherein, inquiry send meets real-time TransmissionThe required parameter that protocol network data flow state and HTTP request with uniform resource locator form provide is included from passing throughFirst port is specified to start to send the network data flow for meeting real-time transport protocol and with unified resource positioning to network transmissionThe Universally Unique Identifier obtained during the HTTP request for according with form.Inquiry, which is sent, meets real-time transport protocol network dataStream mode and HTTP request with uniform resource locator form are identified as query.The inquiry, which is sent, meets real-time biographyDefeated protocol network data flow state includes inquiry transmission and meets real-time transport protocol network data flow.The process specifically includes:
S1 " ' meets real-time transport protocol network data stream mode by the way that third port is specified to send inquiry to network and sendAnd the HTTP request with uniform resource locator form;Generation inquiry is further included in this step and is sent meets real-time Transmission associationNetwork data stream mode and the HTTP request with uniform resource locator form are discussed, generation inquiry, which is sent, meets real-time Transmission associationNetwork data stream mode and the HTTP request with uniform resource locator form are discussed, is that network data flow need are sent according to inquiryThe uniform resource locator part of filling HTTP request is asked, S2 " ', parsing inquiry, which is sent, meets real-time transport protocol network dataStream mode and the HTTP request with uniform resource locator form.
S3 " ' checks that inquiry is sent and meets real-time transport protocol network data stream mode and with uniform resource locator latticeThe command format of the HTTP request of formula;
S4 " ' judges that inquiry is sent and meets real-time transport protocol network data stream mode and with uniform resource locator latticeWhether the command format of the HTTP request of formula is legal, if so, performing step S5 " ';If it is not, then perform step S7 " '.Wherein,Meet real-time transport protocol network data stream mode in judgement inquiry transmission and have the HTTP of uniform resource locator form pleaseWhen whether the command format asked is legal.
With HTTP://[MediaPlayIP]:[MediaPlayPort]/MediaPlayCmd=Query&uuid=Exemplified by 2003, judge whether with the presence of cmd=query and UUID in parameter, and be worth not for sky.If cmd=stop, and UUIDIn the presence of, and the value of UUID is not sky, then is legal.
S5 " ' replys the legal response of form, performs the HTTP request.
S6 " ', is detected and feedback query transmission meets real-time transport protocol network data stream mode and determines with unified resourceThe execution state of the HTTP request of position symbol form.Wherein, inquiry, which is sent, meets real-time transport protocol network data stream mode and toolThe execution state for having the HTTP request of uniform resource locator form does not bring into operation including the HTTP request, the HTTP request existsAmong operation and the HTTP request terminates to run.
S7 " ' replys the illegal response of form, terminates process.
Meet real-time transport protocol network data stream mode and tool by the way that third port is specified to send inquiry to network and sendHave the HTTP request of uniform resource locator form by taking table 3 as an example:
Table 3:It sends inquiry and sends and meet real-time transport protocol network data stream mode and with uniform resource locator latticeThe HTTP request embodiment of formula
The present embodiment also provides a kind of service interface based on uniform resource locator in http protocol and provides system, please joinFig. 5 is read, the service interface based on uniform resource locator in http protocol is shown as and system principle structure chart, the service is providedInterface, which provides system 1, includes client 11 and server end 12.
For client 11 for generating the HTTP request with uniform resource locator form, sending has unified resource positioningAccord with the HTTP request of form;And the execution state for detecting and feeding back the HTTP request with uniform resource locator form.Wherein, the HTTP request with uniform resource locator form includes starting to send meeting real-time transport protocol network dataStream and the HTTP request with uniform resource locator form;Terminate to send and meet real-time transport protocol network data flow and haveThe HTTP request of uniform resource locator form or inquiry, which are sent, meets real-time transport protocol network data stream mode and with systemThe HTTP request of one Resource Locator form.Wherein, the HTTP request with uniform resource locator form refers to HTTPThe request header of agreement, the HTTP request of uniform resource locator form can express request performed in service processes and appointBusiness, provides required parameter.
Server end 12 is parsed and determined with unified resource for receiving the HTTP request with uniform resource locator formThe HTTP request of position symbol form;Check the command format of the HTTP request with uniform resource locator form;Whether judge itLegal, if so, replying the legal response of form to the client 11, performing the HTTP with uniform resource locator form pleaseIt asks, and the execution state of the HTTP request with uniform resource locator form is obtained from the client 11;If it is not, it then replysThe illegal response of form.
The server end 12 has designated port.The designated port include first port 121, second port 122 andThird port 123, wherein, the client 11 starts to send by the first port 121 to network transmission meets real-time biographyDefeated protocol network data flow and the HTTP request with uniform resource locator form;The client 11 passes through the second endMouth 122 meets real-time transport protocol network data flow to network transmission end transmission and has uniform resource locator formHTTP request or the client send inquiry and send to the third port 123 to network meets real-time transport protocol networkData flow state and the HTTP request with uniform resource locator form.The HTTP with uniform resource locator formThe execution state of request does not bring into operation including the HTTP request, the HTTP request is among operation and the HTTP request terminatesOperation.
Service interface providing method and system of the present invention based on uniform resource locator in http protocol utilizeHttp protocol operating system independence, any operating system can realize HTTP clients and HTTP server;It make use ofThe language independence of http protocol, any language can realize HTTP clients and HTTP server;Http protocol is to be based onNetwork, so can access between different processes.It is similar that a small amount of interface is only provided, the media play not being frequently usedService provides service interface using http protocol URL format, that is, spanning operation system platform is realized, across language, striding course, across textPart system, by not having to realize or quoting complicated frame.And transferring content is not required in HTTP transmission, it is only necessary to the content of URLPortal contents can be expressed, this service interface across language has very big practicability.
So the present invention effectively overcomes various shortcoming of the prior art and has high industrial utilization.
The above-described embodiments merely illustrate the principles and effects of the present invention, and is not intended to limit the present invention.It is any ripeKnow the personage of this technology all can carry out modifications and changes under the spirit and scope without prejudice to the present invention to above-described embodiment.CauseThis, those of ordinary skill in the art is complete without departing from disclosed spirit and institute under technological thought such asInto all equivalent modifications or change, should by the present invention claim be covered.