CN107360261B - HTTP request processing method and device and electronic equipment - Google Patents

HTTP request processing method and device and electronic equipment Download PDF

Info

Publication number
CN107360261B
CN107360261B CN201710799249.7A CN201710799249A CN107360261B CN 107360261 B CN107360261 B CN 107360261B CN 201710799249 A CN201710799249 A CN 201710799249A CN 107360261 B CN107360261 B CN 107360261B
Authority
CN
China
Prior art keywords
request
interface data
rpc
http request
http
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710799249.7A
Other languages
Chinese (zh)
Other versions
CN107360261A (en
Inventor
梁流威
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN201710799249.7A priority Critical patent/CN107360261B/en
Publication of CN107360261A publication Critical patent/CN107360261A/en
Application granted granted Critical
Publication of CN107360261B publication Critical patent/CN107360261B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • 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/133Protocols for remote procedure calls [RPC]

Abstract

The embodiment of the invention provides a method, a device and electronic equipment for processing an HTTP request, which are applied to the technical field of the Internet, and the method comprises the steps of receiving the HTTP request sent by a client, judging whether interface data corresponding to the category corresponding to the HTTP request exists locally or not, inputting parameters in UR L in the HTTP request into an input program of the interface data if the interface data corresponding to the category corresponding to the HTTP request exists locally, obtaining an RPC request corresponding to the HTTP request, sending the RPC request to an RPC server, receiving the result of the RPC request returned by the RPC server, analyzing the result of the RPC request through the output program of the interface data, and returning the analyzed result of the RPC request to the client.

Description

HTTP request processing method and device and electronic equipment
Technical Field
The invention relates to the technical field of internet, in particular to a method and a device for processing an HTTP request and electronic equipment.
Background
The HyperText Transfer Protocol (HTTP) is a network Protocol most widely used on the internet. In the field of internet application development, there are systems with different structures and interfaces, and these systems can communicate with each other through HTTP, and can Call a service provided by a Remote Procedure Call (RPC) protocol when communicating through HTTP. RPC is an inter-process communication method that can request services from a remote computer program over a network without knowing the protocol of the underlying network technology.
Specifically, a code corresponding to each RPC interface is written in the HTTP server, and when the HTTP server receives an HTTP request and calls a service provided by RPC, the HTTP request is sent to the RPC server by accessing the code corresponding to the RPC interface, so that the RPC server processes the HTTP request. If the RPC interface needs to be added, the code corresponding to the added RPC interface needs to be written.
However, the inventor finds that the prior art has at least the following problems in the process of implementing the invention:
in the process of calling the service provided by the RPC, corresponding codes need to be accessed to realize the RPC service, so that the process of calling the RPC service is complex.
Disclosure of Invention
The embodiment of the invention aims to provide an HTTP request processing method, an HTTP request processing device and electronic equipment so as to simplify the calling process of RPC service. The specific technical scheme is as follows:
the embodiment of the invention provides a hypertext transfer protocol (HTTP) request processing method, which is applied to an HTTP server and comprises the following steps:
receiving an HTTP request sent by a client;
judging whether interface data corresponding to the category corresponding to the HTTP request exists locally;
if interface data corresponding to the category corresponding to the HTTP request locally exist, inputting parameters in a uniform resource locator UR L included in the HTTP request into an input program of the interface data to obtain an RPC request corresponding to the HTTP request, and sending the RPC request to an RPC server;
receiving an RPC request result returned by the RPC server, and analyzing the RPC request result through an output program of the interface data;
and returning the analyzed RPC request result to the client.
Optionally, before the receiving the HTTP request sent by the client, the method further includes:
and during initialization, acquiring interface data corresponding to the category corresponding to each HTTP request in the RPC server, and storing the interface data to the local.
Optionally, the HTTP request processing method according to the embodiment of the present invention further includes:
and if the interface data corresponding to the category corresponding to the HTTP request do not exist locally, returning error information to the client.
Optionally, the interface data includes: the program execution method comprises a request identification, an input program corresponding to the request identification and an output program corresponding to the request identification, wherein the input program and the output program respectively comprise different program identifications.
Optionally, the determining whether the interface data corresponding to the category corresponding to the HTTP request exists locally includes:
judging whether a request identifier identical to the request identifier in the UR L exists in the locally stored interface data;
if the request identifier which is the same as the request identifier in the UR L exists in the locally stored interface data, determining that the interface data corresponding to the category corresponding to the HTTP request exists locally;
and if the request identifier which is the same as the request identifier in the UR L does not exist in the locally stored interface data, determining that the interface data corresponding to the category corresponding to the HTTP request does not exist locally.
The embodiment of the invention provides a HTTP request processing device, which comprises:
the HTTP request receiving module is used for receiving an HTTP request sent by a client;
the interface data judgment module is used for judging whether the interface data corresponding to the category corresponding to the HTTP request exists locally;
the RPC request obtaining and sending module is used for inputting the parameters in the uniform resource locator UR L included in the HTTP request into an input program of the interface data to obtain an RPC request corresponding to the HTTP request and sending the RPC request to an RPC server when the judgment result of the interface data judging module is yes;
the RPC request result analyzing module is used for receiving the RPC request result returned by the RPC server and analyzing the RPC request result through an output program of the interface data;
and the request result sending module is used for returning the analyzed RPC request result to the client.
Optionally, the HTTP request processing apparatus according to the embodiment of the present invention further includes:
and the interface data storage module is used for acquiring each interface data corresponding to the category corresponding to each HTTP request in the RPC server during initialization and storing each interface data to the local.
Optionally, the HTTP request processing apparatus according to the embodiment of the present invention further includes:
and the error information returning module is used for returning error information to the client when the judgment result of the interface data judging module is negative.
Optionally, the interface data includes: the program execution method comprises a request identification, an input program corresponding to the request identification and an output program corresponding to the request identification, wherein the input program and the output program respectively comprise different program identifications.
Optionally, the RPC request obtaining and sending module is specifically configured to determine whether a request identifier that is the same as the request identifier in the UR L exists in the locally stored interface data, determine that interface data corresponding to the category corresponding to the HTTP request exists locally if the request identifier that is the same as the request identifier in the UR L exists in the locally stored interface data, and determine that interface data corresponding to the category corresponding to the HTTP request does not exist locally if the request identifier that is the same as the request identifier in the UR L does not exist in the locally stored interface data.
An embodiment of the present invention provides an electronic device, including: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
the memory is used for storing a computer program;
the processor is configured to implement any one of the HTTP request processing method steps when executing the program stored in the memory.
In yet another aspect of the present invention, there is also provided a computer-readable storage medium having stored therein instructions, which when run on a computer, cause the computer to execute any one of the HTTP request processing methods described above.
In yet another aspect of the present invention, an embodiment of the present invention further provides a computer program product containing instructions, which when run on a computer, causes the computer to execute any one of the HTTP request processing methods described above.
According to the HTTP request processing method, the device and the electronic equipment, after the HTTP request sent by the client is received, whether interface data corresponding to the category corresponding to the HTTP request exists locally or not is judged, if the interface data corresponding to the category corresponding to the HTTP request exists locally, the parameter in UR L in the HTTP request is input into an input program of the interface data to obtain the RPC request corresponding to the HTTP request, the RPC request is sent to the RPC server, the RPC request result returned by the RPC server is received, the RPC request result is analyzed through an output program of the interface data, and the analyzed RPC request result is returned to the client.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
Fig. 1 is a flowchart of an HTTP request processing method according to an embodiment of the present invention;
FIG. 2 is another flow chart of a HTTP request processing method according to an embodiment of the present invention;
fig. 3 is a structural diagram of an HTTP request processing apparatus according to an embodiment of the present invention;
fig. 4 is another structural diagram of an HTTP request processing apparatus according to an embodiment of the present invention;
fig. 5 is a block diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention.
In order to reduce the development amount of codes corresponding to an RPC interface in an HTTP server when an RPC service is called in the process of processing an HTTP request, the embodiment of the invention provides an HTTP request processing method, an HTTP request processing device and electronic equipment, so that the calling process of the RPC service is simplified.
First, the HTTP request processing method according to the embodiment of the present invention will be described in detail.
Referring to fig. 1, fig. 1 is a flowchart of an HTTP request processing method according to an embodiment of the present invention, applied to an HTTP server, including the following steps:
s101, receiving an HTTP request sent by a client.
Specifically, the HTTP request refers to a request message sent by a client to an HTTP server, and the request message includes: a request method for a resource, an identifier of the resource and a protocol used. The complete HTTP request process starts after TCP three-way handshake connection establishment succeeds, and the client sends an HTTP request to the HTTP server according to a specified format.
S102, judging whether interface data corresponding to the category corresponding to the HTTP request exists locally.
In the related art, after receiving the HTTP request, the HTTP server parses the HTTP request, processes the HTTP request, and returns an HTTP response to the client. In the embodiment of the present invention, after receiving an HTTP request, it is determined whether interface data corresponding to a category corresponding to the HTTP request exists locally, where the category corresponding to the HTTP request refers to which category the HTTP request belongs, for example, a request for acquiring video information, and the like. Therefore, even if two HTTP requests acquire different video information, but both HTTP requests belong to the request for acquiring video information, the two HTTP requests still belong to the same type of request, and correspond to the same interface data. The interface data includes: the system comprises a request identifier, an input program corresponding to the request identifier and an output program corresponding to the request identifier, wherein the input program and the output program respectively comprise different program identifiers, the input program refers to an interface program capable of converting an HTTP request into an RPC request, and the output program refers to an interface program capable of converting an RPC request result into an HTTP request result.
For example, the interface data stored in the HTTP server may be:
getVideo→getVideoRequest;
getVideo→getVideoResponse;
the request identifier of the interface data is: "getVideo",
the input program corresponding to the request identifier is as follows:
Figure BDA0001401110570000061
the output program corresponding to the request identifier is:
Figure BDA0001401110570000062
it can be seen that the program identifiers included in the input program and the output program are REQUEST and RESPONSE, respectively, i.e. the program identifiers of the input program and the output program are different, and the input parameter Video _ id included in the input program is obtained from the HTTP REQUEST. The language defining the interface data may be Protobuf, which is a data exchange format of google, and is independent of the language and independent of the platform. The specific processing method for acquiring the video information is realized by the RPC server, the realization method can be facebook open source Thrift, and the Thrift is used for RPC communication among languages in the system.
In one implementation manner of the present invention, determining whether there is interface data corresponding to a category corresponding to an HTTP request locally includes:
judging whether a request identifier identical to the request identifier in UR L exists in the locally stored interface data;
if the request identifier which is the same as the request identifier in the UR L exists in the locally stored interface data, determining that the interface data corresponding to the category corresponding to the local HTTP request exists;
and if the request identifier which is the same as the request identifier in the UR L does not exist in the locally stored interface data, determining that the interface data corresponding to the category corresponding to the HTTP request does not exist locally.
In the embodiment of the present invention, since the interface data includes the request identifier and the UR L also includes the request identifier, the manner of determining whether the interface data corresponding to the category corresponding to the HTTP request exists locally through the request identifier is simpler and more accurate.
S103, inputting the parameters in the UR L included in the HTTP request into an input program of the interface data to obtain an RPC request corresponding to the HTTP request, and sending the RPC request to an RPC server.
In this step, if it is determined that interface data corresponding to the category corresponding to the HTTP request exists locally, the parameter in UR L included in the HTTP request is input to the input program of the interface data, so as to obtain an RPC request corresponding to the HTTP request.
Taking the above defined interface data for obtaining Video information as an example, if UR L is www.AAA.com/a/getVideo.
And S104, receiving the RPC request result returned by the RPC server, and analyzing the RPC request result through an output program of the interface data.
In the embodiment of the invention, after the RPC server receives the RPC request, the RPC request is processed to obtain an RPC request result, and the RPC request result is returned to the HTTP server. Since there are many kinds of HTTP requests, there are also many kinds of RPC requests after converting the HTTP request into the RPC request, and accordingly, there are many kinds of obtained RPC request results.
Therefore, the HTTP server, after receiving the RPC request result, may parse the request result through an output program of the interface data. For example, if the output program corresponding to the request for obtaining video information is getVideoResponse, then the RPC request result may be parsed by getVideoResponse.
And S105, returning the analyzed RPC request result to the client.
The HTTP request processing method comprises the steps of judging whether interface data corresponding to the category corresponding to the HTTP request exists locally or not after the HTTP request sent by a client is received, inputting parameters in UR L included in the HTTP request into an input program of the interface data if the interface data corresponding to the category corresponding to the HTTP request exists locally, obtaining the RPC request corresponding to the HTTP request, sending the RPC request to an RPC server, receiving an RPC request result returned by the RPC server, analyzing the RPC request result through the output program of the interface data, and returning the analyzed RPC request result to the client.
With reference to the foregoing embodiment, in another embodiment provided by the present invention, referring to fig. 2, fig. 2 is another flowchart of an HTTP request processing method according to an embodiment of the present invention, and on the basis of the embodiment of fig. 1, the method further includes the following steps:
when it is determined that there is no interface data corresponding to the category corresponding to the HTTP request locally, step S201 is executed.
S201, returning error information to the client.
In the embodiment of the present invention, the interface data stored locally is obtained from the configuration file, and although the configuration file is used by both the HTTP server and the RPC server, the configuration file may be stored in a server other than the HTTP server and the RPC server. And if the RPC interface is newly added, updating the configuration file. After updating the configuration file, the server storing the configuration file may be restarted. When the interface data corresponding to the category corresponding to the HTTP request does not exist in the HTTP server, the HTTP server cannot convert the HTTP request into the RPC request, that is, the HTTP server cannot call the RPC service corresponding to the HTTP request, and then, an error message is returned to the client.
In this step, an error message is returned to the client, so that the user can be informed of: the HTTP request sent by the user is unsupported, so that the user is prevented from repeatedly sending the HTTP request, and the processing pressure of the HTTP server is relieved.
With reference to the embodiment of fig. 1 or the embodiment of fig. 2, in another embodiment provided by the present invention, before S101, the following steps may be further included:
and when the HTTP server is initialized, acquiring each interface data corresponding to the category corresponding to each HTTP request in the RPC server, and storing each interface data to the local.
In the embodiment of the invention, when the HTTP server is initialized, the interface data corresponding to the category corresponding to each HTTP request in the RPC server can be obtained, the corresponding relation data (the input program and the output program) in the interface data are stored locally according to the information configured by the interface data, and the interface data can be stored in order through the MAP. The MAP is a set common in JAVA, and is a set in which keys (Key objects) and values (Value objects) are mapped, and the MAP storage in the embodiment of the present invention refers to a set in which an input program and an output program are mapped.
In this way, the HTTP server can convert the HTTP request into the RPC request after receiving the HTTP request and call the service provided by the RPC by storing the mapping relationship between the input program and the output program to the local.
Corresponding to the foregoing method embodiment, an embodiment of the present invention further provides an HTTP request processing apparatus, referring to fig. 3, where fig. 3 is a structural diagram of the HTTP request processing apparatus according to the embodiment of the present invention, and the method includes:
an HTTP request receiving module 301, configured to receive an HTTP request sent by a client;
an interface data determining module 302, configured to determine whether there is interface data corresponding to the category corresponding to the HTTP request locally;
an RPC request obtaining and sending module 303, configured to, when the determination result of the interface data determining module 302 is yes, input a parameter in the UR L included in the HTTP request into an input program of the interface data, obtain an RPC request corresponding to the HTTP request, and send the RPC request to the RPC server;
the RPC request result analyzing module 304 is configured to receive an RPC request result returned by the RPC server, and analyze the RPC request result through an output program of the interface data;
a request result sending module 305, configured to return the parsed RPC request result to the client.
The HTTP request processing device comprises a client, a server and a client, wherein the client is used for receiving an HTTP request sent by the client, judging whether interface data corresponding to the category corresponding to the HTTP request exists locally or not, if the interface data corresponding to the category corresponding to the HTTP request exists locally, inputting parameters in UR L in the HTTP request into an input program of the interface data to obtain an RPC request corresponding to the HTTP request, sending the RPC request to an RPC server, receiving an RPC request result returned by the RPC server, analyzing the RPC request result through the output program of the interface data, and returning the analyzed RPC request result to the client.
It should be noted that, the apparatus according to the embodiment of the present invention is an apparatus applying the HTTP request processing method, and all embodiments of the HTTP request processing method are applicable to the apparatus and can achieve the same or similar beneficial effects.
Referring to fig. 4, fig. 4 is another structural diagram of an HTTP request processing apparatus according to an embodiment of the present invention, and on the basis of the embodiment of fig. 3, the apparatus further includes:
an error information returning module 401, configured to return error information to the client if the determination result of the interface data determining module 302 is negative.
Optionally, the HTTP request processing apparatus according to the embodiment of the present invention further includes:
and the interface data storage module is used for acquiring each interface data corresponding to the category corresponding to each HTTP request in the RPC server during initialization and storing each interface data to the local.
Optionally, in the HTTP request processing apparatus according to the embodiment of the present invention, the interface data includes: the method comprises a request identification, an input program corresponding to the request identification and an output program corresponding to the request identification, wherein the input program and the output program respectively comprise different program identifications.
Optionally, in the HTTP request processing apparatus according to the embodiment of the present invention, the RPC request obtaining and sending module is specifically configured to determine whether a request identifier that is the same as the request identifier in the UR L exists in the locally stored interface data, determine that interface data corresponding to the category corresponding to the HTTP request exists locally if the request identifier that is the same as the request identifier in the UR L exists in the locally stored interface data, and determine that interface data corresponding to the category corresponding to the HTTP request does not exist locally if the request identifier that is the same as the request identifier in the UR L does not exist in the locally stored interface data.
An embodiment of the present invention further provides an electronic device, referring to fig. 5, where fig. 5 is a structural diagram of the electronic device according to the embodiment of the present invention, including: the system comprises a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502 and the memory 503 are communicated with each other through the communication bus 504;
a memory 503 for storing a computer program;
the processor 501 is configured to implement the steps of any HTTP request processing method in the above embodiments when executing the program stored in the memory 503.
It should be noted that the communication bus 504 mentioned in the electronic device may be a PCI (peripheral component Interconnect) bus, an EISA (Extended Industry standard architecture) bus, or the like. The communication bus 504 may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 5, but this is not intended to represent only one bus or type of bus.
The communication interface 502 is used for communication between the above-described electronic apparatus and other apparatuses.
The Memory 503 may include a RAM (Random Access Memory) and a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The processor 501 may be a general-purpose processor, including: a CPU (Central Processing Unit), an NP (Network Processor), and the like; but also a DSP (Digital signal processing), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
As can be seen from the above, in the electronic device according to the embodiment of the present invention, the processor executes the program stored in the memory, so that after receiving the HTTP request sent by the client, it is determined whether interface data corresponding to the category corresponding to the HTTP request exists locally, if interface data corresponding to the category corresponding to the HTTP request exists locally, the parameter in the UR L included in the HTTP request is input into the input program of the interface data to obtain the RPC request corresponding to the HTTP request, the RPC request is sent to the RPC server, the RPC request result returned by the RPC server is received, the RPC request result is analyzed by the output program of the interface data, and the analyzed RPC request result is returned to the client.
In yet another embodiment provided by the present invention, a computer-readable storage medium is further provided, which stores instructions that, when executed on a computer, cause the computer to perform any of the HTTP request processing method steps in the above embodiments.
When the instructions stored in the computer-readable storage medium of the embodiment of the invention run on a computer, whether interface data corresponding to the category corresponding to the HTTP request exists locally or not can be judged after the HTTP request sent by a client is received, if the interface data corresponding to the category corresponding to the HTTP request exists locally, the parameters in UR L in the HTTP request are input into an input program of the interface data to obtain an RPC request corresponding to the HTTP request, the RPC request is sent to an RPC server, the result of the RPC request returned by the RPC server is received, the result of the RPC request is analyzed through the output program of the interface data, and the analyzed result of the RPC request is returned to the client.
In a further embodiment provided by the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the steps of any of the HTTP request processing methods of the above embodiments.
It can be seen that when the computer program product of the embodiment of the present invention runs on a computer, it can determine whether interface data corresponding to a category corresponding to an HTTP request exists locally after receiving the HTTP request sent by a client, if interface data corresponding to a category corresponding to an HTTP request exists locally, input a parameter in UR L included in the HTTP request into an input program of the interface data to obtain an RPC request corresponding to the HTTP request, send the RPC request to an RPC server, receive an RPC request result returned by the RPC server, analyze the RPC request result through an output program of the interface data, and return the analyzed RPC request result to the client.
The computer instructions may be stored on or transmitted from one computer-readable storage medium to another computer-readable storage medium, e.g., from one website, computer, server, or data center via a wired (e.g., coaxial cable, fiber optic, digital subscriber line (DS L)) or wireless (e.g., infrared, wireless, microwave, etc.) manner, the computer-readable storage medium may be any available medium that can be accessed by the computer or an integrated Solid State medium containing one or more data centers, e.g., magnetic storage media, optical storage media.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the embodiments of the HTTP requesting apparatus, the electronic device and the readable storage medium, since they are substantially similar to the embodiments of the method, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the embodiments of the method.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (9)

1. A hypertext transfer protocol (HTTP) request processing method is applied to an HTTP server, and comprises the following steps:
receiving an HTTP request sent by a client;
judging whether interface data corresponding to the category corresponding to the HTTP request exists locally;
if interface data corresponding to the category corresponding to the HTTP request exist locally, inputting parameters in a uniform resource locator UR L included in the HTTP request into an input program of the interface data to obtain a Remote Procedure Call (RPC) request corresponding to the HTTP request, and sending the RPC request to an RPC server;
receiving an RPC request result returned by the RPC server, and analyzing the RPC request result through an output program of the interface data;
and returning the analyzed RPC request result to the client.
2. The HTTP request processing method according to claim 1, further comprising, before the receiving of the HTTP request sent by the client:
and during initialization, acquiring interface data corresponding to the category corresponding to each HTTP request in the RPC server, and storing the interface data to the local.
3. The HTTP request processing method according to claim 1, further comprising:
and if the interface data corresponding to the category corresponding to the HTTP request do not exist locally, returning error information to the client.
4. The HTTP request processing method according to claim 1, wherein the interface data includes: the method comprises the steps of requesting identification, an input program corresponding to the requesting identification and an output program corresponding to the requesting identification, wherein the input program and the output program respectively comprise different program identifications;
the judging whether the interface data corresponding to the category corresponding to the HTTP request exists locally comprises the following steps:
judging whether a request identifier identical to the request identifier in the UR L exists in the locally stored interface data;
if the request identifier which is the same as the request identifier in the UR L exists in the locally stored interface data, determining that the interface data corresponding to the category corresponding to the HTTP request exists locally;
and if the request identifier which is the same as the request identifier in the UR L does not exist in the locally stored interface data, determining that the interface data corresponding to the category corresponding to the HTTP request does not exist locally.
5. An HTTP request processing apparatus, comprising:
the HTTP request receiving module is used for receiving an HTTP request sent by a client;
the interface data judgment module is used for judging whether the interface data corresponding to the category corresponding to the HTTP request exists locally;
the RPC request obtaining and sending module is used for inputting the parameters in the uniform resource locator UR L included in the HTTP request into an input program of the interface data when the judgment result of the interface data judgment module is yes, obtaining a Remote Procedure Call (RPC) request corresponding to the HTTP request, and sending the RPC request to an RPC server;
the RPC request result analyzing module is used for receiving the RPC request result returned by the RPC server and analyzing the RPC request result through an output program of the interface data;
and the request result sending module is used for returning the analyzed RPC request result to the client.
6. The HTTP request processing apparatus according to claim 5, further comprising:
and the interface data storage module is used for acquiring each interface data corresponding to the category corresponding to each HTTP request in the RPC server during initialization and storing each interface data to the local.
7. The HTTP request processing apparatus according to claim 5, further comprising:
and the error information returning module is used for returning error information to the client when the judgment result of the interface data judging module is negative.
8. The HTTP request processing apparatus according to claim 5, wherein the interface data includes: the method comprises the steps of requesting identification, an input program corresponding to the requesting identification and an output program corresponding to the requesting identification, wherein the input program and the output program respectively comprise different program identifications;
the RPC request obtaining and sending module is specifically configured to determine whether a request identifier identical to the request identifier in the UR L exists in locally stored interface data, determine that interface data corresponding to the category corresponding to the HTTP request exists locally if the request identifier identical to the request identifier in the UR L exists in locally stored interface data, and determine that interface data corresponding to the category corresponding to the HTTP request does not exist locally if the request identifier identical to the request identifier in the UR L does not exist in locally stored interface data.
9. An electronic device, comprising: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
the memory is used for storing a computer program;
the processor is configured to implement the HTTP request processing method steps according to any one of claims 1 to 4 when executing the program stored in the memory.
CN201710799249.7A 2017-09-07 2017-09-07 HTTP request processing method and device and electronic equipment Active CN107360261B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710799249.7A CN107360261B (en) 2017-09-07 2017-09-07 HTTP request processing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710799249.7A CN107360261B (en) 2017-09-07 2017-09-07 HTTP request processing method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN107360261A CN107360261A (en) 2017-11-17
CN107360261B true CN107360261B (en) 2020-07-10

Family

ID=60291330

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710799249.7A Active CN107360261B (en) 2017-09-07 2017-09-07 HTTP request processing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN107360261B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108228365B (en) * 2017-12-28 2021-04-06 杭州马猴烧韭科技有限公司 Function request sending method, function request calling method and device
CN109992396B (en) * 2017-12-29 2021-03-19 杭州海康威视数字技术股份有限公司 Load control method and device, electronic equipment and distributed file system
CN110704200A (en) * 2018-07-09 2020-01-17 北京京东尚科信息技术有限公司 Method and device for converting call interface
CN111045833A (en) * 2018-10-15 2020-04-21 北京京东尚科信息技术有限公司 Interface calling method and device
CN109634752B (en) * 2018-10-26 2021-03-02 北京市天元网络技术股份有限公司 Client request processing method and system based on page gateway
CN109714332B (en) * 2018-12-26 2021-03-23 北京字节跳动网络技术有限公司 Protocol conversion method and device based on Thrift and syntax tree analysis
CN110191164B (en) * 2019-05-20 2022-03-22 中国工商银行股份有限公司 Distributed service access system and method
CN110798380B (en) * 2019-10-23 2021-08-20 北京奇艺世纪科技有限公司 Data acquisition method, system, device, test equipment and test server
CN111782306A (en) * 2020-06-30 2020-10-16 平安银行股份有限公司 Interface calling information processing method and device, electronic equipment and storage medium
CN112506679A (en) * 2020-12-17 2021-03-16 中国联合网络通信集团有限公司 RPC service calling method and equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103283209A (en) * 2011-04-18 2013-09-04 北京新媒传信科技有限公司 Application service platform system and implementation method thereof
CN105468709A (en) * 2015-11-19 2016-04-06 中国建设银行股份有限公司 Data inquiry device and data inquiry method based on HBase
CN106856434A (en) * 2015-12-08 2017-06-16 阿里巴巴集团控股有限公司 The method and apparatus of access request conversion
CN106941532A (en) * 2017-03-30 2017-07-11 北京奇艺世纪科技有限公司 A kind of data transmission method and device applied to distributed system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10003629B2 (en) * 2013-05-13 2018-06-19 Arista Networks, Inc. Method and system for using JSON with a CLI for managing network devices

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103283209A (en) * 2011-04-18 2013-09-04 北京新媒传信科技有限公司 Application service platform system and implementation method thereof
CN105468709A (en) * 2015-11-19 2016-04-06 中国建设银行股份有限公司 Data inquiry device and data inquiry method based on HBase
CN106856434A (en) * 2015-12-08 2017-06-16 阿里巴巴集团控股有限公司 The method and apparatus of access request conversion
CN106941532A (en) * 2017-03-30 2017-07-11 北京奇艺世纪科技有限公司 A kind of data transmission method and device applied to distributed system

Also Published As

Publication number Publication date
CN107360261A (en) 2017-11-17

Similar Documents

Publication Publication Date Title
CN107360261B (en) HTTP request processing method and device and electronic equipment
CN107835178B (en) Multi-protocol service communication method and device and electronic equipment
CN108156022B (en) Service calling method and device and electronic equipment
CN109635019B (en) Request processing method, device, equipment and storage medium
JP2022523914A (en) Methods, systems and computer readable media for data conversion using the Representational State Transfer (REST) application programming interface (API).
CN103873918A (en) Picture processing method, device and terminal
CN108363588B (en) Method for realizing interaction between web and native function, electronic device and readable storage medium
CN114866965A (en) MaaP-based 5G message communication method, system, electronic equipment and storage medium
CN112232794A (en) Payment method and device, storage medium and electronic equipment
CN114598750B (en) Data request processing method, device and storage medium
CN112261111A (en) Method and system for realizing cross-domain access of browser in application program
CN101916283B (en) Method for acquiring link information from dynamic webpage and server thereof
CN112468585B (en) Data transmission method and device, electronic equipment and storage medium
CN109446445B (en) Resource acquisition method and device
CN104954363A (en) Method and device for generating interface document
CN114040032A (en) Protocol conversion method, system, storage medium and electronic equipment
CN114675982A (en) General method and system for acquiring data of service integration system
CN109981546B (en) Method and device for acquiring remote call relation between application modules
CN111338928A (en) Chrome-based browser testing method and device
US20110320527A1 (en) Method and system for managing a web-domain request
WO2015192497A1 (en) Communication link sending method and apparatus, and terminal
CN112000313A (en) Request response method, device, equipment and storage medium
CN112650601B (en) Method, apparatus, device, storage medium, and program for opening applet across hosts
CN110955430A (en) Application program native capability calling method and device and electronic equipment
CN110738982B (en) Request processing method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant