Disclosure of Invention
The invention provides a method, a device and a system for realizing data sharing access, which are used for solving the problems that in the prior art, a data user directly interacts with various data sources, so that the unified maintenance and the safety of data are not facilitated, and the performance of data access cannot be guaranteed.
Specifically, the method for implementing data sharing access provided by the present invention includes: the data sharing server receives an HTTP (Hypertext Transfer Protocol, based on the Hypertext Transfer Protocol) data access request message sent by a data visitor, performs data access on a data source according to the message type of the request message, and sends an access result to the data visitor through an HTTP response message.
The method provided by the invention further has the following characteristics:
after receiving the HTTP data access request message, the data sharing server further includes:
and the data sharing server judges whether the data accessor has an access right or not based on a pre-configured access strategy, and if so, performs data access on a data source according to the message type of the request message.
After receiving the HTTP data access request message, the data sharing server further includes:
and the data sharing server analyzes the HTTP data access request message to acquire a message type, judges whether the data visitor has the access authority of the message type based on a pre-configured access strategy, and if so, performs data access on a data source according to the message type of the request message.
The message type of the HTTP data access request message includes one or more of the following types:
HTTP GET data query, HTTP PUT data update, and HTTP DELETE data delete.
The types of data sources include databases, extensible markup language documents, and directory access protocol servers.
The present invention also provides a data sharing server, including:
a request message receiving unit, configured to receive an HTTP data access request message sent by a data visitor;
the data access unit is used for performing data access on a data source according to the message type of the HTTP data access request message received by the request message receiving unit;
and the access result feedback unit is used for receiving the access result sent by the data source and sending the access result to the data visitor through an HTTP response message.
The data sharing server provided by the invention further has the following characteristics:
the request message receiving unit is further configured to, after receiving the HTTP data access request message, judge whether the data visitor has an access right based on a pre-configured access policy, and if so, trigger the data access unit.
Based on the above technical features, the data sharing server further includes:
and the access authority judging unit is used for analyzing the HTTP data access request message received by the request message receiving unit, acquiring the message type, judging whether the data visitor has the access authority of the message type based on a pre-configured access strategy, and if so, triggering the data access unit.
The invention also provides a system for realizing data sharing access, which comprises at least one data visitor and a data source, and is characterized in that the system also comprises: at least one data sharing server;
the data accessor is used for sending HTTP data access request information to the data sharing server;
the data sharing server is used for receiving the HTTP data access request message, performing data access on a data source according to the message type of the request message, and sending an access result to the data accessor through an HTTP response message;
the data source is used for receiving the access request message of the data sharing server, obtaining the access result according to the type of the access request message and feeding back the access result to the data sharing server.
The message type of the HTTP data access request message comprises one or more of the following types:
HTTP GET data query, HTTP PUT data update, and HTTP DELETE data delete.
Compared with the prior art, the invention has the following beneficial effects:
the method of the invention provides a uniform data sharing access point, namely a data sharing server, which can simplify the access of data visitors to data, shield different data sources to the data visitors, facilitate the uniform maintenance and management of data and improve the safety and performance of data access; the method is convenient for the expansion of the application in the distributed application system architecture, the newly added application service can be realized only by accessing the data from the data sharing access server according to the standard HTTP protocol, the adjustment and the change of the data source are transparent to the data user, and the current data use is not influenced.
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 derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to solve the problems that in the prior art, a data user directly interacts with various data sources, the requirement on the data user is high, the unified maintenance and safety of data are not facilitated, and the performance of data access cannot be guaranteed, the invention provides a method, a device and a system for realizing data sharing access based on an HTTP (hyper text transport protocol). The method adopts the HTTP commonly used in the Internet, and the data user uniformly accesses the data sharing server, so that the independence of the application and the data is realized, different types of data sources are shielded for the upper application, the data access of the upper application is greatly simplified, and the method is more favorable for the uniform maintenance, the safety control and the improvement of the query performance of the data.
The following describes the specific implementation process of the method provided by the present invention in detail by several embodiments:
example one
As shown in fig. 1, a flowchart of a method for implementing data sharing access based on an HTTP protocol provided by the present invention specifically includes the following steps:
step S101, the data accessor sends an HTTP data access request to the data sharing server.
Step S102, after the data sharing server receives the HTTP data access request, the data sharing server accesses the data source according to the message type of the request message.
Wherein the message type of the HTTP data access request message includes one or more of the following: HTTP get data query, HTTP PUT data update, and HTTP DELETE data delete.
Correspondingly, in the step, the data sharing server sends the access request to the data source according to the type of the received message, and the type of the access request message includes: data query, data update, and data deletion.
Based on the above features, the implementation procedure according to different message types in this step includes:
when the HTTP data access request message is an HTTP GET data query message, the data sharing server sends a data query request message to the data source; or,
when the HTTP data access request message is an HTTP PUT data updating message, the data sharing server sends a data updating request message to the data source; or,
and when the HTTP data access request message is HTTP DELETE data deletion message, the data sharing server sends a data deletion request message to the data source.
And step S103, the data source acquires an access result according to the access request of the data sharing server and feeds the access result back to the data sharing server.
And step S104, the data access server returns the access result to the data visitor through an HTTP response.
Furthermore, in the method provided by the invention, data transmission is carried out between the data visitor and the data sharing server and between the data sharing server and the data source by adopting a network.
Example two
As shown in fig. 2, another flowchart of the method for implementing data sharing access based on the HTTP protocol provided by the present invention specifically includes the following steps:
step S201, the data accessor sends an HTTP data access request to the data sharing server.
Step S202, the data sharing server judges whether a data visitor has access authority or not based on a pre-configured access strategy, and if so, the step S204 is executed; otherwise, step S203 is executed.
Wherein the data sharing server preferably authenticates the different data visitors by their IP addresses. The data sharing server may set the data visitor with high trust to have access authority, and may set the data visitor with high trust according to other requirements.
Step S203, the data sharing server feeds back a request failure response message to the data visitor, and the process ends.
And step S204, the data sharing server accesses data to the data source according to the message type of the received HTTP data access request message.
The message type of the HTTP data access request message includes one or more of the following, specifically: HTTP GET data query, HTTP PUT data update, and HTTP DELETE data delete.
Correspondingly, in the step, the data sharing server sends the access request to the data source according to the type of the received message, and the type of the access request message includes: data query, data update, and data deletion.
And S205, the data source acquires an access result according to the access request of the data sharing server and feeds the access result back to the data sharing server.
And step S206, the data access server returns the access result to the data visitor through the HTTP response.
EXAMPLE III
As shown in fig. 3, another flowchart of the method for implementing data sharing access based on the HTTP protocol provided by the present invention specifically includes the following steps:
step S301, the data accessor sends an HTTP data access request to the data sharing server.
Step S302, the data sharing server judges whether the data accessor has an access right, if so, the step S304 is executed; otherwise, step S303 is executed.
Step S303, the data sharing server feeds back a request failure response message to the data visitor, and the process ends.
Step S304, the data sharing server analyzes the received HTTP data access request message, acquires the message type, judges whether the current data visitor has the access authority of the message type based on a pre-configured access strategy, and if so, executes step S306; otherwise, step S305 is executed.
Step S305, the data sharing server feeds back a request failure response message to the data visitor.
And step S306, the data sharing server accesses the corresponding data source based on the message type of the HTTP data access request message.
And step S307, the data source acquires an access result according to the access request of the data sharing server and feeds the access result back to the data sharing server.
And step S308, the data access server returns the access result to the data visitor through an HTTP response.
Example four
As shown in fig. 4, another flowchart of the method for implementing data sharing access based on the HTTP protocol provided by the present invention specifically includes the following steps:
step S401, the data accessor sends an HTTP data access request to the data sharing server.
Step S402, after the data sharing server receives the HTTP data access request, the HTTP data access request message is analyzed to obtain the message type.
Wherein the message type of the HTTP data access request message includes one or more of the following: HTTP get data query, HTTP PUT data update, and HTTP DELETE data delete.
Step S403, the data sharing server judges whether the data accessor has the access authority of the message type based on a pre-configured access strategy, if so, the step S405 is executed; otherwise, step S404 is performed.
Step S404, the data sharing server feeds back a request failure response message to the data visitor.
And step S405, the data sharing server accesses the corresponding data source based on the message type of the HTTP data access request message.
And step S406, the data source acquires an access result according to the access request of the data sharing server and feeds the access result back to the data sharing server.
Step S407, the data access server returns the access result to the data visitor through the HTTP response.
The technical scheme of the invention provides a uniform data sharing access point, can simplify the access of data visitors to data, provides a uniform HTTP data access method (data query HTTP GET, data update HTTP PUT and data deletion HTTP DELETE), shields different data sources for data visitors, facilitates uniform maintenance and management of data, and improves the security and performance of data access. The method is convenient for the expansion of the application in the distributed application system architecture, the newly added application service can be realized only by accessing the data from the data sharing access server according to the standard HTTP protocol, the adjustment and the change of the data source are transparent to the data user, and the current data use is not influenced. In addition, the technical scheme of the invention can also provide security control of data access, and only provides data access service for trusted data accessors according to the pre-configured access strategy, thereby improving the security of data access.
As shown in fig. 5, the present invention further provides a data sharing server, which specifically includes:
a request message receiving unit 510, configured to receive an HTTP data access request message sent by a data visitor;
a data access unit 520, configured to perform data access on a data source according to the message type of the HTTP data access request message received by the request message receiving unit 510;
and an access result feedback unit 530, configured to receive an access result sent by the data source, and send the access result to the data visitor through an HTTP response message.
Further, the request message receiving unit 510 is further configured to, after receiving the HTTP data access request message, determine whether the data visitor has an access right based on a pre-configured access policy, and if so, trigger the data access unit 520.
Based on the above technical features, the data sharing server further includes:
an access permission judging unit 540, configured to parse the HTTP data access request message received by the request message receiving unit 510, obtain a message type, and judge, based on a pre-configured access policy, whether the data accessor has an access permission of the message type, if so, trigger the data accessing unit 520.
The present invention further provides a system for implementing data sharing access, as shown in fig. 6, the system specifically includes: the system comprises at least one data visitor, at least one data sharing server and at least one data source.
The data accessor is a data user and is used for sending HTTP data access request information to the data sharing server;
the data sharing server is used for receiving the HTTP data access request message, performing data access on a data source according to the message type of the request message, and sending an access result to the data accessor through an HTTP response message;
wherein the message type of the HTTP data access request message comprises one or more of the following types: HTTP GET data query, HTTP PUT data update, and HTTP DELETE data delete.
The data source is an actual physical data source, and the types of the data source comprise a database, an XML file and an LDAP server; of course, the above types are merely exemplary and not exhaustive, and the types of data sources are not limited to the three. Specifically, the data source is configured to receive an access request message of the data sharing server, obtain an access result according to a type of the access request message, and feed back the access result to the data sharing server.
Further, after receiving the HTTP data access request message, the data sharing server determines whether the data visitor has an access right based on an access policy pre-configured by the data sharing server, and if so, performs data access on a data source according to a message type of the request message. And/or the presence of a gas in the gas,
and after receiving the HTTP data access request message, the data sharing server analyzes the HTTP data access request message to acquire a message type, judges whether the data visitor has the access authority of the message type based on a pre-configured access strategy, and if so, performs data access on a data source according to the message type of the request message.
The data visitor and the data sharing server, and the data sharing server and the data source all use a network for data transmission.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.