CN112115103B - 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
CN112115103B
CN112115103B CN202010911618.9A CN202010911618A CN112115103B CN 112115103 B CN112115103 B CN 112115103B CN 202010911618 A CN202010911618 A CN 202010911618A CN 112115103 B CN112115103 B CN 112115103B
Authority
CN
China
Prior art keywords
service
target
address
interface
json file
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
CN202010911618.9A
Other languages
Chinese (zh)
Other versions
CN112115103A (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

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 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 an interface of each target service in a service registry of a service grid, obtaining the service address and the interface path prefix corresponding to each target service from the service registry 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 and the interface path prefix corresponding to each target service. The user can check the interface information of a plurality of back-end services without inputting different access addresses, so that the time and labor cost required by the user to check the plurality of interface information are reduced, and the user is not required to record and maintain more access addresses.

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 method and apparatus for displaying a file address, an electronic device, and a readable storage medium.
Background
In the service development, when the back-end service and the front-end engineering carry out interface joint debugging, an interface document corresponding to the back-end service needs to be provided, and the interface document contains the latest definition and introduction of the back-end service. For example, interface information of an interface provided by the back-end service, such as a uniform resource locator (URL, uniform Resource Locator), request parameters, and return parameters, is recorded in the interface document.
In the prior art, for a back-end service integrated with a Swagger plug-in, after the back-end service is located on a physical machine, the interface information of an interface can be automatically acquired by starting the back-end service. 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 }: { port of backend service }/Swagger-ui.html of the physical machine deployed by backend service a, for example, start backend service a on the physical machine 1 deployed by backend service a, and manually input the IP address of the physical machine 1, the port of backend service a, and the default path Swagger-ui.html stored in the Interface document of backend service a in the browser, and the Swagger-User Interface (Swagger-UI) service may obtain Interface information in the Interface document of backend service a and display the Interface information in the Interface document of backend service a in the Swagger-UI page provided by the Swagger-UI service.
The inventors have found that in the process of implementing the present invention, at least the following problems exist in the prior art:
because a service integrated with the Swagger plug-in corresponds to a Swagger-UI service, a Swagger-UI service can only automatically acquire interface information of a back-end service corresponding to the Swagger-UI service, if a front-end engineer needs to acquire the interface information of a plurality of back-end services, different access addresses need to be manually input, and therefore, the manual input of different access addresses is laborious and time-consuming. Moreover, as the number of back-end services increases, the number of access addresses corresponding to different back-end services requiring record maintenance increases, so that record maintenance of access addresses is complicated.
Disclosure of Invention
The embodiment of the invention aims to provide a file address display method, a device, electronic equipment and a readable storage medium, which are used for solving the problems that in the prior art, manual recording and maintenance of access addresses of different back-end services are complex, and manual input of the access addresses of the different back-end services is performed to acquire interface information of the different services, so that the process is laborious and time-consuming, and the recording and maintenance of more access addresses are complex, and the specific technical scheme is as follows:
in a first aspect of the present invention, there is provided a method for displaying a file address, which is executed on 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 target service and an interface path prefix of an interface of each target service 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 registry 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 and the interface path prefix corresponding to each target service.
In a second aspect of the present invention, there is also provided a file address display device, provided in a server deployed with a service grid, including:
the system comprises a first acquisition module, a second acquisition module and a first storage module, wherein the first acquisition module is used for 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;
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;
the second acquisition module is used for acquiring the service address and the interface path prefix corresponding to each target service from the service registration center through the 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 and the interface path prefix corresponding to each target service.
In yet another aspect of the present invention, there is also provided a computer readable storage medium having instructions stored therein, which when executed on a computer, cause the computer to perform any one of the above-described file address display methods.
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 above-described file address display methods.
According to the file address display method provided by the embodiment of the invention, the service address of each target service and the interface path prefix of each target service are obtained, the service address of each target service and the interface path prefix of the interface of each target service are stored in the service registry of the service grid, the service address and the interface path prefix corresponding to each target service are obtained from the service registry 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, the JSON file addresses of a plurality of target services are displayed simultaneously, and interface information of each target service can be checked. In the prior art, if front-end engineering personnel need to acquire interface information of a plurality of back-end services, different access addresses need to be manually input, namely, users do not need to input different access addresses, the interface information of the plurality of back-end services can be checked, time and labor cost required by the users to check the plurality of interface information are reduced, and the users do not need to record and maintain more access addresses.
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 which a file address display method provided in an embodiment of the present invention is based;
FIG. 2 is a flowchart illustrating steps of a method for displaying a file address 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 diagram of a file address display device according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the accompanying 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 which a file address display method according to an embodiment of the present invention is provided. The system architecture diagram includes a service grid and a physical machine (the physical machine is, for example, a server shown in fig. 1) deployed with a service a, which is a service not deployed in the service grid (a service not deployed in the service grid may be regarded as an external service), wherein the service not deployed in the service grid may be plural, and only the service a is shown in fig. 1. A plurality of services may be deployed in the service grid (the services deployed in the service grid may be considered internal services), and only the service B deployed in the service grid is shown in fig. 1. Where Service Mesh refers to a configurable infrastructure layer for micro-Service applications. It enables smoother, more reliable and faster communication between each microservice. The service grid may provide a range of functions such as service discovery, load balancing, encryption, authentication, authorization, support for fuse mode (Circuit Breaker Pattern), and others. The service a and the Swagger plug-in can be integrated, and the Swagger plug-in obtains 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. Likewise, service B is integrated with Swagger plug-in, and interface information of service B is saved in JSON file B. Wherein, service A and service B are both services that need to provide interface documents. Among them, swagger plug-in is a popular application program interface (API, application Programming Interface) management tool in the world.
The server deployed with the service a may read configuration information of the interface of the service a to obtain an 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, a developer may assign a 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 service a to an external service proxy component in the service grid, where the external service proxy component stores the service address and the interface path prefix corresponding to 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.
The Swagger UI service is developed in the service grid, and is a set of Web applications which can show graceful documents based on the Swagger-complex API. 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 into an address field of the Swagger UI.html page, and the Swagger UI service can acquire service addresses of all services stored in a service registry and interface path prefixes corresponding to the service addresses through a get method of a Swagger resource provider interface of the Swagger UI framework. And determining 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 by the Swagger UI service, 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, interface path prefix a is/apis/video), and service B corresponds to service address B and interface path prefix B (service B is a service providing picture service, interface path prefix B is/apis/image). The Swagger UI service may determine that JSON file address a corresponding to service a is a service address a/interface path prefix a/preset path, and JSON file address B corresponding to service B is a service address B/interface path prefix B/preset path. For example, if the internet protocol (IP, internet Protocol) address of service address a is 10.10.10.10 and the port is 8080, service a is a service providing video service, and the interface path prefix is: if the preset path is/Swagger/api-doc, the JSON file address A is: 10.10.10.10:8080/apis/video/Swagger/api-doc. The JSON file address B corresponding to service B can also be determined. The server of the deployed 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 includes interface information of the interface of the service a, and the JSON file B includes interface information of the interface of the service B.
After determining the JSON file address corresponding to each service, the Swagger UI service may display the JSON file address corresponding to each service. For example, after the Swagger UI service JSON file address a and JSON file address B, the JSON file address a and JSON file address B are displayed by a drop-down box. Therefore, the method and the system can realize the simultaneous display of the JSON file addresses of a plurality of services, namely realize the unified management of the JSON file addresses of the plurality of services, so that a user can simultaneously view the JSON file addresses of the plurality of services, and the time and labor cost required by the user to view 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 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 method has the advantages that the JSON file addresses corresponding to the services can be uniformly managed through the Swagger UI service in the service grid, so that the JSON file addresses corresponding to the services are displayed through one Swagger UI service, therefore, only one access address corresponding to the Swagger UI service is needed to be memorized, the JSON file addresses corresponding to the services can be checked, interface information of each service is not needed to be checked, as in the prior art, if front-end engineering personnel need to acquire the interface information of a plurality of rear-end services, different access addresses need to be manually input, and more access addresses need not to be recorded and maintained, and therefore, labor and time cost are saved.
The user can conveniently select one JSON file address from the JSON file addresses corresponding to each service displayed by the Swagger UI service, so that the Swagger UI service can acquire the JSON file corresponding to the JSON file address selected by the user, generate an interface document according to the JSON file corresponding to the JSON file address selected by the user, and display the interface document. If the user needs to check the interface document corresponding to other JSON file addresses except the currently selected JSON file address, only one JSON file address needs to be reselected from the other JSON file addresses. Therefore, the user can check the JSON file addresses corresponding to all the services stored in the service registry by memorizing the access addresses corresponding to the Swagger UI service, so that the interface documents corresponding to the JSON file addresses can be checked according to the requirements.
Based on fig. 1, an embodiment of the present invention provides a method for displaying a file address. Referring to fig. 2, fig. 2 is a flowchart illustrating steps of a method for displaying a file address according to an embodiment of the present invention. The method may be performed by a server deployed with a service grid. The method comprises the following steps:
step 201, obtaining 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.
Wherein the target service comprises an external service not deployed in the service grid and/or an internal service deployed in the service grid. The interface path prefix is used for representing the storage path identification of the JSON file corresponding to the service on the server where the service is deployed. For example, after the service a is integrated with the Swagger plug-in, the service a is deployed in the server shown in fig. 1, the Swagger plug-in may read configuration information of the service a, so as to obtain an interface path prefix of an interface of the service a in the configuration information, and the Swagger plug-in may obtain 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. The storage path corresponding to the service a includes an interface path prefix and a preset path, for example, in combination with the above description of the example, the interface path prefix is: the preset path is/Swagger/api-doc, and the storage path corresponding to the service A is: per apis/video/Swagger/api-doc.
For example, referring to fig. 1, the target service includes a service a, which is an external service not deployed in the service grid, and a service B, which is an internal service deployed in the service grid. An external service proxy component (an external service proxy component refers to a ServiceEntry component) deployed in the service grid can acquire a service address of a service a (the service a is an external service) and an interface path prefix of an interface of the service a; the service grid may obtain the service address of service B deployed in the service grid, and the interface path prefix of the 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.
In connection with the above example description, 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 a service address and an interface path prefix corresponding to each target service from a service registry through a service discovery function of the service grid.
Step 204, displaying the JSON file address corresponding to each target service according to the service address and the interface path prefix corresponding to each target service.
The JSON file address corresponding to each target service can be displayed in a drop-down list mode, namely the drop-down list can comprise the JSON file address corresponding to each target service.
According to the file address display method provided by the embodiment, the service address of each target service and the interface path prefix of each target service are obtained, the service address of each target service and the interface path prefix of the interface of each target service are stored in the service registry of the service grid, the service address and the interface path prefix corresponding to each target service are obtained from the service registry 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, the JSON file addresses of a plurality of target services are displayed simultaneously, and interface information of each target service can be checked. In the prior art, if front-end engineering personnel need to acquire interface information of a plurality of back-end services, different access addresses need to be manually input, namely, according to the method provided by the embodiment, users do not need to input different access addresses, the interface information of the plurality of back-end services can be checked, time and labor cost required by the users to check the plurality of interface information are reduced, and the users do not need to record and maintain more access addresses.
Referring to fig. 3, fig. 3 is a flowchart illustrating steps of another method for displaying a file address according to an embodiment of the present invention. The method comprises the following steps:
step 301, accessing an external service to a service grid through an external service proxy component in the service grid.
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 a service address and an interface path prefix of the external service with the external service proxy 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 (because the access addresses are more and more, the time required for searching the access address corresponding to the service is more); then, the access address corresponding to the service is manually input in the browser, the Swagger UI service can obtain the interface information in the interface document of the service, and the interface information of the interface document of the service is displayed in the Swagger-UI page provided by the Swagger-UI service.
In the prior art, the access address corresponding to the service needs to be manually defined in the code corresponding to the service, so when 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 document (including the interface information) of the service is obtained again, so when the interface information of some services is modified, the process of obtaining the modified interface document of the services is troublesome.
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; when the external service is deleted, the external service proxy component can not acquire the service address of the deleted external service and the interface path prefix of the interface of the deleted external service; after modifying the interface information of the service, the external service proxy 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, when the service is added or deleted or the interface information of the service is modified, the service address of the overseas service and the interface path prefix of the interface of the service, which are acquired from the overseas service agent component by the service registry, are both current and up-to-date, that is, the service address of the external service and the interface path prefix of the interface of the service stored in the service registry are both current and up-to-date. If the internal service needs to be added, a developer only needs to arrange the internal service in the service grid, after the Swagger UI service is started, the Swagger UI service can acquire service addresses and interface path prefixes of all external services in the service registration center and service addresses and interface path prefixes of all internal services through a service discovery function of the service grid, and display JSON file addresses of all services in the service registration center, wherein the JSON file addresses comprise the service addresses of the services and the interface path prefixes of the services. If the user needs to check the interface document corresponding to other JSON file addresses except the currently selected JSON file address, only one JSON file address is needed to be reselected from the other JSON file addresses, and the Swagger UI service is not needed to be restarted. Therefore, the user can check the JSON file addresses corresponding to all the services stored in the service registry by memorizing the access addresses corresponding to the Swagger UI service, so that the interface documents corresponding to the JSON file addresses can be checked according to the requirements.
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, 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.
Where the target service includes an external service and an internal service, step 302 may be implemented by:
the service address of each external service, and the interface path prefix of each external service's interface, and the service address of each internal service deployed in the service grid, and the interface path prefix of each internal service's interface are obtained.
It should be noted that, if there is no at least one external service that is not deployed in the service grid, the plurality of services in step 302 includes a plurality of internal services deployed in the service 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 where the target service includes an external service and an internal service, it is necessary to store a service address of each external service and an interface path prefix of an interface with each external service in the service registry, and store a service address of each internal service and an interface path prefix of an interface with each internal service in the service registry.
Step 304, the service address and the interface path prefix corresponding to each target service are obtained from the service registry through the service discovery function of the service grid.
Step 305, displaying JSON file addresses corresponding to each target service according to the service addresses and the interface path prefixes corresponding to each target service.
The JSON file address corresponding to each target service can be displayed through one Swagger user interface service (the Swagger user interface service is a 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 only needs to memorize the Swagger address corresponding to the one Swagger UI service (the Swagger address is the access address corresponding to the Swagger UI service) and can look up the JSON file address corresponding to each target service, so that the JSON file address is selected from the JSON file addresses corresponding to the displayed multiple target services according to requirements, and the Swagger UI service obtains the JSON file corresponding to the JSON file address according to the JSON file selected by the user, generates an interface document and displays the interface document according to the JSON file.
Step 306, determining a target JSON file address selected by the user from each JSON file address.
Step 307, responding to the target JSON file address, and acquiring the target JSON file corresponding to the target JSON file address.
Step 307 may be implemented by:
when at least one external service is included in the plurality of target services, if the target JSON file address is a JSON file address corresponding to the target external service in the at least one external service, sending a request including the target JSON file address to a server where the target external service is deployed;
and receiving a target JSON file sent by a server deployed by the target external service, wherein the target JSON file is obtained according to a target JSON file address included in a request and the server deployed by the target external service responds to the request.
Referring to fig. 1, when a service a is included in a plurality of target services, if the target JSON file address is the JSON file address corresponding to the service a. That is, if the JSON file address selected by the user from the displayed plurality of JSON file addresses is the JSON file address corresponding to the service a, and 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 a server (i.e., the server in fig. 1) where the target external service is deployed; after receiving a request comprising 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 a 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 sending a request including the target JSON file address to the server where the target service is deployed may be implemented by:
the service grid sends a request to a server corresponding to the target JSON file address through an external agent component;
accordingly, receiving the target JSON file sent by the server deployed by the target external service may be achieved by:
an external service agent component (the external service agent component is a ServiceEntry component) receives a target JSON file corresponding to the target JSON file address and sent by a server corresponding 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 external services of the grid (domain name or IP + port) are defined in ServiceEntry. And creates a corresponding traffic policy component VirtualService, virtualService that defines which prefix's request in the traffic coming in through the mesh gateway is forwarded to ServiceEntry and finally to external services.
For example, service a is deployed in a server with IP of 10.10.10.10 and port 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. 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 obtains the JSON file of the service A.
And 308, generating an interface document according to the target JSON file, and displaying the interface document.
According to the file address display method, the JSON file addresses of the plurality of target services are displayed simultaneously, namely unified management of the JSON file addresses of the plurality of target services is achieved, so that a user can simultaneously check the JSON file addresses of the plurality of target services, time and labor cost required by the user to check a plurality of interface files are reduced, the user can conveniently and quickly select the needed JSON file addresses from the displayed JSON file addresses of the plurality of target services, and the interface files corresponding to the selected JSON file addresses can be checked.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a file address display device provided in an embodiment of the present invention, where the device is disposed on a server where a service grid is deployed, and the device 400 includes:
a first obtaining module 410, configured to obtain a service address of each of a plurality of target services and an interface path prefix of each of the target services, 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 where the target service is deployed;
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 of the target services through a service discovery function of the service grid;
and a display module 440, configured to display the JSON file address corresponding to each target service according to the service address and the interface path prefix corresponding to each target service.
Optionally, if the target service includes an external service that is not deployed in the service grid, the method further includes:
and the access module is used for accessing the external service to the service grid through an external service agent component in the service grid.
Optionally, the method further comprises:
the determining module is used for determining a target JSON file address selected by a user from each JSON file address;
the third acquisition module is used for responding to the target JSON file address and acquiring 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, when the plurality of target services include at least one external service, the third obtaining module is specifically configured to send, if the target JSON file address is a JSON file address corresponding to a target external service in the at least one external service, a request including 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 according to the target JSON file address included in the request and the response of the server deployed by the target external service to 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.
The embodiment of the invention also provides an electronic device, as shown in fig. 5, and fig. 5 is a schematic structural diagram of another electronic device provided in the embodiment of the invention. Comprising a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502, the memory 503 communicate with each other via the communication bus 504,
a memory 503 for storing a computer program;
the processor 501 is configured to execute the program stored in the memory 503, and implement 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 target service and an interface path prefix of an interface of each target service 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 registry 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 and the interface path prefix corresponding to each target service.
The communication bus mentioned by the above terminal may be a peripheral component interconnect standard (Peripheral Component Interconnect, abbreviated as PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, abbreviated as EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the terminal and other devices.
The memory may include random access memory (Random Access Memory, RAM) or 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 aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU for short), a network processor (Network Processor, NP for short), etc.; but also digital signal processors (Digital Signal Processing, DSP for short), application specific integrated circuits (Application Specific Integrated Circuit, ASIC for short), field-programmable gate arrays (Field-Programmable GateArray, FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
In yet another embodiment of the present invention, a computer readable storage medium is provided, in which instructions are stored, which when executed on a computer, cause the computer to perform the file address display method according to any one of the above embodiments.
In yet another embodiment of the present invention, a computer program product containing instructions that, when executed on a computer, cause the computer to perform the file address display method of any of the above embodiments is also provided.
In the above embodiments, it may be implemented in whole or in part 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, produces a flow or function in accordance with embodiments of the present invention, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more 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)), etc.
It is noted that relational terms such as first and second, and the like are 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. Moreover, 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 one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments.
The foregoing description is only of the preferred embodiments of the present invention and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims (8)

1. A file address display method, which is executed on a server where a service grid is deployed, comprising:
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 target service and an interface path prefix of an interface of each target service 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 registry through a service discovery function of the service grid;
displaying the JSON file address corresponding to each target service according to the service address and the interface path prefix corresponding to each target service;
determining a target JSON file address selected by a user from each JSON file address;
responding to the target JSON file address, when at least one external service is included in the plurality of target services, 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;
receiving a target JSON file sent by a server deployed by the target external service, wherein the target JSON file is obtained according to a target JSON file address included in the request and the response of the server deployed by the target external service to the request;
and generating an interface document according to the target JSON file, and displaying the interface document.
2. The method of claim 1, further comprising, before said obtaining a service address for each of said target services of said plurality of target services and an interface path prefix for each of said target services, if said target services comprise external services that are not deployed in said service grid:
the external service is accessed to the service grid through an external service proxy component of the service grid.
3. The method of claim 1, wherein the obtaining, by the service discovery function of the service grid, the service address and the 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 registry in real time or periodically through a service discovery function of the service grid.
4. A file address display device provided in a server on which a service grid is deployed, comprising:
the system comprises a first acquisition module, a second acquisition module and a first storage module, wherein the first acquisition module is used for 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;
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;
the second acquisition module is used for acquiring the service address and the interface path prefix corresponding to each target service from the service registration center through the service discovery function of the service grid;
the display module is used for displaying the JSON file address corresponding to each target service according to the service address and the interface path prefix corresponding to each target service;
the determining module is used for determining a target JSON file address selected by a user from each JSON file address;
the third acquisition module is used for responding to the target JSON file address and acquiring a target JSON file corresponding to the target JSON file address;
the display module is used for generating an interface document according to the target JSON file and displaying the interface document;
the third obtaining module is specifically configured to, when at least one external service is included in the plurality of target services, send a request including the 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 according to the target JSON file address included in the request and the response of the server deployed by the target external service to the request.
5. The apparatus of claim 4, further comprising, if the target service comprises an external service that is not deployed in the service grid:
and the access module is used for accessing the external service to the service grid through an external service proxy component of the service grid.
6. The apparatus according to claim 4, 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 of the target services from the service registry through a service discovery function of the service grid.
7. The electronic equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
a processor for carrying out the method steps of any one of claims 1-3 when executing a program stored on a memory.
8. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-3.
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 CN112115103A (en) 2020-12-22
CN112115103B true 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)

Families Citing this family (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
CN114387940B (en) * 2022-02-25 2023-09-15 卡莱特云科技股份有限公司 Partition display updating method, playing box and display system of LED display screen

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
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
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

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7454519B2 (en) * 2002-03-22 2008-11-18 Motorola, Inc. Method for automatically allocating address prefixes
US20110087789A1 (en) * 2009-10-13 2011-04-14 Nokia Corporation Subscription based network routing tables and enforcement for overlay networks
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
US11010434B2 (en) * 2017-12-21 2021-05-18 Kopjra S.R.L. Process for legal certification of successful interaction

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
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
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

Also Published As

Publication number Publication date
CN112115103A (en) 2020-12-22

Similar Documents

Publication Publication Date Title
US9832076B2 (en) Resource change management in machine to machine network
US10783212B2 (en) Method and apparatus for realizing communication between web page and native application, and electronic device
CN111399756B (en) Data storage method, data downloading method and device
CN109815261B (en) Global search function implementation and data real-time synchronization method and device and electronic equipment
WO2013143403A1 (en) Method and system for accessing website
CN110990205A (en) Interface call testing method, device and computer readable storage medium
WO2020062582A1 (en) Methods for information drainage, requesting transmission and communication acceleration, and drainage and node server
CN112565406B (en) Gray release method, gray release system and electronic equipment
CN112115103B (en) File address display method and device, electronic equipment and readable storage medium
WO2014040080A1 (en) Methods for facilitating web page image hotspots and devices thereof
US10931688B2 (en) Malicious website discovery using web analytics identifiers
CN110968356A (en) Method and device for acquiring configuration information
CN109446445B (en) Resource acquisition method and device
JP6779307B2 (en) Method and device for page display
CN110708402A (en) Accessible resource display method and device and resource access system
US20170264666A1 (en) Method and associated server for providing user-friendly operation
US10455010B2 (en) Information processing apparatus and non-transitory computer readable medium
CN113301155A (en) Data routing method, device, equipment and storage medium
CN108737350B (en) Information processing method and client
CN110691023B (en) Address system
US11262956B2 (en) Communication system, server system, and terminal apparatus
US10187262B2 (en) Automated multi-user system detection
CN114401320A (en) Sub-application access method, system, block chain platform, gateway and storage medium
CN113609516A (en) Information generation method and device based on abnormal user, electronic equipment and medium
CN115277408B (en) Agent configuration information updating method, device, equipment and storage medium

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