CN112115103A - File address display method and device, electronic equipment and readable storage medium - Google Patents

File address display method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN112115103A
CN112115103A CN202010911618.9A CN202010911618A CN112115103A CN 112115103 A CN112115103 A CN 112115103A CN 202010911618 A CN202010911618 A CN 202010911618A CN 112115103 A CN112115103 A CN 112115103A
Authority
CN
China
Prior art keywords
service
target
address
json file
interface
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.)
Granted
Application number
CN202010911618.9A
Other languages
Chinese (zh)
Other versions
CN112115103B (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 CN202010911618.9A priority Critical patent/CN112115103B/en
Publication of CN112115103A publication Critical patent/CN112115103A/en
Application granted granted Critical
Publication of CN112115103B publication Critical patent/CN112115103B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/168Details of user interfaces specifically adapted to file systems, e.g. browsing and visualisation, 2d or 3d GUIs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the invention provides a file address display method, a file address display device, electronic equipment and a readable storage medium, wherein the method comprises the following steps: the method comprises the steps of obtaining a service address of each target service and an interface path prefix of each target service in a plurality of target services, storing the service address of each target service and the interface path prefix of the interface of each target service in a service registration center of a service grid, obtaining the service address and the interface path prefix corresponding to each target service from the service registration center through a service discovery function of the service grid, and displaying a JSON file address corresponding to each target service according to the service address and the interface path prefix corresponding to each target service. The interface information of a plurality of back-end services can be checked without inputting different access addresses by the user, so that the time and labor cost for checking the interface information by the user are reduced, and the access addresses with more access can be maintained without recording by the user.

Description

File address display method and device, electronic equipment and readable storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a file address display method and apparatus, an electronic device, and a readable storage medium.
Background
In service development, when a back-end service and a front-end project are subjected to interface joint debugging, an interface document corresponding to the back-end service needs to be provided, and the interface document comprises the latest definition and introduction of the back-end service. For example, the interface document records interface information of an interface provided by a backend service, such as information of a Uniform Resource Locator (URL), a request parameter, a return parameter, and the like.
In the prior art, for a backend service integrated with a Swagger plug-in, after the backend service is deployed on a physical machine, the backend service is started to automatically acquire interface information of an interface. When front-end engineering personnel need to check interface information of different back-end services, different access addresses need to be manually input: http:// { IP of physical machine deployed by backend service }, { port (port) of backend service }/Swagger-UI. html, for example, the backend service a is started on the physical machine 1 deployed by the backend service a, and the IP address of the physical machine 1, the port of the backend service a, and the default path Swagger-UI. html stored in the Interface document of the backend service a are manually input in a browser, and the Interface information in the Interface document of the backend service a can be obtained by Swagger-User Interface (Swagger-UI, Swagger-User Interface) service, and the Interface information in the Interface document of the backend service a is displayed in the Swagger-UI page provided by the Swagger-UI service.
The inventor finds that the prior art at least has the following problems in the process of implementing the invention:
because one service integrating the Swagger plug-in corresponds to one Swagger-UI service, one Swagger-UI service can only automatically acquire interface information of the back-end service corresponding to the Swagger-UI service, and if front-end engineering personnel need to acquire the interface information of a plurality of back-end services, different access addresses need to be manually input, so that the manual input of different access addresses is labor-consuming and time-consuming. Moreover, as the number of backend services increases, the number of access addresses corresponding to different backend services that need to be recorded and maintained increases, and thus the recording and maintaining of the access addresses is complicated.
Disclosure of Invention
An object of embodiments of the present invention is to provide a file address display method, an apparatus, an electronic device, and a readable storage medium, so as to solve the problems in the prior art that manually recording and maintaining access addresses of different backend services causes complexity, and manually inputting access addresses of different backend services to obtain interface information of different services, which causes great effort and time consumption, and recording and maintaining more access addresses are complicated, and a specific technical scheme is as follows:
in a first aspect of the present invention, there is provided a file address display method executed in a server deployed with a service grid, including:
acquiring a service address of each target service in a plurality of target services and an interface path prefix of each target service, wherein the interface path prefix is used for representing a storage path identifier of an interface document corresponding to the target service on a server deployed by the target service;
storing a service address of each of the target services and an interface path prefix of an interface of each of the target services in a service registry of the service grid;
acquiring a service address and an interface path prefix corresponding to each target service from the service registration center through a service discovery function of the service grid;
and displaying the JSON file address corresponding to each target service according to the service address corresponding to each target service and the interface path prefix.
In a second aspect of the present invention, there is provided a file address display apparatus, disposed in a server deployed with a service grid, including:
a first obtaining module, configured to obtain a service address of each target service in a plurality of target services and an interface path prefix of each target service, where the interface path prefix is used to characterize a storage path identifier of an interface document corresponding to the target service on a server deployed by the target service;
a storage module, configured to store a service address of each target service and an interface path prefix of an interface of each target service in a service registry of the service grid;
a second obtaining module, configured to obtain, from the service registry, a service address and an interface path prefix corresponding to each target service through a service discovery function of the service grid;
and the display module is used for displaying the JSON file address corresponding to each target service according to the service address corresponding to each target service and the interface path prefix.
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 file address display methods described above.
In yet another aspect of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the file address display methods described above.
The file address display method provided by the embodiment of the invention stores the service address of each target service and the interface path prefix of each target service in a service registration center of a service grid by acquiring the service address of each target service and the interface path prefix of each target service, acquires the service address and the interface path prefix corresponding to each target service from the service registration center through a service discovery function of the service grid, and displays the JSON file address corresponding to each target service according to the service address and the interface path prefix corresponding to each target service. Therefore, JSON file addresses of a plurality of target services can be displayed simultaneously, and interface information of each target service can be checked. According to the method and the device, the interface information of the back-end services can be checked without manually inputting different access addresses if front-end engineering personnel need to acquire the interface information of the back-end services as in the prior art, namely, a user does not need to input different access addresses, so that the time and labor cost for the user to check the interface information of the back-end services are reduced, and the user does not need to record and maintain the access addresses with more accesses.
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 system architecture diagram based on a file address display method provided in an embodiment of the present invention;
FIG. 2 is a flowchart illustrating steps of a file address display method according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating steps of another method for displaying a file address according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of a file address display apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device provided in 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 more clearly describe the file address display method provided by the embodiment of the present invention, a system architecture diagram provided by the embodiment of the present invention is described herein with reference to fig. 1. Referring to fig. 1, fig. 1 is a system architecture diagram based on a file address display method provided in an embodiment of the present invention. The system architecture diagram includes a service grid and a physical machine (e.g., a server shown in fig. 1) deployed with service a, which is a service not deployed in the service grid (the service not deployed in the service grid may be regarded as an external service), wherein the number of the services not deployed in the service grid may be multiple, and only service a is shown in fig. 1. A plurality of services may be deployed in the services grid (the services deployed in the services grid may be considered as internal services), and only service B deployed in the services grid is shown in fig. 1. Wherein, a Service Mesh refers to a configurable infrastructure layer for microservice applications. It makes communication between each microservice more fluid, reliable and rapid. The service grid may provide a range of functions such as service discovery, load balancing, encryption, authentication, authorization, fuse mode support (Circuit Breaker Pattern), and others. The service a and the Swagger plug-in may be integrated, and the Swagger plug-in obtains the interface information of the interface of the service a according to the annotation of the interface of the service a, and stores the interface information of the service a (the interface information includes a path, a request parameter, and a return parameter corresponding to the interface of the service a) in the JSON file a. Similarly, the service B is integrated with the Swagger plug-in, and the interface information of the service B is saved in the JSON file B. Wherein, the service A and the service B are both services which need to provide interface documents. The Swagger plug-in is a most popular Application Programming Interface (API) management tool in the world.
The server deployed with the service a can read the configuration information of the interface of the service a to obtain the interface path prefix of the interface of the service a included in the configuration information, and after the server obtains the interface path prefix of the interface of the service a, the developer can assign the service address and the interface path prefix corresponding to the service a to the service grid. Specifically, the developer may assign the service address and the interface path prefix corresponding to the service a to an external service agent component in the service grid, and the external service agent component stores the service address and the interface path prefix corresponding to the service a in a service registry in the service grid.
The developer may provide the configuration information of the interface of the service B to the service grid hosting the service B, and the service grid obtains the interface path prefix of the interface of the service B included in the configuration information, so that the service address corresponding to the service B and the interface path prefix of the interface of the service B may be stored in the service registry in the service grid.
Swagger UI service is developed in the service grid, and is a set of Web application which is based on Swagger-compliant API and can display graceful documents. After the Swagger UI service is started, a Swagger ui.html page of the Swagger UI service can be opened, a Swagger address of the Swagger UI service is input in an address column of the Swagger ui.html page, and the Swagger UI service acquires a service address of each service stored in the service registration center and an interface path prefix corresponding to the service address through a get method of a Swagger resource provider interface of the Swagger UI frame. And the Swagger UI service determines the JSON file address corresponding to each service according to the service address of each service and the interface path prefix corresponding to the service address, wherein the interface path prefixes corresponding to the service addresses are different. For example, service a corresponds to service address a and interface path prefix a (service a is a service providing video service, and interface path prefix a is/api/video), and service B corresponds to service address B and interface path prefix B (service B is a service providing picture service, and interface path prefix B is/api/image). The Swagger UI service may determine that the JSON file address a corresponding to the service a is the service address a/the interface path prefix a/the preset path, and the JSON file address B corresponding to the service B is the service address B/the interface path prefix B/the preset path. For example, if the Internet Protocol (IP) address of service address a is 10.10.10.10, the port is 8080, service a is a service providing video service, and the interface path prefix is: and/apis/video, the preset path is/Swagger/api-doc, and the JSON file address A is as follows: 10.10.10.10: 8080/apis/video/Swagger/api-doc. And determining the JSON file address B corresponding to the service B. The server of the deployment service A stores the JSON file A corresponding to the service A according to the JSON file address A corresponding to the service A, and the service grid stores the JSON file B corresponding to the service B according to the JSON file address B corresponding to the service B. The JSON file A comprises interface information of an interface of the service A, and the JSON file B comprises interface information of an interface of the service B.
After the Swagger UI service determines the JSON file address corresponding to each service, the JSON file address corresponding to each service can be displayed. For example, after the Swagger UI services the JSON file address a and the JSON file address B, the JSON file address a and the JSON file address B are displayed through a drop-down box. Therefore, the JSON file addresses of a plurality of services can be displayed simultaneously, namely the JSON file addresses of the services are managed uniformly, so that a user can simultaneously check the JSON file addresses of the services, and the time and labor cost required for the user to check a plurality of interface documents are reduced. For example, if the user selects the JSON file address a for the first time, the interface document corresponding to the JSON file address a may be displayed, and if the user selects the JSON file address B after finishing viewing the interface document corresponding to the JSON file address a, the interface document corresponding to the JSON file address B may be displayed.
The JSON file addresses corresponding to a plurality of services can be managed in a unified mode through the Swagger UI service in the service grid, the JSON file addresses corresponding to the services are displayed through one Swagger UI service, therefore, the JSON file addresses corresponding to the services can be checked only by remembering one access address corresponding to the Swagger UI service, interface information of each service can be checked, the interface information of a plurality of rear-end services does not need to be acquired by front-end engineering personnel in the prior art, different access addresses need to be manually input, the access addresses with more access points do not need to be recorded and maintained, and therefore labor and time cost are saved.
The JSON file address corresponding to each service displayed by the Swagger UI service is used, so that a user can conveniently select one JSON file address from the JSON file addresses corresponding to each displayed service, the Swagger UI service can obtain the JSON file corresponding to the JSON file address selected by the user, an interface document is generated according to the JSON file corresponding to the JSON file address selected by the user, and the interface document is displayed. If the user needs to check the interface documents corresponding to other JSON file addresses except the currently selected JSON file address, the user only needs to reselect one JSON file address from other JSON file addresses. Therefore, the user can check the JSON file addresses corresponding to all the services stored in the service registration center by remembering the access addresses corresponding to the Swagger UI service, and accordingly the interface documents corresponding to the JSON file addresses can be checked according to the requirement of the user.
Based on fig. 1, an embodiment of the present invention provides a file address display method. Referring to fig. 2, fig. 2 is a flowchart illustrating steps of a file address display method according to an embodiment of the present invention. The method may be performed by a server deployed with a services grid. The method comprises the following steps:
step 201, obtaining a service address of each target service in the plurality of target services and an interface path prefix of each target service, where the interface path prefix is used to characterize a storage path identifier of an interface document corresponding to the target service on a server deployed by the target service.
Wherein the target service comprises an external service which is not deployed in the service grid and/or an internal service which is deployed in the service grid. The interface path prefix is used for representing the storage path identifier of the JSON file corresponding to the service on the server deployed by the service. For example, after the service a is integrated with the Swagger plug-in, the Swagger plug-in is deployed in the server shown in fig. 1, and the Swagger plug-in may read the configuration information of the service a, thereby obtaining the interface path prefix of the interface of the service a in the configuration information, and may also obtain the interface information of the interface of the service a, and generate the JSON file a according to the interface information of the interface of the service a. And storing the JSON file A according to the storage path corresponding to the service A, wherein the JSON file corresponding to the service A is the JON file A. For example, in combination with the above example, the interface path prefix is: the preset path is/Swagger/api-doc, and the storage path corresponding to the service A is as follows: /apis/video/Swagger/api-doc.
For example, referring to FIG. 1, the target service includes service A, which is an external service not hosted in the service grid, and service B, which is an internal service hosted in the service grid. An external service agent component (referred to as a ServiceEntry component) deployed in the service grid can acquire a service address of service a (service a is an external service) and an interface path prefix of an interface of service a; the service grid may obtain a service address of service B deployed in the service grid and an interface path prefix of an interface of service B.
Step 202, storing the service address of each target service and the interface path prefix of the interface of each target service in the service registry of the service grid.
With the above example, the service address of service a and the interface path prefix of the interface of service a are stored in the service registry in the service grid, and the service address of service B and the interface path prefix of the interface of service B are stored in the service registry in the service grid.
Step 203, obtaining the service address and the interface path prefix corresponding to each target service from the service registry through the service discovery function of the service grid.
And 204, displaying the JSON file address corresponding to each target service according to the service address corresponding to each target service and the interface path prefix.
The JSON file address corresponding to each target service may be displayed in a drop-down list, that is, the drop-down list may include the JSON file address corresponding to each target service.
In the file address display method provided by this embodiment, the service address of each target service and the interface path prefix of each target service are obtained, and the service address of each target service and the interface path prefix of each target service are stored in the service registration center of the service grid, the service address and the interface path prefix corresponding to each target service are obtained from the service registration center through the service discovery function of the service grid, and the JSON file address corresponding to each target service is displayed according to the service address and the interface path prefix corresponding to each target service. Therefore, JSON file addresses of a plurality of target services can be displayed simultaneously, and interface information of each target service can be checked. According to the method provided by the embodiment, the interface information of the plurality of back-end services can be checked without inputting different access addresses by a user, so that the time and labor cost for checking the plurality of interface information by the user are reduced, and the access addresses with more access are not required to be recorded and maintained by the user.
Referring to fig. 3, fig. 3 is a flowchart illustrating steps of another file address display method according to an embodiment of the present invention. The method comprises the following steps:
step 301, access of an external service to the services grid by an external service broker component in the services grid.
Wherein, if the target service comprises an external service, the external service is accessed to the service grid through an external service agent component in the service grid. The external service is accessed to the service grid by manually registering the service address and interface path prefix of the external service to the foreign service broker component.
In the prior art, a service corresponds to an access address, a developer needs to manually define the access address corresponding to the service in a code corresponding to the service in the process of developing the service, and when an interface document corresponding to a certain service needs to be searched, the access address corresponding to the service needs to be found first (as the access addresses are more and more, more time is needed for searching the access address corresponding to the service); and then manually inputting the access address corresponding to the service in the browser, obtaining the interface information in the interface document of the service by the Swagger UI service, and displaying the interface information of the interface document of the service in a Swagger-UI page provided by the Swagger-UI service.
Because the access address corresponding to the service needs to be manually defined in the code corresponding to the service in the prior art, after the interface information of some services is modified, the Swagger UI service needs to be restarted, then the access address corresponding to the Swagger UI service is input, and the modified interface documents of the services (including the interface information) are obtained again.
In the embodiment of the invention, the external service which is not deployed in the service grid is accessed into the service grid, so that the service registry can acquire the service address and the interface path prefix corresponding to each external service from the external agent component. Therefore, if the external service needs to be added, only a developer needs to configure the service address and the interface path prefix of the external service in the external service proxy component, and the external service proxy component can acquire the current service address of the added external service and the interface path prefix of the interface of the added external service; after deleting the external service, the external service agent component acquires the service address of the external service which cannot be deleted and the interface path prefix of the interface of the deleted external service; after modifying the interface information of the service, the external service agent component acquires the service address and the interface path prefix of the service, and acquires the modified interface information of the service according to the service address and the interface path prefix; therefore, after adding a service or deleting a service or modifying interface information of a service, the service address of the foreign service and the interface path prefix of the service interface, which are acquired by the service registry from the foreign service agent component, are both current and latest, that is, the service address of the foreign service and the interface path prefix of the service interface, which are stored in the service registry, are both current and latest. If the internal service needs to be added, a developer only needs to deploy the internal service in the service grid, after the Swagger UI service is started, the Swagger UI service can acquire the service addresses and the interface path prefixes of all the external services in the service registry and acquire the service addresses and the interface path prefixes of all the internal services through the service discovery function of the service grid, and display the JSON file addresses of all the services in the service registry, wherein the JSON file addresses include the service addresses of the services and the interface path prefixes of the services. If the user needs to check the interface documents corresponding to other JSON file addresses except the currently selected JSON file address, the user only needs to reselect one JSON file address from other JSON file addresses, and the Swagger UI service does not need to be restarted. Therefore, the user can check the JSON file addresses corresponding to all the services stored in the service registration center by remembering the access addresses corresponding to the Swagger UI service, and accordingly the interface documents corresponding to the JSON file addresses can be checked according to the requirement of the user.
Step 302, obtaining a service address of each target service in the plurality of target services and an interface path prefix of each target service, where the interface path prefix is used to characterize a storage path identifier of an interface document corresponding to the target service on a server deployed by the target service.
Wherein, in the case that the target service includes an external service and an internal service, step 302 may be implemented by:
the method comprises the steps of obtaining a service address of each external service, an interface path prefix of an interface of each external service, a service address of each internal service deployed in a service grid and an interface path prefix of an interface of each internal service.
It is noted that if there is not at least one external service not deployed in the services grid, the plurality of services in step 302 includes a plurality of internal services deployed in the services grid.
Step 303, storing the service address of each target service and the interface path prefix of the interface of each target service in the service registry of the service grid.
In the case that the target service includes an external service and an internal service, the service address of each external service and the interface path prefix of the interface with each external service need to be stored in the service registry, and the service address of each internal service and the interface path prefix of the interface with each internal service need to be stored in the service registry.
And step 304, acquiring a service address and an interface path prefix corresponding to each target service from the service registration center through a service discovery function of the service grid.
And 305, displaying the JSON file address corresponding to each target service according to the service address corresponding to each target service and the interface path prefix.
The JSON file address corresponding to each target service can be displayed through a Swagger user interface service (the Swagger user interface service is the Swagger UI service) deployed in the service grid. Because the JSON file address corresponding to each target service can be displayed through one Swagger UI service, a user can view the JSON file address corresponding to each target service only by remembering the Swagger address corresponding to the Swagger UI service (the Swagger address is the access address corresponding to the Swagger UI service), so that the JSON file address is selected from the displayed JSON file addresses corresponding to a plurality of target services according to requirements, the Swagger UI service acquires the JSON file corresponding to the JSON file address according to the JSON file address selected by the user, generates an interface document according to the JSON file, and displays the interface document.
Step 306, determining the target JSON file address selected by the user from each JSON file address.
And 307, responding to the target JSON file address, and acquiring a target JSON file corresponding to the target JSON file address.
Step 307 may be implemented by:
when the plurality of target services comprise at least one external service, if the target JSON file address is a JSON file address corresponding to a target external service in the at least one external service, sending a request comprising the target JSON file address to a server deployed by the target external service;
and receiving a target JSON file sent by a server deployed by a target external service, wherein the target JSON file is obtained by responding to the request of the server deployed by the target external service and according to the address of the target JSON file included in the request.
Referring to fig. 1, when a plurality of target services include a service a, if the target JSON file address is the JSON file address corresponding to the service a. That is, the JSON file address selected by the user from the displayed multiple JSON file addresses is the JSON file address corresponding to the service a, the service a is the target external service, and the JSON file address corresponding to the service a is the target JSON file address, the service grid sends a request including the JSON file address corresponding to the service a to the server (i.e., the server in fig. 1) deployed by the target external service; after receiving a request including a JSON file address corresponding to a service a, the server in fig. 1 responds to the request, acquires the JSON file corresponding to the service a according to the JSON file address corresponding to the service a included in the request, and sends the JSON file corresponding to the service a to the service grid; the service grid receives the JSON file corresponding to the service a sent by the server in fig. 1, and can generate an interface document according to the JSON file corresponding to the service a and display the interface document.
The service grid sends the request including the address of the target JSON file to the server deployed by the target service, and the method comprises the following steps:
the service grid sends a request to a server corresponding to the target JSON file address through an external agent component;
correspondingly, receiving the target JSON file sent by the server deployed by the target external service can be realized by the following steps:
an external service agent component (the external service agent component is a ServiceEntry component) receives a target JSON file which is sent by a server corresponding to the target JSON file address and corresponds to the target JSON file address, and sends the target JSON file corresponding to the target JSON file address to the Swagger UI service;
the Swagger UI service receives a target JSON file corresponding to the target JSON file address.
The name and address of the services outside the mesh, (domain name or IP + port) are defined in ServiceEntry. And a corresponding flow strategy component VirtualService is created, wherein the VirtualService defines which prefix request in the flow entering through the grid gateway is forwarded to the ServiceEntry and finally to the external service.
For example, service a is deployed in a server with an IP of 10.10.10.10 and a port of 8080, and the JSON file path corresponding to service a is: and if the gateway domain name of the service grid is xx.com, the request comprising xx.xom/apis/video/Swagger/api-doc is finally forwarded to a server deployed by the service A, and the server can obtain the JSON file of the service A. And the server sends the JSON file of the service A to the external agent component, and the external agent component sends the JSON file of the service A to the Swagger UI service, so that the Swagger UI service can acquire the JSON file of the service A.
And 308, generating an interface document according to the target JSON file, and displaying the interface document.
The method for displaying the file address provided by the embodiment realizes simultaneous display of the JSON file addresses of a plurality of target services, namely, unified management of the JSON file addresses of the plurality of target services, so that a user can simultaneously view the JSON file addresses of the plurality of target services, time and labor cost required by the user to view a plurality of interface documents are reduced, the user can conveniently and rapidly select the JSON file address required by the user from the displayed JSON file addresses of the plurality of target services, and the interface document corresponding to the JSON file address selected by the user can be viewed.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a file address display apparatus provided in an embodiment of the present invention, the apparatus is disposed in a server deployed with a service grid, and the apparatus 400 includes:
a first obtaining module 410, configured to obtain a service address of each target service in a plurality of target services and an interface path prefix of each target service, where the interface path prefix is used to characterize a storage path identifier of an interface document corresponding to the target service on a server deployed by the target service;
a storage module 420, configured to store a service address of each of the target services and an interface path prefix of an interface of each of the target services in a service registry of the service grid;
a second obtaining module 430, configured to obtain, from the service registry, a service address and an interface path prefix corresponding to each target service through a service discovery function of the service grid;
and a display module 440, configured to display, according to the service address and the interface path prefix corresponding to each target service, the JSON file address corresponding to each target service.
Optionally, if the target service includes an external service that is not hosted in the service grid, the method further includes:
an access module for accessing the external service to the service grid through an external service agent component in the service grid.
Optionally, the method further includes:
the determining module is used for determining a target JSON file address selected from each JSON file address by a user;
a third obtaining module, configured to obtain, in response to the target JSON file address, a target JSON file corresponding to the target JSON file address;
and the display module is used for generating an interface document according to the target JSON file and displaying the interface document.
Optionally, the third obtaining module is specifically configured to, when the plurality of target services includes at least one external service, send a request including a target JSON file address to a server deployed by the target external service if the target JSON file address is a JSON file address corresponding to a target external service in the at least one external service; and receiving the target JSON file sent by the server deployed by the target external service, wherein the target JSON file is obtained by responding to the request by the server deployed by the target external service and according to the target JSON file address included in the request.
Optionally, the second obtaining module 430 is specifically configured to obtain, in real time or periodically, a service address and an interface path prefix corresponding to each target service from the service registry through a service discovery function of the service grid.
An embodiment of the present invention further provides an electronic device, as shown in fig. 5, and fig. 5 is a schematic structural diagram of another electronic device provided in an embodiment of the present invention. 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, when executing the program stored in the memory 503, implements the following steps:
acquiring a service address of each target service in a plurality of target services and an interface path prefix of each target service, wherein the interface path prefix is used for representing a storage path identifier of an interface document corresponding to the target service on a server deployed by the target service;
storing a service address of each of the target services and an interface path prefix of an interface of each of the target services in a service registry of the service grid;
acquiring a service address and an interface path prefix corresponding to each target service from the service registration center through a service discovery function of the service grid;
and displaying the JSON file address corresponding to each target service according to the service address corresponding to each target service and the interface path prefix.
The communication bus mentioned in the above terminal may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the terminal and other equipment.
The Memory may include a Random Access Memory (RAM) or 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 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete gate or transistor logic device, or discrete hardware components.
In another embodiment of the present invention, a computer-readable storage medium is further provided, in which instructions are stored, and when the instructions are executed on a computer, the computer is enabled to execute the file address display method in any one of the above embodiments.
In yet another embodiment of 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 file address display method of any one of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
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 system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
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 (12)

1. A file address display method is executed on a server deployed with a service grid, and comprises the following steps:
acquiring a service address of each target service in a plurality of target services and an interface path prefix of each target service, wherein the interface path prefix is used for representing a storage path identifier of an interface document corresponding to the target service on a server deployed by the target service;
storing a service address of each of the target services and an interface path prefix of an interface of each of the target services in a service registry of the service grid;
acquiring a service address and an interface path prefix corresponding to each target service from the service registration center through a service discovery function of the service grid;
and displaying the JSON file address corresponding to each target service according to the service address corresponding to each target service and the interface path prefix.
2. The method of claim 1, wherein if the target service comprises an external service that is not hosted in the service grid, before the obtaining the service address of each of the plurality of target services and the interface path prefix of each of the target services, further comprising:
accessing, by an external service agent component of the services grid, the external service to the services grid.
3. The method according to claim 2, further comprising, after said displaying the JSON file address corresponding to each of the target services:
determining a target JSON file address selected from each JSON file address by a user;
responding to the target JSON file address, and acquiring a target JSON file corresponding to the target JSON file address;
and generating an interface document according to the target JSON file, and displaying the interface document.
4. The method of claim 3, wherein the obtaining the target JSON file corresponding to the target JSON file address comprises:
when the plurality of target services comprise at least one external service, if the target JSON file address is a JSON file address corresponding to a target external service in the at least one external service, sending a request comprising the target JSON file address to a server deployed by the target external service;
and receiving the target JSON file sent by the server deployed by the target external service, wherein the target JSON file is obtained by responding to the request by the server deployed by the target external service and according to the target JSON file address included in the request.
5. The method of claim 1, wherein the obtaining, by a service discovery function of the service grid, a service address and an interface path prefix corresponding to each of the target services from the service registry comprises:
and acquiring a service address and an interface path prefix corresponding to each target service from the service registration center in real time or periodically through a service discovery function of the service grid.
6. A file address display device is arranged on a server with a service grid, and comprises:
a first obtaining module, configured to obtain a service address of each target service in a plurality of target services and an interface path prefix of each target service, where the interface path prefix is used to characterize a storage path identifier of an interface document corresponding to the target service on a server deployed by the target service;
a storage module, configured to store a service address of each target service and an interface path prefix of an interface of each target service in a service registry of the service grid;
a second obtaining module, configured to obtain, from the service registry, a service address and an interface path prefix corresponding to each target service through a service discovery function of the service grid;
and the display module is used for displaying the JSON file address corresponding to each target service according to the service address corresponding to each target service and the interface path prefix.
7. The apparatus of claim 6, wherein if the target service comprises an external service that is not hosted in the services grid, further comprising:
an access module to access the external service to the service grid through an external service agent component of the service grid.
8. The apparatus of claim 7, further comprising:
the determining module is used for determining a target JSON file address selected from each JSON file address by a user;
a third obtaining module, configured to obtain, in response to the target JSON file address, a target JSON file corresponding to the target JSON file address;
and the display module is used for generating an interface document according to the target JSON file and displaying the interface document.
9. The apparatus according to claim 8, wherein the third obtaining module is specifically configured to, when the plurality of target services includes at least one external service, send a request including a target JSON file address to a server deployed by the target external service if the target JSON file address is a JSON file address corresponding to a target external service of the at least one external service; and receiving the target JSON file sent by the server deployed by the target external service, wherein the target JSON file is obtained by responding to the request by the server deployed by the target external service and according to the target JSON file address included in the request.
10. The apparatus according to claim 6, wherein the second obtaining module is specifically configured to obtain, in real time or periodically, a service address and an interface path prefix corresponding to each target service from the service registry through a service discovery function of the service grid.
11. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1 to 5 when executing a program stored in the memory.
12. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-5.
CN202010911618.9A 2020-09-02 2020-09-02 File address display method and device, electronic equipment and readable storage medium Active CN112115103B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010911618.9A CN112115103B (en) 2020-09-02 2020-09-02 File address display method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010911618.9A CN112115103B (en) 2020-09-02 2020-09-02 File address display method and device, electronic equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN112115103A true CN112115103A (en) 2020-12-22
CN112115103B CN112115103B (en) 2023-08-01

Family

ID=73805278

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010911618.9A Active CN112115103B (en) 2020-09-02 2020-09-02 File address display method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN112115103B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112580079A (en) * 2020-12-25 2021-03-30 平安银行股份有限公司 Authority configuration method and device, electronic equipment and readable storage medium
CN114387940A (en) * 2022-02-25 2022-04-22 卡莱特云科技股份有限公司 Partition display updating method of LED display screen, playing box and display system

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030182445A1 (en) * 2002-03-22 2003-09-25 Motorola, Inc. Method for automatically allocating address prefixes
US7516194B1 (en) * 2002-05-21 2009-04-07 Microsoft Corporation Method for downloading high-volumes of content from the internet without adversely effecting the source of the content or being detected
US20110087789A1 (en) * 2009-10-13 2011-04-14 Nokia Corporation Subscription based network routing tables and enforcement for overlay networks
KR20140050547A (en) * 2012-10-19 2014-04-29 한국전자통신연구원 Apparatus and method for controlling uni path
CN104980482A (en) * 2014-12-24 2015-10-14 深圳市腾讯计算机系统有限公司 File transmitting method and device, file receiving method and device
CN108491199A (en) * 2018-03-06 2018-09-04 福建天泉教育科技有限公司 A kind of method and terminal automatically generating interface
US20180295212A1 (en) * 2017-04-07 2018-10-11 Bukio Corp System, device and server for generating address data for part of contents in electronic book
CN109871498A (en) * 2018-12-15 2019-06-11 中国平安人寿保险股份有限公司 Back end interface response method, device, electronic equipment and storage medium
CN109902247A (en) * 2019-02-14 2019-06-18 北京奇艺世纪科技有限公司 A kind of method, apparatus and electronic equipment of page rendering
US20190197060A1 (en) * 2017-12-21 2019-06-27 Kopjra S.R.L. Process for legal certification of successful interaction

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030182445A1 (en) * 2002-03-22 2003-09-25 Motorola, Inc. Method for automatically allocating address prefixes
US7516194B1 (en) * 2002-05-21 2009-04-07 Microsoft Corporation Method for downloading high-volumes of content from the internet without adversely effecting the source of the content or being detected
US20110087789A1 (en) * 2009-10-13 2011-04-14 Nokia Corporation Subscription based network routing tables and enforcement for overlay networks
KR20140050547A (en) * 2012-10-19 2014-04-29 한국전자통신연구원 Apparatus and method for controlling uni path
CN104980482A (en) * 2014-12-24 2015-10-14 深圳市腾讯计算机系统有限公司 File transmitting method and device, file receiving method and device
US20180295212A1 (en) * 2017-04-07 2018-10-11 Bukio Corp System, device and server for generating address data for part of contents in electronic book
US20190197060A1 (en) * 2017-12-21 2019-06-27 Kopjra S.R.L. Process for legal certification of successful interaction
CN108491199A (en) * 2018-03-06 2018-09-04 福建天泉教育科技有限公司 A kind of method and terminal automatically generating interface
CN109871498A (en) * 2018-12-15 2019-06-11 中国平安人寿保险股份有限公司 Back end interface response method, device, electronic equipment and storage medium
CN109902247A (en) * 2019-02-14 2019-06-18 北京奇艺世纪科技有限公司 A kind of method, apparatus and electronic equipment of page rendering

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112580079A (en) * 2020-12-25 2021-03-30 平安银行股份有限公司 Authority configuration method and device, electronic equipment and readable storage medium
CN114387940A (en) * 2022-02-25 2022-04-22 卡莱特云科技股份有限公司 Partition display updating method of LED display screen, playing box and display system
CN114387940B (en) * 2022-02-25 2023-09-15 卡莱特云科技股份有限公司 Partition display updating method, playing box and display system of LED display screen

Also Published As

Publication number Publication date
CN112115103B (en) 2023-08-01

Similar Documents

Publication Publication Date Title
CN109547570B (en) Service registration method, device, registration center management equipment and storage medium
CN108322351B (en) Method and device for generating topological graph and method and device for determining faults
US9832076B2 (en) Resource change management in machine to machine network
CN110990205B (en) Interface call testing method, device and computer readable storage medium
CN101877696B (en) Equipment and method for reconfiguring false response messages under network application environment
CN106911693B (en) Method and device for detecting hijacking of webpage content and terminal equipment
CN111399756B (en) Data storage method, data downloading method and device
CN110120971B (en) Gray scale publishing method and device and electronic equipment
CN112115103B (en) File address display method and device, electronic equipment and readable storage medium
CN112565406B (en) Gray release method, gray release system and electronic equipment
US10931688B2 (en) Malicious website discovery using web analytics identifiers
JP6779307B2 (en) Method and device for page display
CN109446445B (en) Resource acquisition method and device
CN111694550A (en) Page display control method, device and system
CN113301155A (en) Data routing method, device, equipment and storage medium
CN112685211A (en) Error information display method and device, electronic equipment and medium
WO2017149159A1 (en) Counterfeit electronic device detection
CN111367606A (en) Application page display method, device, terminal and medium
CN113609516B (en) Information generation method and device based on abnormal user, electronic equipment and medium
CN108737350B (en) Information processing method and client
US9986409B2 (en) Method and system for discovering and connecting device for streaming connection with a computerized communication device
CN114915565A (en) Method and system for debugging network
CN114401320A (en) Sub-application access method, system, block chain platform, gateway and storage medium
CN111767178A (en) Physical machine performance testing method and device
CN110874305A (en) User operation recording method and device and server

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