CN109902257B - Resource access method, device, computer equipment and storage medium - Google Patents

Resource access method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN109902257B
CN109902257B CN201910150685.0A CN201910150685A CN109902257B CN 109902257 B CN109902257 B CN 109902257B CN 201910150685 A CN201910150685 A CN 201910150685A CN 109902257 B CN109902257 B CN 109902257B
Authority
CN
China
Prior art keywords
function
target
resource access
module
webpage
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
CN201910150685.0A
Other languages
Chinese (zh)
Other versions
CN109902257A (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.)
Chengdu Gaoxin Daan Medical Science Inspection Co ltd
Shanghai Daan Medical Science Examination Institute Co ltd
Yunkang Health Industry Group Co ltd
Yunkang Health Industry Investment Co ltd
Guangzhou Daan Center For Clinical Laboratory Co ltd
Original Assignee
Chengdu Gaoxin Daan Medical Science Inspection Co ltd
Shanghai Daan Medical Science Examination Institute Co ltd
Yunkang Health Industry Group Co ltd
Yunkang Health Industry Investment Co ltd
Guangzhou Daan Center For Clinical Laboratory 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 Chengdu Gaoxin Daan Medical Science Inspection Co ltd, Shanghai Daan Medical Science Examination Institute Co ltd, Yunkang Health Industry Group Co ltd, Yunkang Health Industry Investment Co ltd, Guangzhou Daan Center For Clinical Laboratory Co ltd filed Critical Chengdu Gaoxin Daan Medical Science Inspection Co ltd
Priority to CN201910150685.0A priority Critical patent/CN109902257B/en
Publication of CN109902257A publication Critical patent/CN109902257A/en
Application granted granted Critical
Publication of CN109902257B publication Critical patent/CN109902257B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Transfer Between Computers (AREA)
  • Stored Programmes (AREA)

Abstract

The application relates to a resource access method, a resource access device, computer equipment and a storage medium. The method comprises the following steps: running a target webpage on a frame component in a webpage application, wherein an interface protocol between the webpage application and the frame component is registered in the webpage application; calling an interface protocol, and acquiring a resource access instruction input by a user on a target webpage through a frame component; the resource access instruction comprises a function parameter of a function to be executed; and finally, the webpage application on the computer equipment executes the resource access operation of the corresponding function according to the function parameters. The resource access method is low in technical difficulty in implementation and high in resource access efficiency.

Description

Resource access method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer application technologies, and in particular, to a resource access method and apparatus, a computer device, and a storage medium.
Background
With the development of internet technology, the variety of service demands of users on the internet is increasing, for example, users can implement service operations such as a photographing function, a printing function, an audio recording function, and the like through the internet.
At present, a user can open a web page on a computer (personal computer, PC) end and input a related service operation instruction on the web page, and under the application, the PC end installs a corresponding plug-in on the web page according to the service operation instruction, and accesses various resources on the PC end through the plug-in, so that the user can perform corresponding service work through a login page.
However, the method for accessing the PC side resource through the plug-in has relatively high technical difficulty and poor compatibility, and in addition, if the plug-in is too large, the loading speed is also affected, and the access efficiency is reduced.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a resource access method, device, computer device, and storage medium, which can enable a web page to directly access a PC resource without installing a plug-in, thereby improving resource access efficiency.
In a first aspect, a method for resource access, the method comprising:
running a target web page on a frame component in a web application; the webpage application is registered with an interface protocol between the webpage application and the frame component;
calling the interface protocol, and acquiring a resource access instruction input by a user on the target webpage through the frame component; the resource access instruction comprises a function parameter of a function to be executed;
and executing the resource access operation of the corresponding function according to the function parameter.
In one embodiment, before the target webpage is run on the framework component in the webpage application, the method includes:
initializing the frame assembly to obtain an initialized frame assembly; the initialization processing comprises language initialization and address initialization;
and registering the interface protocol on the initialized framework component.
In one embodiment, the function parameters comprise a function identifier and a function method parameter; the executing the resource access operation of the corresponding function according to the function parameter comprises:
according to the function identification, performing dependence injection on the function corresponding to the function identification to obtain a target function module;
performing reflection processing on the target function module to obtain each function method contained in the target function module;
determining a target function method from the function methods according to the function identification;
and analyzing the function method parameters by adopting the target function method to obtain a corresponding function, and executing resource access operation according to the corresponding function.
In one embodiment, the performing dependent injection on the function corresponding to the function identifier according to the function identifier to obtain a target function module includes:
acquiring all functions corresponding to the function identification from the function module configuration file according to the function identification;
and packaging all functions corresponding to the function identification by adopting a preset container to obtain a target function module.
In one embodiment, before the performing dependent injection on the function module corresponding to the function identifier according to the function identifier to obtain the target function module, the method further includes:
judging whether the function identification is legal or not;
and if so, executing the step of performing dependent injection on the functional module corresponding to the functional identifier according to the functional identifier to obtain a target functional module.
In one embodiment, after the performing the reflection processing on the target function module to obtain each function method included in the target function module, the method further includes:
and storing each function method and the corresponding function identification in a cache in a list form.
In one embodiment, the method further comprises:
obtaining the result of the resource access operation;
and displaying the result of the resource access operation on the target webpage by a webpage call function.
In a second aspect, a resource access apparatus, the apparatus comprising:
the running module is used for running the target webpage on the frame component in the webpage application; the webpage application is registered with an interface protocol between the webpage application and the frame component;
the acquisition module is used for calling the interface protocol and acquiring a resource access instruction input by a user on the target webpage through the frame component; the resource access instruction comprises a function parameter of a function to be executed;
and the execution module is used for executing the resource access operation of the corresponding function according to the function parameter.
A third aspect comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the resource access method according to any embodiment of the first aspect when executing the computer program.
In a fourth aspect, a computer-readable storage medium has stored thereon a computer program which, when executed by a processor, implements the resource access method of any of the embodiments of the first aspect.
According to the resource access method, the resource access device, the computer equipment and the storage medium, the process that the webpage application directly accesses the external resource is achieved, in the process, because the webpage application registers the interface protocol which is required to be used when the webpage application communicates with the frame component, the target webpage can run on the frame component, the target webpage can achieve data interaction with the webpage application through the frame component, and because the webpage application can perform corresponding resource access operation, when the target webpage achieves data interaction with the webpage application, the computer equipment can further control the webpage application to perform corresponding resource access operation through interaction data. Therefore, in the resource access process, the access operation on the resource can be realized only by calling the interface protocol by the target webpage, so that compared with the traditional method for realizing resource access by installing the plug-in on the webpage, the resource access method has the advantages of lower technical difficulty and higher compatibility.
Drawings
FIG. 1 is a schematic diagram illustrating an internal structure of a computer device according to an embodiment;
FIG. 2 is a flow diagram of a method for resource access according to an embodiment;
FIG. 3 is a flow diagram of a method for resource access according to an embodiment;
FIG. 4 is a flowchart of one implementation of S103 in the embodiment of FIG. 1;
FIG. 4A is a functional parameter list provided by one embodiment;
FIG. 5 is a flowchart of one implementation of S301 in the embodiment of FIG. 4;
FIG. 6 is a flowchart of another implementation of S301 in the embodiment of FIG. 4;
FIG. 7 is a flowchart of a method for resource access provided by an embodiment;
FIG. 8 is a general flowchart of a method for resource access provided by one embodiment;
fig. 9 is a schematic structural diagram of a resource access device according to an embodiment;
fig. 10 is a schematic structural diagram of a resource access device according to an embodiment;
fig. 11 is a schematic structural diagram of a resource access device according to an embodiment;
fig. 12 is a schematic structural diagram of a resource access device according to an embodiment;
fig. 13 is a schematic structural diagram of a resource access device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The resource access method provided by the application can be applied to the computer equipment shown in FIG. 1. The computer device may be a terminal, the internal structure of which may be as shown in fig. 1. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a resource access method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 1 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
The following describes in detail the technical solutions of the present application and how the technical solutions of the present application solve the above technical problems by embodiments and with reference to the drawings. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments.
Fig. 2 is a flowchart of a resource access method according to an embodiment, where an execution subject of the method is a web application on the computer device in fig. 1, and the method relates to a specific process in which a user accesses an external resource by using the web application on the computer device. As shown in fig. 2, the method specifically includes the following steps:
s101, running a target webpage on a frame component in a webpage application; the web application is registered with an interface protocol between the web application and the framework component.
The web application is an application program installed on the computer device, and the application program can show a web page to a user, and in the process of showing the web page, the user can also input an instruction on the web page, so that the web application can access an external resource through the input instruction on the web page, namely, corresponding functional operation is executed. For example, when the computer device is connected to the printing device and the user inputs an instruction to print a web page on a web page of the web application, the web application may implement a function of printing the web page according to the instruction to print the web page; for another example, when a camera with a video recording function is installed on the computer device and a user inputs a video recording instruction on a webpage of the webpage application, the webpage application can realize the video recording function according to the video recording instruction. The framework component is an open source component written by CefSharp, and specifically can be a WebBrowser component, and the framework component in this embodiment is embedded in a web application, so that a web page can run on the web application, and therefore the web page can interact with the web application through the framework component.
Optionally, the method may be represented by winapi. invoke (key, param), where key and param are parameters that can be transmitted and are specified by the interface protocol, and the key may be a keyword that is specified in advance during program development and docking and is used to identify different functions included in the web application; param is used for delivering specific function methods corresponding to the corresponding functions to the web application. For example, when a user performs a microscope photographing function using a web application on a computer device, parameters in the above interface protocol winapi. invoke (key, param) may be represented by the following data in table 1:
TABLE 1
Figure BDA0001981398650000071
In this embodiment, when the computer device starts the web application, the web application may run the target web page on the frame component according to the preset address, and optionally, the user may also input the address of the web page on the web application when the computer device starts the web application, and the web application runs the target web page on the frame component according to the address of the web page. In addition, an interface protocol between the web application and the frame component is registered in the web application, and the web application can realize data interaction between the web application and the frame component according to the interface protocol, so that data interaction between the web application and a web page on the frame component can be realized.
S102, calling an interface protocol, and acquiring a resource access instruction input by a user on a target webpage through a frame component; the resource access instruction includes a function parameter of the function to be performed.
The resource access instruction is used for instructing the webpage application to execute corresponding resource access operation. The function parameters may be parameters predefined by the web application at the time of development, and are used to instruct the web application to identify different functions and perform different functional operations.
In this embodiment, when a user inputs a resource access instruction on a target webpage, the target webpage may call an interface protocol registered on the frame component through js, and transfer all information included in the resource access instruction to the webpage application through the interface protocol, so that the webpage application may execute a corresponding resource access operation according to the resource access instruction.
And S103, executing resource access operation of the corresponding function according to the function parameter.
Wherein a resource access operation is a functional operation that may include a plurality of functional operations. For example, the audio recording, the microscope photographing, the video recording, the printing and other functional operations.
Based on the above embodiment, optionally, the target web page may call an interface protocol through js, and transfer the function parameter in the resource access instruction to the web application through the interface protocol, so that the web application may identify the corresponding function according to the function parameter, and execute the resource access operation of the corresponding function according to the identified function.
In the process, because the interface protocol required for communication between the web application and the frame component is registered in the web application and the target web page can run on the frame component, the target web page can realize data interaction with the web application through the frame component, and because the web application can execute corresponding resource access operation, when the target web page realizes data interaction with the web application, the computer device can further control the web application to execute the corresponding resource access operation through the interaction data. Therefore, in the resource access process, the access operation on the resource can be realized only by calling the interface protocol by the target webpage, so that compared with the traditional method for realizing resource access by installing the plug-in on the webpage, the resource access method has the advantages of lower technical difficulty and higher compatibility.
In one embodiment, when the computer device starts the web application and before the web application runs the target web page on the frame component, the web application further needs to do the following operations, as shown in fig. 3, including:
s201, initializing the frame assembly to obtain an initialized frame assembly; the initialization process includes language initialization and address initialization.
In this embodiment, when the computer device starts the web application, the web application needs to initialize the framework component first, and specifically, language initialization and address initialization can be performed on the framework component. During the language initialization, the languages that the web application can set for the frame component include: in practical applications, the language of the first language is the first language, and the second language is the second language. In the address initialization process, the web page application can pre-store the address of the web page to be displayed in the address configuration area in the frame component according to the actual application requirement, so that the frame component can directly run the web page corresponding to the address according to the address. It should be noted that, one web page address may be stored in the frame component in advance, and a plurality of web page addresses may also be stored in the frame component, which is not limited in this embodiment.
And S202, registering an interface protocol on the initialized framework component.
After the web application initializes the frame component, the web application may further register an interface protocol on the initialized frame component, so that the initialized frame component may communicate with the web application according to the interface protocol. In addition, when the frame component runs the target webpage, the frame component can also transmit the information on the target webpage to the webpage application, so that the target webpage can also indirectly communicate with the webpage application, and the webpage application can perform subsequent work according to the information on the target webpage.
Fig. 4 is a flowchart of an implementation manner of S103 in the embodiment of fig. 1, where the function parameter includes a function identifier and a function method parameter, and as shown in fig. 4, the step S103 "execute a resource access operation of a corresponding function according to the function parameter" includes:
s301, according to the function identification, performing dependence injection on the function corresponding to the function identification to obtain a target function module.
The function identifier is used to identify each function module included in the web application and a function method included in each function module, which may be represented by characters, numbers, letters, serial numbers, and the like. Specifically, one function identifier uniquely corresponds to one function method, a plurality of function identifiers may correspond to one function module, for example, as shown in the list shown in fig. 4A, all the function identifiers (002001, 002002 …) in the list correspond to one photographing function module, and the function identifier 002001 corresponds to a pathological photographing function method; the function label 002002 corresponds to a diagnostic imaging function method.
It should be noted that the web application in this embodiment may include a plurality of functional modules, which are used to perform different functional operations, for example, the functional module may be an audio recording module, a microscope photographing module, a video recording module, and the like. The target function module is one of the above function modules, which can be determined by the user according to the actual application requirements.
The above-mentioned dependent injection and named control inversion are design principles in object-oriented programming, and the dependent injection in this embodiment refers to a method for web application when creating each function module, which specifically includes: firstly, all the dependency relations of the corresponding functions are obtained, then the functions and all the dependency relations related to the functions are injected into a container, and finally, a function module is formed, and the dependency injection of the functions is completed.
In this embodiment, when the web application obtains the function identifier through the interface protocol, the function corresponding to the function identifier may be further searched according to the function identifier, and then the function is subjected to dependency injection, and all dependency relationships of the function and the function are injected into one container, so as to form a target function module.
And S302, performing reflection processing on the target function module to obtain each function method contained in the target function module.
The target function module involved in this embodiment is an independent dynamic link library (dll), and each target function module includes a plurality of specific function methods and function identifiers corresponding to the function methods. The reflection processing means that the web application reflects each function method and function identifier included in the dll-form target function module, and forms a list including each function method and function identifier in a cache of the computer device, so that the web application can acquire each function method according to the list.
In this embodiment, when the web application acquires the target function module, the target function module needs to be reflected, and each function method and function identifier included in the target function module are reflected to form a list, and then the web application can further search for a function method to be executed according to the list.
Optionally, in the step S302, "performing reflection processing on the target function module to obtain each function method included in the target function module" further includes: and storing each function method and the corresponding function identification in a cache in a list form.
In practical application, the target function module needs to be reflected each time the web application acquires the function method, and this process will greatly affect the program performance, so this embodiment further provides a resource access method, so that the web application does not need to reflect the target function module each time the web application acquires the function method, and the specific method is as follows: when the webpage application reflects a target function module for the first time, the function methods contained in the target function module and the corresponding function identifications can be stored in the cache of the computer equipment in a list form, so that the next time the webpage application needs to acquire the function methods contained in the target function module, the webpage application can directly acquire the function methods from the cache of the computer equipment without reflecting the target function module, resources are saved by the method, and the resource access efficiency is further improved.
S303, determining a target function method from the function methods according to the function identification.
When the web application acquires the reflection list, the list contains the function identifier corresponding to each function method, so that when the web application acquires the function identifier transmitted by the user through the web page, the web application can further search the function method corresponding to the function method from the reflection list according to the function identifier, and determine the function method as the target function method.
S304, analyzing the function method parameters by adopting a target function method to obtain corresponding functions, and executing resource access operation according to the corresponding functions.
The function method parameters are used for transmitting specific function methods corresponding to corresponding functions to the web application, and the specific function methods can be represented by characters, numbers, letters, serial numbers and the like.
In this embodiment, when the web application obtains the target function method, the target function method may be further used to analyze the function method parameters input by the user through the target web page, so as to obtain a function corresponding to the target function method, and then the web application may execute a corresponding resource access operation according to the function.
Fig. 5 is a flowchart of an implementation manner of S301 in the embodiment of fig. 4, and as shown in fig. 5, the step S301 "performing dependency injection on a function corresponding to a function identifier according to the function identifier to obtain a target function module" includes:
s401, according to the function identification, all functions corresponding to the function identification are obtained from the function module configuration file.
The function module configuration file is a configuration file in a web application, can be expressed by an auto fac. All functions corresponding to the function identifier refer to functions directly corresponding to the function identifier in the function module configuration file and functions having a dependency relationship with the function.
When the web application acquires the function identifier, the function corresponding to the function identifier may be further acquired from the function module configuration file according to the function identifier, and then the function having a dependency relationship with the function may be acquired according to the function. For example, when the web application acquires the photographing function according to a photographing function identifier, the web application also needs to acquire a photographing focusing function, a photographing picture saving function, and the like, which are dependent on the photographing function, according to the photographing function.
S402, packaging all functions corresponding to the function identification by adopting a preset container to obtain a target function module.
The preset container may be an auto fac container, or may be other types of containers, which is not limited in this embodiment.
When the web application obtains all functions corresponding to the function identifier according to the function identifier, the web application may use a preset container (e.g., an auto fac container) to encapsulate all the functions, so as to form a target function module, and enable the target function module to normally implement the corresponding functions.
Based on the foregoing embodiment, optionally, fig. 6 is a flowchart of another implementation manner of S301 in the embodiment of fig. 4, and as shown in fig. 6, in the foregoing S301, "perform dependency injection on a function corresponding to a function identifier according to the function identifier in a function parameter to obtain a target function module", further includes:
s501, judging whether the function identifier is legal, if so, executing S502; if not, go to S503.
When the web application acquires the function identifier which is transmitted by the user through the target web page, the web application also needs to judge whether the function identifier is legal, if the function identifier is a legal identifier, S502 is executed, the subsequent work is continued, and if the function identifier is an illegal identifier, S503 is executed, the subsequent work is stopped, and the acquisition of a new function identifier is waited again.
And S502, executing the step S301 of performing dependency injection on the functional module corresponding to the functional identifier according to the functional identifier to obtain the target functional module.
For details of this step, please refer to the above step S301, which is not described herein redundantly.
S503, discarding the function identifier.
The embodiment relates to the application condition of the webpage application when the received function identifier is an illegal identifier, and under the application, the webpage application can directly discard the illegal function identifier.
Fig. 7 is a flowchart of a resource access method according to an embodiment, where the method relates to a specific process of obtaining a result of a resource access operation by a target web page when a web page application runs the target web page. As shown in fig. 7, includes:
s601, obtaining the result of the resource access operation.
After the web application completes the function (e.g., the photographing function) corresponding to the function method, the web application may also return a result (e.g., a photographed picture) after completing the function to a target page running on the web application.
S602, displaying the result of the resource access operation on the target webpage by calling the function through the webpage.
The embodiment relates to a specific method for acquiring a resource access operation result of a target webpage running on a webpage application, which comprises the following steps: after the web application obtains the resource access operation result, the resource access operation result may be written into a web call function (e.g., js function), and then the target web page on the web application may obtain the resource access operation result by calling the web call function. Optionally, the js function may be expressed as: execute (key1, param1), wherein key1 is consistent with the content expressed by the key in the interface protocol described in the aforementioned S101, and is used to identify different functions in the web application; the param1 is inconsistent with what param in the interface protocol described in the foregoing S101 expresses, and the param1 adds data describing the result of the resource access operation on the basis of the param described in S101. For example, when a user performs a microscope photographing function using a web application on a computer device, a target web page on the web application calls the js function: when the photographed picture data is obtained, the parameters in the web (key1, Param1) may be represented by the following data in table 2:
TABLE 2
Figure BDA0001981398650000141
Comparing the Param parameter shown in table 1 with the Param1 parameter shown in table 2, it can be obtained that the Param1 parameter has one more item of "data" than the content included in the Param parameter, where the content included in the "data" is the content of the resource access operation result.
In addition, after the target webpage running on the webpage application acquires the resource access operation result according to the method, the resource access operation result can be further displayed in the corresponding display area of the target webpage so as to display the resource access result (for example, a photographed picture) to the user.
In summary, in conjunction with all the above embodiments, the present application provides a general flowchart of a resource access method, as shown in fig. 8, the method includes:
s701, starting a webpage application by computer equipment;
s702, the webpage application performs language initialization and address initialization processing on the frame assembly to obtain an initialized frame assembly;
s703, the webpage application registers an interface protocol on the initialized frame component;
s704, the webpage application runs a target webpage on the initialized frame component;
s705, calling an interface protocol by the target webpage to enable the webpage application to acquire a resource access instruction input by a user on the target webpage through the frame component; the resource access instruction comprises a function parameter of a function to be executed; the function parameters comprise function identification and function method parameters;
s706, judging whether the function identifier is legal or not by the webpage application; if not, executing S707, if legal, executing the steps of S708-S715;
s707, discarding the function identifier;
s708, the webpage application acquires all functions corresponding to the function identification from the function module configuration file according to the function identification;
s709, packaging all functions corresponding to the function identification by adopting a preset container to obtain a target function module;
s710, the webpage application performs reflection processing on the target function module to obtain each function method contained in the target function module;
s711, storing each function method and corresponding function identification in a cache in a list form by the webpage application;
s712, the webpage application determines a target function method from the function methods according to the function identification;
s713, analyzing the function method parameters by adopting a target function method to obtain corresponding functions, and executing resource access operation according to the corresponding functions;
s714, obtaining a result of the resource access operation;
and S715, calling a function through the webpage, and displaying the result of the resource access operation on the target webpage.
It should be understood that although the various steps in the flow charts of fig. 2-8 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-8 may include multiple sub-steps or phases that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or phases is not necessarily sequential.
In one embodiment, as shown in fig. 9, there is provided a resource access apparatus, including: an operation module 11, an acquisition module 12 and an execution module 13, wherein:
the running module 11 is used for running the target webpage on the frame component in the webpage application; the webpage application is registered with an interface protocol between the webpage application and the frame component;
the obtaining module 12 is configured to invoke the interface protocol, and obtain, through the framework component, a resource access instruction input by a user on the target webpage; the resource access instruction comprises a function parameter of a function to be executed;
and the execution module 13 is configured to execute a resource access operation of a corresponding function according to the function parameter.
In one embodiment, as shown in fig. 10, there is provided a resource access apparatus, further comprising: an initiation module 14 and a registration module 15, wherein:
an initialization module 14, configured to perform initialization processing on the frame component to obtain an initialized frame component; the initialization processing comprises language initialization and address initialization;
a registration module 15, configured to register the interface protocol on the initialized framework component.
In one embodiment, as shown in fig. 11, there is provided a resource access apparatus, where the execution module 13 includes: dependent injection unit 131, reflection unit 132, determination unit 133 and execution unit 134, wherein:
the dependency injection unit 131 is configured to perform dependency injection on a function corresponding to the function identifier according to the function identifier in the function parameter to obtain a target function module;
a reflection unit 132, configured to perform reflection processing on the target function module to obtain each function method included in the target function module;
a determining unit 133, configured to determine a target function method from the function methods according to the function identifier in the function parameter;
the execution unit 134 is configured to analyze a function method parameter in the function parameters by using the target function method to obtain a corresponding function, and execute a resource access operation according to the corresponding function.
In an embodiment, as shown in fig. 12, the executing module 13 further includes:
a storage unit 135, configured to store the function methods and the corresponding function identifiers in a cache in a form of a list.
In an embodiment, the dependency injection unit 131 is specifically configured to obtain, according to a function identifier in the function parameter, a function corresponding to the function identifier from the function module configuration file; and adopting a preset container to package the function corresponding to the function identifier to obtain the target function module.
In an embodiment, the dependency injection unit 131 is further specifically configured to determine whether the function identifier is legal; and if so, executing the step of performing dependent injection on the functional module corresponding to the functional identifier according to the functional identifier in the functional parameter to obtain a target functional module.
In one embodiment, as shown in fig. 13, there is provided a resource access apparatus, further comprising:
an obtaining result module 16, configured to obtain a result of the resource access operation;
and the display module 17 is configured to display the result of the resource access operation on the target webpage by calling a function through the webpage.
The above embodiments provide a resource access device that implements principles and technical effects similar to the above method embodiments, and is not cumbersome here.
For specific limitations of the resource access device, reference may be made to the above limitations of a resource access method, which is not described herein again. The modules in the resource access device can be wholly or partially implemented by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
running a target web page on a frame component in a web application; the webpage application is registered with an interface protocol between the webpage application and the frame component;
calling the interface protocol, and acquiring a resource access instruction input by a user on the target webpage through the frame component; the resource access instruction comprises a function parameter of a function to be executed;
and executing the resource access operation of the corresponding function according to the function parameter.
The implementation principle and technical effect of the computer device provided by the above embodiment are similar to those of the above method embodiment, and are not described herein again.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, the computer program, when executed by a processor, further implementing the steps of:
running a target web page on a frame component in a web application; the webpage application is registered with an interface protocol between the webpage application and the frame component;
calling the interface protocol, and acquiring a resource access instruction input by a user on the target webpage through the frame component; the resource access instruction comprises a function parameter of a function to be executed;
and executing the resource access operation of the corresponding function according to the function parameter.
The implementation principle and technical effect of the computer-readable storage medium provided by the above embodiments are similar to those of the above method embodiments, and are not described herein again.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (9)

1. A method for resource access, the method comprising:
running a target web page on a frame component in a web application; the webpage application is registered with an interface protocol between the webpage application and the frame component;
calling the interface protocol, and acquiring a resource access instruction input by a user on the target webpage through the frame component; the resource access instruction comprises a function parameter of a function to be executed; the function parameters comprise function identification and function method parameters;
according to the function identification, performing dependence injection on the function corresponding to the function identification to obtain a target function module;
performing reflection processing on the target function module to obtain each function method contained in the target function module;
determining a target function method from the function methods according to the function identification;
and analyzing the function method parameters by adopting the target function method to obtain a corresponding function, and executing resource access operation according to the corresponding function.
2. The method of claim 1, wherein before running the target web page on the framework component in the web application, the method comprises:
initializing the frame assembly to obtain an initialized frame assembly; the initialization processing comprises language initialization and address initialization;
and registering the interface protocol on the initialized framework component.
3. The method according to claim 1 or 2, wherein the performing dependent injection on the function corresponding to the function identifier according to the function identifier to obtain a target function module comprises:
acquiring all functions corresponding to the function identification from the function module configuration file according to the function identification;
and packaging all functions corresponding to the function identification by adopting a preset container to obtain a target function module.
4. The method according to claim 1 or 2, wherein before performing dependent injection on the function module corresponding to the function identifier according to the function identifier to obtain a target function module, the method further comprises:
judging whether the function identification is legal or not;
and if so, executing the step of performing dependent injection on the functional module corresponding to the functional identifier according to the functional identifier to obtain a target functional module.
5. The method according to claim 1 or 2, wherein after the performing the reflection processing on the target function module to obtain each function method included in the target function module, the method further comprises:
and storing each function method and the corresponding function identification in a cache in a list form.
6. The method according to claim 1 or 2, characterized in that the method further comprises:
obtaining the result of the resource access operation;
and displaying the result of the resource access operation on the target webpage by a webpage call function.
7. An apparatus for accessing a resource, the apparatus comprising:
the running module is used for running the target webpage on the frame component in the webpage application; the webpage application is registered with an interface protocol between the webpage application and the frame component;
the acquisition module is used for calling the interface protocol and acquiring a resource access instruction input by a user on the target webpage through the frame component; the resource access instruction comprises a function parameter of a function to be executed; the function parameters comprise function identification and function method parameters;
the execution module is used for performing dependent injection on the function corresponding to the function identifier according to the function identifier to obtain a target function module; performing reflection processing on the target function module to obtain each function method contained in the target function module; determining a target function method from the function methods according to the function identification; and analyzing the function method parameters by adopting the target function method to obtain a corresponding function, and executing resource access operation according to the corresponding function.
8. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 6.
CN201910150685.0A 2019-02-28 2019-02-28 Resource access method, device, computer equipment and storage medium Active CN109902257B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910150685.0A CN109902257B (en) 2019-02-28 2019-02-28 Resource access method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910150685.0A CN109902257B (en) 2019-02-28 2019-02-28 Resource access method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109902257A CN109902257A (en) 2019-06-18
CN109902257B true CN109902257B (en) 2021-06-29

Family

ID=66945732

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910150685.0A Active CN109902257B (en) 2019-02-28 2019-02-28 Resource access method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109902257B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110691136B (en) * 2019-09-29 2022-01-21 广州华多网络科技有限公司 Data interaction method and device, electronic equipment and storage medium
CN114895898A (en) * 2022-04-29 2022-08-12 北京百度网讯科技有限公司 Instruction processing method, device, equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102073506A (en) * 2011-02-24 2011-05-25 北京中电普华信息技术有限公司 Java 2 enterprise edition (J2EE) based method and system for processing Web application request
CN103177040A (en) * 2011-12-26 2013-06-26 腾讯科技(深圳)有限公司 Method and device for calling functions of webpage application
CN105279195A (en) * 2014-07-23 2016-01-27 腾讯科技(深圳)有限公司 Method and apparatus for webpage application to call browser function

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101477460A (en) * 2008-12-17 2009-07-08 三星电子(中国)研发中心 Production and customization method for browser used in hand-held equipment
US20120042016A1 (en) * 2010-08-10 2012-02-16 Google Inc. Exposing resource capabilities to web applications
CN102420838A (en) * 2010-09-27 2012-04-18 上海拉扎斯信息科技有限公司 System capable of accessing point-of-sale (POS) terminal equipment via Web
CN102779046B (en) * 2012-07-04 2016-01-20 合一网络技术(北京)有限公司 A kind of audio/video player system based on HTML5 exploitation and video broadcasting method thereof
CN108733991B (en) * 2017-04-19 2021-04-06 腾讯科技(深圳)有限公司 Webpage application access method and device and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102073506A (en) * 2011-02-24 2011-05-25 北京中电普华信息技术有限公司 Java 2 enterprise edition (J2EE) based method and system for processing Web application request
CN103177040A (en) * 2011-12-26 2013-06-26 腾讯科技(深圳)有限公司 Method and device for calling functions of webpage application
CN105279195A (en) * 2014-07-23 2016-01-27 腾讯科技(深圳)有限公司 Method and apparatus for webpage application to call browser function

Also Published As

Publication number Publication date
CN109902257A (en) 2019-06-18

Similar Documents

Publication Publication Date Title
CN109814854B (en) Project framework generation method, device, computer equipment and storage medium
JP5982586B2 (en) Resource calls for hybrid applications
US9342329B2 (en) Method and system for cross-operating systems execution of software applications
US9207989B2 (en) System and method for providing virtual device
CN108829485B (en) Application interface layout updating method and device, storage medium and computer equipment
CN108418797B (en) Webpage access method and device, computer equipment and storage medium
CN111399833B (en) Service data processing method and device, computer equipment and storage medium
CN109542366B (en) Printing method, device, equipment and storage medium based on browser
CN109902257B (en) Resource access method, device, computer equipment and storage medium
CN110177039B (en) Message sharing method and device, computer equipment and storage medium
CN111459541A (en) Application program packaging method and device, computer equipment and storage medium
CN111949314A (en) Method and device for generating application installation package, server and storage medium
CN110597709A (en) Interactive debugging method and device for mixed-mode mobile application and computer equipment
CN112860457A (en) Software development kit calling method and device, computer equipment and storage medium
CN111190609A (en) Service processing method, device, equipment and storage medium
CN110362341B (en) Business management method, device, equipment and storage medium based on micro-service architecture
CN112114808A (en) Page rendering method and device and electronic equipment
CN111881470A (en) Data access method and device and computer readable storage medium
US20120271881A1 (en) Systems and methods for updating computer memory and file locations within virtual computing environments
CN114003432A (en) Parameter checking method and device, computer equipment and storage medium
US20150227383A1 (en) Application program virtualization system and method of virtualizing application program of user terminal
CN110324410B (en) Method, device, computer equipment and storage medium for initiating webpage request
US9367512B2 (en) Systems and methods for dynamically updating virtual desktops or virtual applications in a standard computing environment
US9489215B2 (en) Managing an expression-based DFA construction process
US9819725B1 (en) System, method, and computer program for remotely controlling mobile web applications installed on a mobile device

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