CN113162998B - Intelligent interactive communication method and communication system - Google Patents

Intelligent interactive communication method and communication system Download PDF

Info

Publication number
CN113162998B
CN113162998B CN202110373229.XA CN202110373229A CN113162998B CN 113162998 B CN113162998 B CN 113162998B CN 202110373229 A CN202110373229 A CN 202110373229A CN 113162998 B CN113162998 B CN 113162998B
Authority
CN
China
Prior art keywords
url address
request
server
service
path corresponding
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
CN202110373229.XA
Other languages
Chinese (zh)
Other versions
CN113162998A (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.)
Guangzhou Xuanshi Intelligent Technology Co ltd
Original Assignee
Guangzhou Xuanshi Intelligent 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 Guangzhou Xuanshi Intelligent Technology Co ltd filed Critical Guangzhou Xuanshi Intelligent Technology Co ltd
Priority to CN202110373229.XA priority Critical patent/CN113162998B/en
Publication of CN113162998A publication Critical patent/CN113162998A/en
Application granted granted Critical
Publication of CN113162998B publication Critical patent/CN113162998B/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]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/30Network architectures or network communication protocols for network security for supporting lawful interception, monitoring or retaining of communications or communication related information
    • H04L63/306Network architectures or network communication protocols for network security for supporting lawful interception, monitoring or retaining of communications or communication related information intercepting packet switched data communications, e.g. Web, Internet or IMS communications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/146Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding

Abstract

The embodiment of the invention relates to the technical field of communication, and discloses an intelligent interactive communication method and a communication system, wherein the method comprises the following steps: after the URL address information on the two-dimensional code is acquired, analyzing the URL address information to acquire a URL address path corresponding to the request; establishing communication connection with a server to send HTTP message data; controlling the server to distribute service data to the service processor through the Web route according to the URL address path corresponding to the request; the service data is obtained after the server analyzes HTTP message data; and acquiring a service processing result of the service processor. By implementing the embodiment of the invention, the network request can be efficiently processed, and too many system resources are not occupied.

Description

Intelligent interactive communication method and communication system
Technical Field
The present invention relates to the field of communications technologies, and in particular, to an intelligent interactive communication method and a communication system.
Background
At present, most of common communication system applications in the market are based on internet for data interactive communication, namely, interactive communication with a server is required. However, in practice, it is found that most of the conventional Web service programs need to be installed in a communication system and run by a system attached to the communication system, and since the RAM storage capacity of the communication system is limited (generally, between 1G and 3G, the system core service and the system program are removed, and the remaining available memory is relatively small), the operation speed of the communication system is easily influenced to some extent.
Disclosure of Invention
The embodiment of the invention discloses an intelligent interactive communication method and a communication system, which can efficiently process network requests and do not occupy too many system resources.
The first aspect of the embodiment of the invention discloses an intelligent interactive communication method, which comprises the following steps: after URL address information on the two-dimensional code is acquired, the URL address information is analyzed to acquire a URL address path corresponding to the request;
establishing communication connection with a server to send HTTP message data;
controlling the server to distribute service data to a service processor through a Web route according to the URL address path corresponding to the request; the service data is obtained after the server analyzes the HTTP message data;
and acquiring a service processing result of the service processor.
As another optional implementation manner, in the first aspect of the embodiment of the present invention, the controlling, according to the URL address path corresponding to the request, the server to distribute service data to the service processor through a Web route includes:
matching the URL address path corresponding to the request with a mapping path on an interceptor routing table; if the matching is successful, controlling the service end to distribute the service data to the interceptor;
if the URL address path corresponding to the request is unsuccessfully matched with the mapping path on the interceptor routing table, matching the URL address path corresponding to the request with the mapping path on the controller routing table; and if the matching is successful, controlling the server to distribute the service data to the controller.
As another optional implementation, in the first aspect of the embodiment of the present invention, the method further includes:
if the URL address path corresponding to the request is unsuccessfully matched with the mapping path on the controller routing table, matching the URL address path corresponding to the request with a file path in a specified local disk directory;
and if the matching is successful, acquiring the data information in the file path as the service processing result.
As another optional implementation manner, in the first aspect of the embodiment of the present invention, after acquiring URL address information on a two-dimensional code, before analyzing the URL address information to acquire a URL address path corresponding to a request, the method further includes:
mapping the classes of the interceptor and the controller annotations in the scanning packet to a Hash routing table respectively by adopting an annotation and reflection mode; the Hash routing table at least contains an interceptor routing table and a controller routing table;
and starting HTTP service to monitor the request sent by the two-dimension code.
As another optional implementation, in the first aspect of the embodiment of the present invention, the method further includes:
if the response signal of the received service processing result is lower than the specified times, determining that the current connection is not a long connection state;
and disconnecting the connection with the server.
A second aspect of the embodiments of the present invention discloses a communication system, including:
the analysis unit is used for analyzing the URL address information to obtain a URL address path corresponding to the request after the URL address information on the two-dimensional code is obtained;
the connection unit is used for establishing communication connection with the server side so as to send HTTP message data;
the control unit is used for controlling the server to distribute service data to the service processor through Web routing according to the URL address path corresponding to the request; the service data is obtained after the server analyzes the HTTP message data;
and the acquisition unit is used for acquiring the data information in the file path as the service processing result.
As an optional implementation manner, in a second aspect of the embodiment of the present invention, the control unit includes:
the first matching subunit is used for matching the URL address path corresponding to the request with a mapping path on an interceptor routing table;
the first control subunit is configured to control the server to distribute the service data to the interceptor when the first matching subunit successfully matches the URL address path corresponding to the request with the mapping path on the interceptor routing table;
the second matching subunit is configured to match the URL address path corresponding to the request with the mapping path on the controller routing table when the first matching subunit unsuccessfully matches the URL address path corresponding to the request with the mapping path on the interceptor routing table;
and the second control subunit is configured to control the server to distribute the service data to the controller when the second matching subunit successfully matches the URL address path corresponding to the request with the mapping path on the controller routing table.
As an optional implementation manner, in the second aspect of the embodiment of the present invention, the control unit further includes:
the third matching subunit is configured to match the URL address path corresponding to the request with a file path in a specified local disk directory when the second matching subunit unsuccessfully matches the URL address path corresponding to the request with a mapping path on a controller routing table;
and the obtaining subunit is configured to obtain the data information in the file path when the third matching subunit successfully matches the URL address path corresponding to the request with the file path in the specified local disk directory.
A third aspect of the present invention discloses a communication system, including:
a memory storing executable program code;
a processor coupled with the memory;
the processor calls the executable program code stored in the memory to execute the intelligent interactive communication method disclosed by the first aspect of the embodiment of the invention.
A fourth aspect of the embodiments of the present invention discloses a computer-readable storage medium storing a computer program, where the computer program enables a computer to execute an intelligent interactive communication method disclosed in the first aspect of the embodiments of the present invention.
A fifth aspect of embodiments of the present invention discloses a computer program product, which, when running on a computer, causes the computer to execute part or all of the steps of any one of the intelligent interactive communication methods of the first aspect.
A sixth aspect of the present invention discloses an application publishing platform, where the application publishing platform is configured to publish a computer program product, where when the computer program product runs on a computer, the computer is enabled to execute part or all of the steps of any one of the intelligent interactive communication methods in the first aspect.
Compared with the prior art, the embodiment of the invention has the following beneficial effects:
in the embodiment of the invention, after the URL address information on the two-dimensional code is acquired, the communication system can analyze the URL address information to acquire a URL address path corresponding to a request, and establish communication connection with a server to send HTTP message data, and then can control the server to distribute service data to a service processor through Web routing according to the URL address path corresponding to the request; and finally, acquiring a service processing result of the service processor. Therefore, the embodiment of the invention can efficiently process the network request and does not occupy too many system resources.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a flow chart of an intelligent interactive communication method disclosed by the embodiment of the invention;
FIG. 2 is a flow chart of another intelligent interactive communication method disclosed by the embodiment of the invention;
fig. 3 is a schematic structural diagram of a communication system according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of another communication system disclosed in the embodiment of the invention;
fig. 5 is a schematic structural diagram of another communication system disclosed in the embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
It should be noted that the terms "first", "second", "third", "fourth", and the like in the description and the claims of the present invention are used for distinguishing different objects, and are not used for describing a specific order. The terms "comprises," "comprising," and any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, communication system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The embodiment of the invention discloses an intelligent interactive communication method and a communication system.
Example one
Referring to fig. 1, fig. 1 is a schematic flow chart of an intelligent interactive communication method according to an embodiment of the present invention. As shown in fig. 1, the intelligent interactive communication method may include the following steps.
101. After the communication system acquires the URL address information on the two-dimensional code, the communication system analyzes the URL address information to acquire a URL address path corresponding to the request.
As an alternative implementation manner, in the embodiment of the present invention, the requested URL address information may represent an address of a website, and there may be no parameter or may be passed? And add key-value pairs, the length of a URL typically cannot exceed 2048 characters, i.e., 2KB, beyond which the server may not recognize.
102. The communication system establishes communication connection with the server side to send HTTP message data.
As an optional implementation manner, in the embodiment of the present invention, the mobile terminal may send URL address information through the two-dimensional code to send a request, and after receiving the URL address information, the communication system may resolve an IP address corresponding to a domain name of a server address, and initiate a "TCP three-way handshake" to the server address to establish a communication connection;
and after the TCP communication connection is established with the server, the communication system can send an Http request message to the server through the TCPTCP communication connection.
As an optional implementation manner, in the embodiment of the present invention, the HTTP protocol of the present application is based on a TCP protocol, and is transmitted through the TCP protocol, and the protocols have certain specification standards, so long as the protocols all conform to the standards, the server and the browser can communicate with each other.
As an optional implementation manner, in the embodiment of the present invention, by using a "TCP three-way handshake" to establish a communication connection with a server, an expired link can be prevented from being retransmitted to a connected host.
For example, the first handshake: the client sends syn to the server, waiting for the server to acknowledge. (syn ═ x); second handshake: the server receives the syn packet, must confirm syn (ack ═ x +1) of the customer end, send one own syn packet syn ═ y at the same time; third handshake: and after receiving the syn + ack, the client sends an acknowledgement packet ack (y +1) to the server again, and after sending, the three-way handshake is completed to establish connection.
103. The communication system controls the server to distribute service data to the service processor through Web routing according to the URL address path corresponding to the request; the service data is obtained after the server analyzes the HTTP message data.
As an alternative implementation manner, in the embodiment of the present invention, the communication system may have a load balancing device to equally distribute the requests of all users, that is, to perform balanced sharing of the work tasks on multiple service processors, such as a picture server, an application server, and the like.
104. The communication system obtains a service processing result of the service processor.
As an optional implementation manner, in the embodiment of the present invention, after receiving the Http message, the server may analyze the content of the Http message, perform related service processing, and finally, the server may encapsulate the processing result into the Http message and send the Http message back to the communication system through the current TCP connection;
and after receiving the Http message of the server, the communication system can analyze the Http message and perform further rendering presentation according to the specific message content.
As an optional implementation manner, in the embodiment of the present invention, the Netty framework may be used to establish communication of the Http protocol, and Netty is a java open source framework provided by JBOSS, and an asynchronous, event-driven, high-performance network programming framework is provided based on NIO, by which the present application may establish communication of the Http protocol and further develop related functions for processing Http messages.
As an optional implementation manner, in the embodiment of the present invention, in the present application, the Http packet is mainly processed by the Http processor, and the received packet is not complete and is often only a part of the whole packet, and generally, the header of the Response or Request is first followed by the body (the body may also be divided into multiple parts);
and, taking decoding Raw data (generally referred to as data types of Text, JavaScript, Json, HTML, XML, and the like) as an example, chunk data needs to be received and cached in a memory one by one (certainly, caching can be selected and then stored in a disk), and when the last chunk is received, it represents that the current Http message is completely received successfully, and the route is entered and is waited to be further processed by a related controller.
As an alternative implementation, in the embodiment of the present invention, the form processing manner is relatively complex, but the main principle is also the same, and the form is received and processed block by block, and finally the synthesized data is handed to the routing distribution.
As an optional implementation mode, in the embodiment of the invention, the network request can be efficiently processed, and not too much system resources are occupied, compared with the situation that the traditional web service requires various environments (such as PHP, Tomcat, Apache, Nginx and Mysql), the method can integrate the service into an Android application program, does not need to install and configure the environment required by operation in the system, can map the service to an external network in a route mapping manner according to the requirement so as to build a miniature web server, and can also be used in a local area network in the environment without the external network.
As an optional implementation manner, in the embodiment of the present invention, the application can be integrated in an Android application program in an SDK manner for secondary development.
As an optional implementation manner, in the embodiment of the present invention, the application aims to implement that a web service on a cloud server is placed on an android tv board card to run, so as to implement local code scanning and sharing of this specific service.
Therefore, the intelligent interactive communication method described in fig. 1 can be implemented to efficiently process network requests without occupying too many system resources.
In addition, by implementing the intelligent interactive communication method described in fig. 1, the web service can be built on the Android without running other programs.
In addition, implementing the intelligent interactive communication method described in fig. 1 can implement local code scanning sharing for this specific service.
Example two
Referring to fig. 2, fig. 2 is a schematic flow chart of another intelligent interactive communication method according to an embodiment of the present invention. As shown in fig. 2, the intelligent interactive communication method may include the steps of:
201. the communication system respectively maps the classes of the interceptor and the controller annotations in the scanning packet to a Hash routing table in an annotation and reflection mode; the Hash routing table at least contains an interceptor routing table and a controller routing table.
As an optional implementation manner, in the embodiment of the present invention, because the request of the user varies, it is not enough that the traditional method only receives the Http message, but the method for requesting to upload the file, requesting to access the static resource, requesting to obtain the dynamic data by the api, and the like, and the method for requesting at the same time are different, and the requesting method may include Get, Post, Put, DELETE, and the like;
and the application needs to distinguish the requests and distribute the requests to corresponding controllers to use the routes, and for the convenience of subsequent development, the application can use a comment plus reflection mode to scan the relevant classes in the packet and map the classes into the hash routing table.
202. The communication system starts HTTP service to monitor the request sent by the two-dimension code.
As an optional implementation manner, in the embodiment of the present invention, the logic of the controller is more complex, all methods under the controller need to be scanned, and annotations on each method need to be read, a merging process needs to be performed on the RequestMapping parameters in the controller and the controller method during mapping, and after the mapping is completed, the Http service is started to listen to the request sent by the client.
203. After the communication system acquires the URL address information on the two-dimensional code, the communication system analyzes the URL address information to acquire a URL address path corresponding to the request.
204. The communication system establishes communication connection with the server side to send HTTP message data.
205. The communication system matches the URL address path corresponding to the request with the mapping path on the interceptor routing table, if the matching is successful, step 206 is executed, and if the matching is unsuccessful, step 207 is executed.
206. The communication system controls the service end to distribute the service data to the interceptor and executes step 211 to step 213.
207. The communication system matches the URL address path corresponding to the request with the mapping path on the controller routing table, if the matching is successful, step 208 is executed, and if the matching is unsuccessful, step 209 is executed.
208. The communication system controls the server to distribute the service data to the controller, and executes step 211 to step 213.
209. The communication system matches the URL address path corresponding to the request with the file path in the specified local disk directory, if the matching is successful, step 210 is executed, and if the matching is unsuccessful, the process is ended.
210. The communication system acquires the data information in the file path as a service processing result and executes steps 212 to 213.
As an optional implementation manner, in the embodiment of the present invention, after receiving the request, the communication system may match the path of the request with the routing table of the interceptor, and if the path of the request is matched with the routing table of the interceptor, the request may be first sent to the interceptor for processing;
and if the request is not intercepted, the request is matched with a controller routing table (including a regular routing table), and if the request is matched with the regular routing table, the request is handed to a corresponding controller method for processing, so that the processing of the dynamic request is realized.
As an alternative implementation, in the embodiment of the present invention, if nothing matches, an attempt is made to match a file in the specified local disk directory, and if found, the data returned to the file implements the processing of a static request.
As an alternative implementation, in the present example, this may be more performance consuming than if-else, but more decoupled, and is very advantageous for subsequent development.
211. The communication system obtains a service processing result of the service processor.
212. And if the response signal of the received service processing result is less than the specified times, the communication system determines that the current connection is not the long connection state.
213. The communication system disconnects from the server.
As an alternative implementation, in the embodiment of the present invention, if the current connection is not a "long connection", the server closes the connection (initiate "TCP 4 waving"), otherwise, the connection of TCP is maintained.
As an optional implementation manner, in the embodiment of the present invention, the two-dimensional code sharing Web end and the back end API are designed in a manner of separating a front end from a back end, the Web end is connected to the back end interface API to implement service logic interaction, the Web page of the Web end is stored in a static file, the API implements the controller by using the above-described method, and the database part is implemented by using an SQLite database of the Android and stores data.
Therefore, the intelligent interactive communication method described in fig. 2 can be implemented to efficiently process network requests without occupying too many system resources.
In addition, the intelligent interactive communication method described in fig. 2 can be more energy-consuming than if-else, but is more decoupling, which is very beneficial for subsequent development.
EXAMPLE III
Referring to fig. 3, fig. 3 is a schematic structural diagram of a communication system according to an embodiment of the present invention. As shown in fig. 3, the communication system 300 may include a parsing unit 301, a connection unit 302, a control unit 303, and an obtaining unit 304, wherein:
the analyzing unit 301 is configured to, after acquiring the URL address information on the two-dimensional code, analyze the URL address information to acquire a URL address path corresponding to the request.
A connection unit 302, configured to establish a communication connection with the server to send HTTP message data.
A control unit 303, configured to control the server to distribute service data to the service processor through a Web route according to the URL address path corresponding to the request; the service data is obtained after the server analyzes the HTTP message data.
An obtaining unit 304, configured to obtain a service processing result of the service processor.
As an alternative implementation manner, in the embodiment of the present invention, the requested URL address information may represent an address of a website, and there may be no parameter or may be passed? And add key-value pairs, the length of a URL typically cannot exceed 2048 characters, i.e., 2KB, beyond which the server may not recognize.
As an optional implementation manner, in the embodiment of the present invention, the mobile terminal may send URL address information through a two-dimensional code to send a request, after receiving the URL address information, the parsing unit 301 may parse an IP address corresponding to a domain name of a server address, and then the connection unit 302 may initiate a "TCP three-way handshake" to the server address to establish a communication connection;
and after establishing a TCP communication connection with the server, the connection unit 302 may send an Http request message to the server through the TCPTCP communication connection.
As an optional implementation manner, in the embodiment of the present invention, the HTTP protocol of the present application is based on a TCP protocol, and is transmitted through the TCP protocol, and the protocols have certain specification standards, so long as the protocols all conform to the standards, the server and the browser can communicate with each other.
As an optional implementation manner, in the embodiment of the present invention, the connection unit 302 establishes a communication connection with the server through a "TCP three-way handshake", so as to prevent an expired link from being retransmitted to the connected host.
For example, the first handshake: the client sends syn to the server, waiting for the server to acknowledge. (syn ═ x); second handshake: the server receives the syn packet, must confirm syn (ack ═ x +1) of the customer end, send one own syn packet syn ═ y at the same time; third handshake: and after receiving the syn + ack, the client sends an acknowledgement packet ack (y +1) to the server again, and after sending, the three-way handshake is completed to establish connection.
As an alternative implementation manner, in the embodiment of the present invention, the communication system may have a load balancing device to equally distribute the requests of all users, that is, to perform balanced sharing of the work tasks on multiple service processors, such as a picture server, an application server, and the like.
As an optional implementation manner, in the embodiment of the present invention, after receiving the Http message, the server may analyze the content of the Http message, perform related service processing, and finally, the server may encapsulate the processing result into the Http message and send the Http message back to the communication system through the current TCP connection;
and after the obtaining unit 304 receives the Http message from the server, the parsing unit 301 may further parse the Http message and render the Http message according to the specific message content.
As an optional implementation manner, in the embodiment of the present invention, the application may use a Netty framework to establish communication of the Http protocol, where Netty is a java open source framework provided by JBOSS, and provides an asynchronous, event-driven, high-performance network programming framework based on NIO, and the application may establish communication of the Http protocol by using the framework and further develop related functions for processing Http messages.
As an optional implementation manner, in the embodiment of the present invention, in the present application, the Http packet is mainly processed by the Http processor, and the received packet is not complete and is often only a part of the whole packet, and generally, the header of the Response or Request is first followed by the body (the body may also be divided into multiple parts);
and, taking decoding Raw data (generally referred to as data types of Text, JavaScript, Json, HTML, XML, and the like) as an example, chunk data needs to be received and cached in a memory one by one (certainly, caching can be selected and then stored in a disk), and when the last chunk is received, it represents that the current Http message is completely received successfully, and the route is entered and is waited to be further processed by a related controller.
As an alternative implementation, in the embodiment of the present invention, the form processing manner is relatively complex, but the main principle is also the same, and the form is received and processed block by block, and finally the synthesized data is handed to the routing distribution.
As an optional implementation mode, in the embodiment of the invention, the network request can be efficiently processed, and not too much system resources are occupied, compared with the difference that the traditional web service requires various environments (such as PHP, Tomcat, Apache, Nginx and Mysql), the service can be integrated into an Android application program, the environment required by operation does not need to be installed and configured in the system, the service can be mapped to an external network through a route mapping mode according to the requirement so as to build a miniature web server, and the service can also be used in a local area network under the environment without the external network.
As an optional implementation manner, in the embodiment of the present invention, the application can be integrated in an Android application program in an SDK manner for secondary development.
As an optional implementation manner, in the embodiment of the present invention, the application aims to implement that a web service on a cloud server is placed on an android tv board card to run, so as to implement local code scanning and sharing of this specific service.
It can be seen that the communication system described in fig. 3 is implemented to efficiently process network requests without occupying too many system resources.
In addition, by implementing the communication system described in fig. 3, it is possible to build a web service on Android without running other programs.
In addition, implementing the communication system described in fig. 3 enables local code scanning sharing of this particular service.
Example four
Referring to fig. 4, fig. 4 is a schematic structural diagram of another communication system according to an embodiment of the present invention. The communication system shown in fig. 4 is optimized from the communication system shown in fig. 3. Compared to the communication system shown in fig. 3, the control unit 303 shown in fig. 4 may include:
a first matching subunit 3031, configured to match the URL address path corresponding to the request with the mapping path on the interceptor routing table;
the first control subunit 3032 is configured to control the server to distribute the service data to the interceptor when the first matching subunit 3031 successfully matches the URL address path corresponding to the request with the mapping path on the interceptor routing table;
a second matching subunit 3033, configured to match the URL address path corresponding to the request with the mapping path on the controller routing table when the first matching subunit 3031 unsuccessfully matches the URL address path corresponding to the request with the mapping path on the interceptor routing table;
and the second control sub-unit 3034 is configured to control the server to distribute the service data to the controller when the second matching sub-unit 3033 successfully matches the URL address path corresponding to the request with the mapping path on the controller routing table.
As an optional implementation manner, in this embodiment of the present invention, after receiving the request, the first matching subunit 3031 may match the requested path with the interceptor routing table, and if the first matching subunit 3032 matches the requested path, the first matching subunit 3031 may deliver the request to the interceptor to be processed first;
and, if the request is not intercepted, the second matching subunit 3033 may match the path of the request with a controller routing table (including a regular routing table), and if the path of the request matches with the controller routing table, the second matching subunit 3034 may submit the request to a corresponding controller method for processing, thereby implementing processing of the dynamic request.
Compared to the communication system shown in fig. 3, the control unit 303 shown in fig. 4 may further include:
a third matching sub-unit 3035, configured to match the URL address path corresponding to the request with the file path in the specified local disk directory when the second matching sub-unit 3033 unsuccessfully matches the URL address path corresponding to the request with the mapping path on the controller routing table;
the obtaining sub-unit 3036 is configured to obtain the data information in the file path when the third matching sub-unit 3035 successfully matches the URL address path corresponding to the request with the file path in the specified local disk directory.
As an optional implementation manner, in this embodiment of the present invention, if the second matching sub-unit 3033 does not match anything, the third matching sub-unit 3035 may attempt to match the requested path with a file in the specified local disk directory, and if found, the data returned to the file implements the processing of the static request.
As an alternative implementation, in the present example, this may be more performance consuming than if-else, but more decoupled, and is very advantageous for subsequent development.
Compared to the communication system shown in fig. 3, the communication system shown in fig. 4 may further include:
a mapping unit 305, configured to map, before the parsing unit 301 parses the URL address information to obtain a URL address path corresponding to the request, classes of interceptor and controller annotations in the scan packet to the hash routing table respectively in an annotation plus reflection manner; the Hash routing table at least comprises an interceptor routing table and a controller routing table.
As an optional implementation manner, in the embodiment of the present invention, because the request of the user varies, it is not enough that the traditional method only receives the Http message, but the method for requesting to upload the file, requesting to access the static resource, requesting to obtain the dynamic data by the api, and the like, and the method for requesting at the same time are different, and the requesting method may include Get, Post, Put, DELETE, and the like;
and the application needs to distinguish the requests and distribute the requests to corresponding controllers to use the routes, and for the convenience of subsequent development, the application can use a comment plus reflection mode to scan the relevant classes in the packet and map the classes into the hash routing table.
The starting unit 306 is configured to start an HTTP service to monitor a request sent by the two-dimensional code.
As an optional implementation manner, in the embodiment of the present invention, the logic of the controller is more complex, all methods under the controller need to be scanned, and annotations on each method need to be read, a merging process needs to be performed on the RequestMapping parameters in the controller and the controller method during mapping, and after the mapping is completed, the Http service is started to listen to the request sent by the client.
Compared to the communication system shown in fig. 3, the communication system shown in fig. 4 may further include:
a determining unit 307, configured to determine that the current connection is not a long connection state if the response signal of the received service processing result is lower than a specified number of times;
and a disconnecting unit 308 for disconnecting the connection with the service end.
As an alternative implementation, in the embodiment of the present invention, if the current connection is not "long connection", the disconnection unit 308 closes the connection (initiates "TCP 4 waving"), otherwise, the connection of TCP is maintained.
As an optional implementation manner, in the embodiment of the present invention, the two-dimensional code sharing Web end and the back end API are designed in a manner of separating a front end from a back end, the Web end is connected to the back end interface API to implement service logic interaction, the Web page of the Web end is stored in a static file, the API implements the controller by using the above-described method, and the database part is implemented by using an SQLite database of the Android and stores data.
It can be seen that the communication system described in fig. 4 is implemented to efficiently process network requests without occupying too many system resources.
Furthermore, implementing the communication system described in fig. 4 can be more performance-consuming than if-else, but more decoupled, which is very advantageous for subsequent development.
EXAMPLE five
Referring to fig. 5, fig. 5 is a schematic structural diagram of another communication system according to an embodiment of the present invention. As shown in fig. 5, the communication system may include:
a memory 501 in which executable program code is stored;
a processor 502 coupled to a memory 501;
the processor 502 calls the executable program code stored in the memory 501 to execute any one of the intelligent interactive communication methods in fig. 1 to 4.
The embodiment of the invention discloses a computer-readable storage medium which stores a computer program, wherein the computer program enables a computer to execute any one of the intelligent interactive communication methods in the figures 1-2.
Embodiments of the present invention also disclose a computer program product, wherein, when the computer program product is run on a computer, the computer is caused to execute part or all of the steps of the method as in the above method embodiments.
It will be understood by those skilled in the art that all or part of the steps in the methods of the embodiments described above may be implemented by hardware instructions of a program, and the program may be stored in a computer-readable storage medium, where the storage medium includes Read-Only Memory (ROM), Random Access Memory (RAM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), One-time Programmable Read-Only Memory (OTPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Compact Disc Read-Only Memory (CD-ROM), or other disk memories, A tape memory, or any other medium readable by a computer that can be used to carry or store data.
The above detailed description is provided for an intelligent interactive communication method and a communication system disclosed in the embodiments of the present invention, and the principle and the implementation of the present invention are explained in detail by applying specific examples, and the description of the above embodiments is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (6)

1. An intelligent interactive communication method, comprising:
after URL address information on the two-dimensional code is acquired, the URL address information is analyzed to acquire a URL address path corresponding to the request;
establishing communication connection with a server to send HTTP message data;
controlling the server to distribute service data to a service processor through a Web route according to the URL address path corresponding to the request; the service data is obtained after the server analyzes the HTTP message data;
acquiring a service processing result of the service processor;
the controlling the server to distribute the service data to the service processor through the Web route according to the URL address path corresponding to the request includes:
matching the URL address path corresponding to the request with a mapping path on an interceptor routing table; if the matching is successful, controlling the service end to distribute the service data to the interceptor;
if the URL address path corresponding to the request is unsuccessfully matched with the mapping path on the interceptor routing table, matching the URL address path corresponding to the request with the mapping path on the controller routing table; and if the matching is successful, controlling the server to distribute the service data to the controller.
2. The method of claim 1, further comprising:
if the URL address path corresponding to the request is unsuccessfully matched with the mapping path on the controller routing table, matching the URL address path corresponding to the request with a file path in a specified local disk directory;
and if the matching is successful, acquiring the data information in the file path as the service processing result.
3. The method according to claim 2, wherein after the URL address information on the two-dimensional code is acquired, before the URL address information is parsed to acquire a URL address path corresponding to the request, the method further comprises:
mapping the classes of the interceptor and the controller annotations in the scanning packet to a Hash routing table respectively by adopting an annotation and reflection mode; the Hash routing table at least contains an interceptor routing table and a controller routing table;
and starting HTTP service to monitor the request sent by the two-dimension code.
4. The method according to any one of claims 1 to 3, further comprising:
if the response signal of the received service processing result is lower than the specified times, determining that the current connection is not a long connection state;
and disconnecting the connection with the server.
5. A communication system, the communication system comprising:
the analysis unit is used for analyzing the URL address information to obtain a URL address path corresponding to the request after the URL address information on the two-dimensional code is obtained;
the connection unit is used for establishing communication connection with the server side so as to send HTTP message data;
the control unit is used for controlling the server to distribute service data to the service processor through Web routing according to the URL address path corresponding to the request; the service data is obtained after the server analyzes the HTTP message data;
an obtaining unit, configured to obtain a service processing result of the service processor;
the control unit includes:
the first matching subunit is used for matching the URL address path corresponding to the request with a mapping path on an interceptor routing table;
the first control subunit is configured to control the server to distribute the service data to the interceptor when the first matching subunit successfully matches the URL address path corresponding to the request with the mapping path on the interceptor routing table;
the second matching subunit is configured to match the URL address path corresponding to the request with the mapping path on the controller routing table when the first matching subunit unsuccessfully matches the URL address path corresponding to the request with the mapping path on the interceptor routing table;
and the second control subunit is configured to control the server to distribute the service data to the controller when the second matching subunit successfully matches the URL address path corresponding to the request with the mapping path on the controller routing table.
6. The communication system according to claim 5, wherein the control unit further comprises:
the third matching subunit is configured to match the URL address path corresponding to the request with a file path in a specified local disk directory when the second matching subunit unsuccessfully matches the URL address path corresponding to the request with a mapping path on a controller routing table;
and the obtaining subunit is configured to obtain the data information in the file path when the third matching subunit successfully matches the URL address path corresponding to the request with the file path in the specified local disk directory.
CN202110373229.XA 2021-04-07 2021-04-07 Intelligent interactive communication method and communication system Active CN113162998B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110373229.XA CN113162998B (en) 2021-04-07 2021-04-07 Intelligent interactive communication method and communication system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110373229.XA CN113162998B (en) 2021-04-07 2021-04-07 Intelligent interactive communication method and communication system

Publications (2)

Publication Number Publication Date
CN113162998A CN113162998A (en) 2021-07-23
CN113162998B true CN113162998B (en) 2022-07-05

Family

ID=76888888

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110373229.XA Active CN113162998B (en) 2021-04-07 2021-04-07 Intelligent interactive communication method and communication system

Country Status (1)

Country Link
CN (1) CN113162998B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116760811B (en) * 2023-08-16 2023-11-03 中移(苏州)软件技术有限公司 HTTP data processing method, device and readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2011110110A1 (en) * 2010-08-02 2011-09-15 华为技术有限公司 Method, system and node device for establishing label switch path
CN107872437A (en) * 2016-09-27 2018-04-03 阿里巴巴集团控股有限公司 A kind of method, apparatus and server for service request
CN108234653A (en) * 2018-01-03 2018-06-29 马上消费金融股份有限公司 A kind of method and device of processing business request

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103903036A (en) * 2012-12-27 2014-07-02 史嫚嫚 High-capacity easily-updated two-dimensional code system
CN108769097A (en) * 2018-03-30 2018-11-06 中国科学院信息工程研究所 Support the content distribution network system of network-control
CN109040316B (en) * 2018-09-19 2021-08-27 天津字节跳动科技有限公司 HTTP service processing method and device
CN110012092A (en) * 2019-04-02 2019-07-12 上海卓繁信息技术股份有限公司 A kind of HTTP interface management method and device
CN112596932A (en) * 2021-01-04 2021-04-02 天冕信息技术(深圳)有限公司 Service registration and interception method and device, electronic equipment and readable storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2011110110A1 (en) * 2010-08-02 2011-09-15 华为技术有限公司 Method, system and node device for establishing label switch path
CN107872437A (en) * 2016-09-27 2018-04-03 阿里巴巴集团控股有限公司 A kind of method, apparatus and server for service request
CN108234653A (en) * 2018-01-03 2018-06-29 马上消费金融股份有限公司 A kind of method and device of processing business request

Also Published As

Publication number Publication date
CN113162998A (en) 2021-07-23

Similar Documents

Publication Publication Date Title
JP4363847B2 (en) Digital TV application protocol for interactive TV
CN106878460B (en) Communication processing method and device
EP2649500B1 (en) Methods and systems for accessing and controlling a remote desktop of a remote machine in real time by a web browser at a client device via http api utilizing a transcoding server
RU2689439C2 (en) Improved performance of web access
EP2649533B1 (en) Methods and systems for facilitating a remote desktop session utilizing long polling
US10958735B2 (en) Client connection method and system
WO2018001124A1 (en) Webpage file sending method, webpage rendering method and apparatus, and webpage rendering system
WO2015074459A1 (en) Method and apparatus for opening webpage, invoking client, and creating light app
CN110769009B (en) User identity authentication method and system
TW201929498A (en) Information transmission method and device
JP6093449B2 (en) Homepage forming method, peripheral device, and homepage forming system
CN108600377B (en) Method, device, terminal and storage medium for suspending file downloading
EP3896940A1 (en) Resource description file processing, and page resource obtaining method and device
CN113162998B (en) Intelligent interactive communication method and communication system
CN108600378B (en) File downloading method, device, terminal and storage medium
CN103905496A (en) Picture downloading method and device
US9754327B2 (en) Method and apparatus for configuring social networking site sharing functions
CN108989404B (en) Barrage message issuing method, server, system and storage medium
CN109005250B (en) Method and device for accessing server
CN109344351B (en) Webpage loading method, intermediate server and webpage loading system
CN113746851A (en) Agent system and method for supporting real-time analysis of GRPC request
CN113992641A (en) Data processing method, device, equipment and storage medium
CN106453573A (en) Method and system for processing CGI request in HTTP server
US10491654B2 (en) Communicating with a remote service through a hypertext transfer protocol (HTTP) session
JP2005327150A (en) Information delivery system and information delivery method

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