CN116796095A - H5 hybrid development client request processing method, client and computer equipment - Google Patents

H5 hybrid development client request processing method, client and computer equipment Download PDF

Info

Publication number
CN116796095A
CN116796095A CN202310812856.8A CN202310812856A CN116796095A CN 116796095 A CN116796095 A CN 116796095A CN 202310812856 A CN202310812856 A CN 202310812856A CN 116796095 A CN116796095 A CN 116796095A
Authority
CN
China
Prior art keywords
request
resource
service data
access request
web engine
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.)
Pending
Application number
CN202310812856.8A
Other languages
Chinese (zh)
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.)
Guosen Securities Co ltd
Original Assignee
Guosen Securities 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 Guosen Securities Co ltd filed Critical Guosen Securities Co ltd
Priority to CN202310812856.8A priority Critical patent/CN116796095A/en
Publication of CN116796095A publication Critical patent/CN116796095A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the invention relates to the technical field of software development and discloses a request processing method of an H5 hybrid development client, which is applied to the client, wherein the client is the H5 hybrid development client and comprises a web engine, and the method comprises the following steps: responding to an access request generated by clicking the H5 function by a user, and sending the access request to the web engine; the access request carries URL information; the web engine determines whether the access request is a resource request or a service data request according to the URL information; when the access request is a resource request, the web engine loads a local resource according to the resource request; when the service data request is made, determining whether the service data corresponding to the service data request is cached, and if the cache is present, reading the service data from the cache; and if the service data request does not exist, forwarding the service data request to a corresponding remote server so as to acquire the service data corresponding to the service data request from the remote server. The embodiment of the invention realizes the effect of reducing the time consumption and the flow of the network request.

Description

H5 hybrid development client request processing method, client and computer equipment
Technical Field
The embodiment of the invention relates to the technical field of software development, in particular to a request processing method of an H5 hybrid development client, the client, computer equipment and a computer readable storage medium.
Background
At present, along with the development of mobile networks and Web development technologies, a mobile terminal APP has widely adopted a hybrid development mode of native+H25 so as to realize cross-platform development and thermal updating capability of mobile terminal products. However, the H5 technology naturally has the defects of slow page loading, large network traffic consumption, hidden safety hazards and the like, and mainly has the following problems:
1. the method has the advantages that the page resources are more, the loading is slow, the network request is time-consuming and the flow is large, so that the page is white, and the user experience is poor;
2. the page resources need to be frequently downloaded from the server, the user network flow consumption is large, and the load and bandwidth pressure of the Web server are large;
and 3, the H5 code is transparent in open source, and potential safety hazards exist in sensitive information and data transmission.
Therefore, a request processing method of a client capable of improving the page loading speed and reducing the time consumption of network requests and network traffic is needed.
Disclosure of Invention
In view of the above problems, the embodiments of the present invention provide a method for processing a request of an H5 hybrid development client, a computer device, and a computer readable storage medium, which are used to solve the problems in the prior art that a page loading speed is slow, a network request consumes time, and a network traffic consumes a large amount.
According to an aspect of the embodiment of the present invention, there is provided a request processing method of an H5 hybrid development client, the method being applied to a client, the client being an H5 hybrid development client, the client including a web engine, the method including:
responding to an access request generated by clicking an H5 function by a user, and sending the access request to the web engine; the access request carries URL information;
the web engine determines whether the access request is a resource request or a service data request according to the URL information;
when the access request is a resource request, the web engine loads local resources according to the resource request;
when the access request is a service data request, determining whether the service data corresponding to the service data request has a cache or not, and if the cache exists, reading the service data from the cache;
if no cache exists, the web engine forwards the service data request to a corresponding remote server so as to acquire the service data corresponding to the service data request from the remote server.
In an alternative manner, before the access request generated in response to the user clicking on the H5 function is sent to the web engine, the method further includes:
When a user clicks an H5 function to generate an access request, checking whether the web engine operates normally;
and when the web engine normally operates, splicing the server address in the URL information into the address of the proxy server of the web engine.
In an alternative manner, before the access request generated in response to the user clicking on the H5 function is sent to the web engine, the method further includes:
when the web engine runs abnormally, splicing the server address in the URL information into the address of a remote server;
and sending the access request to the remote server according to the server address in the URL information.
In an alternative manner, the web engine determines whether the access request is a resource request or a service data request according to URL information, including:
the web engine is matched with a preset resource type according to the URL information, and when the matching is successful, the web engine is determined to be a resource request;
when the matching is unsuccessful, determining whether the access request contains remote server information corresponding to the service;
and when the remote server information corresponding to the service is contained, determining that the access request is a service data request.
In an alternative manner, when the access request is a resource request, the web engine loads a local resource according to the resource request, including:
determining whether the local resource corresponding to the access request exists;
if the local resource exists, the MD5 of the local resource is calculated, and when the MD5 of the local resource is consistent with the prestored MD5, the local resource is loaded;
if not, downloading the resource from the remote server, and returning the downloaded resource to the H5 page.
In an optional manner, after downloading the resource from the remote server and returning to the H5 page if the resource does not exist, the method further includes:
and determining whether the MD5 of the resource downloaded from the remote server is consistent with the prestored MD5, and if so, caching the downloaded resource to the local of the client.
In an alternative, the method further comprises:
when the H5 resource management background issues a gray scale upgrading version, generates a gray scale full-scale resource upgrading package, and issues the gray scale full-scale resource upgrading package to a remote gray scale web server, and when the client is started, determining whether a current client hits a gray scale white list or not through a web engine;
if hit, returning the latest gray scale version number, entering a gray scale mode, and forwarding all local resource requests and service requests to a far-end gray scale web server;
If the access request is not hit, the web engine is executed to determine whether the access request is a resource request or a service data request according to the URL information, and when the access request is the resource request, the web engine loads local resources according to the resource request; and when the access request is a service data request, forwarding the service data request to a remote server by the web engine so as to acquire service data corresponding to the service data request from the remote server.
According to another aspect of the embodiment of the invention, a client is provided, wherein the client is a client for H5 hybrid development and comprises a web engine;
the client responds to an access request generated by a user clicking an H5 function, and sends the access request to the web engine; the access request carries URL information;
the web engine determines whether the access request is a resource request or a service data request according to the URL information;
when the access request is a resource request, the web engine loads local resources according to the resource request;
when the access request is a service data request, determining whether the service data corresponding to the service data request has a cache or not, and if the cache exists, reading the service data from the cache;
If no cache exists, the web engine forwards the service data request to a corresponding remote server so as to acquire the service data corresponding to the service data request from the remote server.
According to another aspect of an embodiment of the present invention, there is provided a computer apparatus including: the device comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete communication with each other through the communication bus; the memory is used for storing at least one executable instruction, and the executable instruction enables the processor to execute the operation of the request processing method of the H5 hybrid development client.
According to yet another aspect of the embodiments of the present invention, there is provided a computer readable storage medium having stored therein at least one executable instruction that, when executed on a computer device, causes the computer device to perform the operations of the request processing method of the H5 hybrid development client.
The embodiment of the invention is applied to a client, wherein the client is a client developed by H5 hybrid, and comprises a web engine, and the embodiment of the invention sends an access request generated by responding to a user clicking an H5 function to the web engine, and the web engine determines whether the access request is a resource request or a service data request according to URL information carried in the access request; when the access request is a resource request, the web engine loads local resources according to the resource request; when the access request is a service data request, determining whether the service data corresponding to the service data request has a cache or not, and if the cache exists, reading the service data from the cache; if the cache does not exist, the web engine forwards the service data request to a corresponding remote server so as to acquire the service data corresponding to the service data request from the remote server, and therefore time consumption and flow of network requests can be effectively reduced. By caching the resource file to be loaded of the H5 page to the client, the H5 function page is loaded locally from the client when being displayed, and time consumption and flow of network requests are reduced. According to the embodiment of the invention, the resource data and the service data are cached at the client, so that the page loading speed can be effectively improved; the means of H5 request, resource version management, multi-system integration request routing, gray level release, security verification and the like are obtained through the proxy, so that the loading speed, network security and user experience are improved.
The foregoing description is only an overview of the technical solutions of the embodiments of the present invention, and may be implemented according to the content of the specification, so that the technical means of the embodiments of the present invention can be more clearly understood, and the following specific embodiments of the present invention are given for clarity and understanding.
Drawings
The drawings are only for purposes of illustrating embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to designate like parts throughout the figures. In the drawings:
fig. 1 shows a schematic structural diagram of an H5 hybrid development system according to an embodiment of the present invention;
fig. 2 is a flow chart illustrating a request processing method of an H5 hybrid development client according to an embodiment of the present invention;
fig. 3 is a schematic flow diagram of gray level publishing in a request processing method of an H5 hybrid development client according to an embodiment of the present invention;
fig. 4 is a flow chart illustrating a request processing method of an H5 hybrid development client according to another embodiment of the present invention;
fig. 5 shows a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention may be embodied in various forms and should not be limited to the embodiments set forth herein.
Fig. 1 shows a schematic structural diagram of an H5 hybrid development system according to an embodiment of the present invention. The native+h5 hybrid development model system of fig. 1 includes a client, a remote web server, and an H5 resource management background.
The APP client comprises a Web proxy service WebEngine component based on a lightweight HTTP protocol, and the Web proxy service WebEngine component is mainly responsible for local resource request interception and resource loading, data request general processing and forwarding, resource updating, resource management and storage, data request caching and security verification. For the web front end, the resource loading and data request sending server of the modified H5 page is not sent to the service server any more, but is sent to the local proxy web server localhost, and all H5 requests are processed by the proxy web server webEngine component. The traditional h5 page rendering mechanism is improved, and the page space frame is displayed before page data is returned. The H5 resource management background realizes H5 resource uploading and checking, resource version management and gray level release management.
In the embodiment of the invention, the client comprises a local web engine and an H5 local resource module. The APP client of the embodiment of the invention is based on a Web Engine (Web Engine) component of a Web proxy server, and mainly comprises a proxy Web server, a resource management module, a request forwarding module, a resource update management module, a resource security verification module, a data cache module and the like. The proxy Web server is a mobile terminal Web server based on lightweight HTTP, is responsible for comprehensively taking over the request of the H5 page, distinguishes resource type requests and business data type requests and forwards the resource type requests and the business data type requests to the corresponding processing modules; the request forwarding module is required to realize request routing according to server configuration and forward the resource and service request to a target service system Web server; the resource management module is responsible for loading and version management of local resources; the resource update management module is responsible for acquiring the latest resource version information from the H5 resource management background and realizing resource update according to the resource version as required; the security check module is mainly responsible for the security check of the local resources; the data buffer module is mainly used for realizing the off-line loading of non-sensitive business data stored in the data buffer module, such as data of information, quotation and the like. In order to realize the management and updating of the H5 resources of the WebEnine component, the H5 resource management background realizes functional modules such as H5 resource version management, routing table management, H5 gray scale release management and the like. The H5 local resource module is preloaded to web resources of the client, and comprises description files, sound, pictures and the like of web functions.
When the client starts and initializes, the Web engine starts the proxy Web server, and the Web engine checks whether the port number which is successfully used before exists, if so, the client starts, and if not, the default port number is 9003, the client starts again. If the port is occupied when the proxy Web server is started, the port number is changed in a random number self-increasing mode within 100, if the proxy Web server still fails for 3 times, the current startup failure is marked, the proxy server is not used for forwarding when the H5 function page is opened, and the remote Web server is directly accessed. If the current boot is successful, the current port number is persisted and the next boot continues to boot the service using this port number.
When the proxy Web server has an error, in order to feed back the error information of the H5 page, the embodiment of the present invention agrees to the response status code between the H5 page and the proxy Web server, where the standard HTTP status code is multiplexed, and specific descriptions are given to specific status codes 200, 404 and 500.
In the embodiment of the invention, when the APP runs in the background, the work of the Web proxy server is suspended, so that unnecessary system resources and electric quantity loss of the APP are avoided, and the service is restarted when the APP returns to the foreground.
Fig. 2 shows a flowchart of a request processing method of an H5 hybrid development client according to an embodiment of the present invention, where the method is performed by a client in the system for native+h5 hybrid mode development described above. As shown in fig. 2, the method comprises the steps of:
step 110: in response to an access request generated by a user clicking on the H5 function, the access request is sent to the web engine.
The access request carries URL information. According to practical production situations, one APP client often needs to access multiple independent H5 service systems, so WebEngine needs to support the capability of forwarding requests to different cloud Web services, so the client may correspond to multiple remote servers, and therefore the Web engine needs to determine the remote server corresponding to URL information carried in the access request. In the embodiment of the invention, the H5 resource management background comprises a routing table management module, and the routing table management module stores the routing table and dynamically manages the request routing table. The routing table includes routing address information of each remote server corresponding to the client. When the Web engine starts, the routing table is acquired from an H5 resource management background and analyzed, when the Web engine receives an access request after the H5 page starts to be loaded, the Web engine performs key path feature matching on the path information of the URL in the access request, and forwards the access request to the proxy Web server after finding out the corresponding remote server address; when the remote server address is not matched, the remote server address is considered as an illegal request, the access request is not forwarded, and an error prompt is returned.
Among these, the following is an example of a resource request routing table:
URL critical path Host
system1/asset/ https://host1/
system2/asset/ https://host2/
system3/asset/ https://host3/
system3/feature/ https://host3/
In the embodiment of the invention, when a user clicks an H5 function to generate an access request, a client generates the access request according to the user click information and checks whether the web engine operates normally; when the web engine normally operates, the server address in the URL information is spliced into an address localhost of a proxy server of the web engine, and the access request is sent to the proxy web server in the web engine. When the web engine runs abnormally, acquiring a remote server address from a native terminal, and splicing the server address in the URL information into the address of the remote server; and sending the access request to the remote server according to the server address in the URL information.
Step 120: and the web engine determines whether the access request is a resource request or a service data request according to the URL information.
For the resource request, the Web engine component needs to match with local resources to load or update from a remote end, and needs to perform general processing on the request by a native end and forward the request to a corresponding Web server, so that it is required to clearly distinguish whether the request received by the Web engine component is the resource request or the service data request.
In the embodiment of the invention, the web engine is matched with a preset resource type according to URL information, and when the matching is successful, the web engine is determined to be a resource request; when the matching is unsuccessful, determining whether the access request contains remote server information corresponding to the service; and when the remote server information corresponding to the service is contained, determining that the access request is a service data request.
The preset resource types in the embodiment of the invention are obtained in advance according to the suffixes of all H5 resource files. For example, the resource suffix includes: htm/html/js/css/png/jpg/gif/jpeg/bmp/webp/ico/mp4/mp3/ogg/sass/scss/less/ttf/eot/otf/woff/svg/xml/json/config/vue, when the Web proxy server detects that the URL information in the access request has a suffix and is in the range of the preset resource type, judging that the request is a resource loading request, otherwise, the request is a service request.
In the embodiment of the invention, because the service request URL has no regularity and constraint, the routing table cannot be formulated through the URL key path characteristics, so that the H5 service function page indicates the corresponding service server in the service parameters when the service data request is sent by the H5 service function page aiming at the service data request, namely, when the access request is the service data request, the H5 page generates the access request containing the service server information according to the clicking operation of the user. In the general processing flow of sending service request, the H5 functional page adds a field used by being transferred to the proxy server to the general field: the Gs_proxy_params field is a JSON field, all subsequent parameters sent to the proxy server are placed in the JSON field, and after the WebEgine component processes the parameter field, the information of the field is deleted before the parameter field is forwarded to the server, so that the request flow is reduced, and interference to a background server is avoided.
Step 130: when the access request is a resource request, the web engine loads a local resource according to the resource request.
In the embodiment of the invention, when the access request is determined to be a resource request, the web engine determines whether a local resource corresponding to the access request exists; if the local resource exists, the MD5 of the local resource is calculated, and when the MD5 of the local resource is consistent with the prestored MD5, the local resource is loaded; if the MD5 is not consistent with the prestored MD5, the downloaded resources are cached to the local client.
Step 140: when the access request is a service data request, determining whether the service data corresponding to the service data request has a cache, and if so, reading the service data from the cache.
The client caches the service data accessed by the history, and specifically, the function number corresponding to the cached service data may be marked as getmechanism data. When the access request is a service data request, whether the service data corresponding to the service data request is in a cache or not can be determined, when the request function number corresponding to the service data request is getcachedata, the service data is determined to be read from the cache, and then the service data is read according to the Key and returned to the H5 page.
Step 150: if no cache exists, the web engine forwards the service data request to a corresponding remote server so as to acquire the service data corresponding to the service data request from the remote server.
When the request function number is not gettachata, it is determined that cache data does not exist, general data processing is performed on the service data request, the service data request is forwarded to a remote server through a proxy web server, and service data returned by the remote server is acquired to an H5 page. In the embodiment of the invention, when the returned service data is obtained, whether the service data is stored in a disk or not is also determined so as to cache the service data, when the service data is required to be cached, whether the service data is a correct result set is determined, and if the service data is the correct result set, the returned service data is stored in the cache.
In the embodiment of the invention, after the proxy web server acquires the resource data or service data corresponding to the access request, the returned resource data or service data is returned to the H5 page, so that the H5 page corresponds to the access request, and the resource data or service data is displayed.
As shown in fig. 3, in the embodiment of the present invention, the H5 resource management background further performs H5 gray scale distribution management, and the Web engine in the client further performs gray scale distribution processing. When the H5 resource management background issues a gray scale upgrading version, generates a gray scale full-scale resource upgrading package, and issues the gray scale full-scale resource upgrading package to a remote gray scale web server, and when the client is started, determining whether a current client hits a gray scale white list or not through a web engine; if hit, returning the latest gray scale version number, entering a gray scale mode, and forwarding all local resource requests and service requests to a far-end gray scale web server; if the access request is not hit, the web engine is executed to determine whether the access request is a resource request or a service data request according to the URL information, and when the access request is the resource request, the web engine loads local resources according to the resource request; and when the access request is a service data request, forwarding the service data request to a remote server by the web engine so as to acquire service data corresponding to the service data request from the remote server.
The embodiment of the invention is applied to a client, wherein the client is a client developed by H5 hybrid, and comprises a web engine, and the embodiment of the invention sends an access request generated by responding to a user clicking an H5 function to the web engine, and the web engine determines whether the access request is a resource request or a service data request according to URL information carried in the access request; when the access request is a resource request, the web engine loads local resources according to the resource request; when the access request is a service data request, determining whether the service data corresponding to the service data request has a cache or not, and if the cache exists, reading the service data from the cache; if the cache does not exist, the web engine forwards the service data request to a corresponding remote server so as to acquire the service data corresponding to the service data request from the remote server, and therefore time consumption and flow of network requests can be effectively reduced. By caching the resource file to be loaded of the H5 page to the client, the H5 function page is loaded locally from the client when being displayed, and time consumption and flow of network requests are reduced. The embodiment of the invention improves the loading speed, network safety and user experience by means of proxy obtaining H5 request, resource version management, multi-system integration request routing, gray level release, safety verification and the like.
Fig. 4 is a flowchart illustrating a request processing method of an H5 hybrid development client according to another embodiment of the present invention, where the method is performed by a client in the system for native+h5 hybrid mode development.
As shown in fig. 4, the method comprises the steps of:
step 210: when the user clicks a function in the H5 page, an access address is acquired, and an access request is generated.
Step 220: determining whether an access address in the access request is in a preset routing table, if not, determining that the access address is an illegal address, and reporting 404 errors to an H5 page; if yes, go to step 230.
Step 230: it is determined whether the access request is a resource request. Specifically, the URL address in the access request is matched with the preset resource suffix, if so, the request is determined to be a resource request, step 240 is executed, and if not, step 250 is further executed.
Step 240: the local resource starts to be loaded, whether the local resource exists or not is determined, if so, step 260 is executed, and if not, step 270 is executed.
Step 250: determining whether there is address information of the service server in the access request, if so, determining whether to read the cache request for the service data request, if so, executing step 280, and if not, executing step 290.
Step 260: calculating whether the local resource MD5 is matched with the preset MD5 or not, and if so, loading the local resource; if not, deleting the local resource.
Step 270: downloading the corresponding downloaded resources from the cloud server, returning to the H5 page, determining whether MD5 of the H5 page is matched with the preset MD5, and if so, locally caching the downloaded resources.
Step 280: and reading data according to the Key in the service data request and returning the data to the H5 page.
Step 290: and sending the service data request to a remote server, acquiring the service data returned by the remote server, and returning the service data to the H5 page. And determining whether uncached service data is required to be cached, if so, determining whether the service data is a correct result set, and if so, caching the service data.
The embodiment of the invention is applied to a client, wherein the client is a client developed by H5 hybrid, and comprises a web engine, and the embodiment of the invention sends an access request generated by responding to a user clicking an H5 function to the web engine, and the web engine determines whether the access request is a resource request or a service data request according to URL information carried in the access request; when the access request is a resource request, the web engine loads local resources according to the resource request; when the access request is a service data request, determining whether the service data corresponding to the service data request has a cache or not, and if the cache exists, reading the service data from the cache; if the cache does not exist, the web engine forwards the service data request to a corresponding remote server so as to acquire the service data corresponding to the service data request from the remote server, and therefore time consumption and flow of network requests can be effectively reduced. By caching the resource file to be loaded of the H5 page to the client, the H5 function page is loaded locally from the client when being displayed, and time consumption and flow of network requests are reduced. The embodiment of the invention improves the loading speed, network safety and user experience by means of proxy obtaining H5 request, resource version management, multi-system integration request routing, gray level release, safety verification and the like.
Fig. 5 shows a schematic structural diagram of a computer device according to an embodiment of the present invention, and the specific embodiment of the present invention is not limited to the specific implementation of the computer device.
As shown in fig. 5, the computer device may include: a processor 402, a communication interface (Communications Interface) 404, a memory 406, and a communication bus 408.
Wherein: processor 402, communication interface 404, and memory 406 communicate with each other via communication bus 408. A communication interface 404 for communicating with network elements of other devices, such as clients or other servers. The processor 402 is configured to execute the program 410, and may specifically perform relevant steps in the embodiment of the request processing method for the H5 hybrid development client.
In particular, program 410 may include program code including computer-executable instructions.
The processor 402 may be a central processing unit CPU, or a specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement embodiments of the present invention. The one or more processors included in the computer device may be the same type of processor, such as one or more CPUs; but may also be different types of processors such as one or more CPUs and one or more ASICs.
Memory 406 for storing programs 410. Memory 406 may comprise high-speed RAM memory or may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
Program 410 may be specifically invoked by processor 402 to cause a computer device to:
responding to an access request generated by clicking an H5 function by a user, and sending the access request to the web engine; the access request carries URL information;
the web engine determines whether the access request is a resource request or a service data request according to the URL information;
when the access request is a resource request, the web engine loads local resources according to the resource request;
when the access request is a service data request, determining whether the service data corresponding to the service data request has a cache or not, and if the cache exists, reading the service data from the cache;
if no cache exists, the web engine forwards the service data request to a corresponding remote server so as to acquire the service data corresponding to the service data request from the remote server.
In an alternative manner, before the access request generated in response to the user clicking on the H5 function is sent to the web engine, the method further includes:
When a user clicks an H5 function to generate an access request, checking whether the web engine operates normally;
and when the web engine normally operates, splicing the server address in the URL information into the address of the proxy server of the web engine.
In an alternative manner, before the access request generated in response to the user clicking on the H5 function is sent to the web engine, the method further includes:
when the web engine runs abnormally, splicing the server address in the URL information into the address of a remote server;
and sending the access request to the remote server according to the server address in the URL information.
In an alternative manner, the web engine determines whether the access request is a resource request or a service data request according to URL information, including:
the web engine is matched with a preset resource type according to the URL information, and when the matching is successful, the web engine is determined to be a resource request;
when the matching is unsuccessful, determining whether the access request contains remote server information corresponding to the service;
and when the remote server information corresponding to the service is contained, determining that the access request is a service data request.
In an alternative manner, when the access request is a resource request, the web engine loads a local resource according to the resource request, including:
determining whether the local resource corresponding to the access request exists;
if the local resource exists, the MD5 of the local resource is calculated, and when the MD5 of the local resource is consistent with the prestored MD5, the local resource is loaded;
if not, downloading the resource from the remote server, and returning the downloaded resource to the H5 page.
In an optional manner, after downloading the resource from the remote server and returning to the H5 page if the resource does not exist, the method further includes:
and determining whether the MD5 of the resource downloaded from the remote server is consistent with the prestored MD5, and if so, caching the downloaded resource to the local of the client.
In an alternative, the method further comprises:
when the H5 resource management background issues a gray scale upgrading version, generates a gray scale full-scale resource upgrading package, and issues the gray scale full-scale resource upgrading package to a remote gray scale web server, and when the client is started, determining whether a current client hits a gray scale white list or not through a web engine;
if hit, returning the latest gray scale version number, entering a gray scale mode, and forwarding all local resource requests and service requests to a far-end gray scale web server;
If the access request is not hit, the web engine is executed to determine whether the access request is a resource request or a service data request according to the URL information, and when the access request is the resource request, the web engine loads local resources according to the resource request; and when the access request is a service data request, forwarding the service data request to a remote server by the web engine so as to acquire service data corresponding to the service data request from the remote server.
The embodiment of the invention is applied to a client, wherein the client is a client developed by H5 hybrid, and comprises a web engine, and the embodiment of the invention sends an access request generated by responding to a user clicking an H5 function to the web engine, and the web engine determines whether the access request is a resource request or a service data request according to URL information carried in the access request; when the access request is a resource request, the web engine loads local resources according to the resource request; when the access request is a service data request, determining whether the service data corresponding to the service data request has a cache or not, and if the cache exists, reading the service data from the cache; if the cache does not exist, the web engine forwards the service data request to a corresponding remote server so as to acquire the service data corresponding to the service data request from the remote server, and therefore time consumption and flow of network requests can be effectively reduced. By caching the resource file to be loaded of the H5 page to the client, the H5 function page is loaded locally from the client when being displayed, and time consumption and flow of network requests are reduced. The embodiment of the invention improves the loading speed, network safety and user experience by means of proxy obtaining H5 request, resource version management, multi-system integration request routing, gray level release, safety verification and the like.
The embodiment of the invention provides a computer readable storage medium, which stores at least one executable instruction, and the executable instruction when running on a computer device, causes the computer device to execute the request processing method of the H5 hybrid development client in any of the method embodiments.
The executable instructions may be particularly useful for causing a computer device to:
responding to an access request generated by clicking an H5 function by a user, and sending the access request to the web engine; the access request carries URL information;
the web engine determines whether the access request is a resource request or a service data request according to the URL information;
when the access request is a resource request, the web engine loads local resources according to the resource request;
when the access request is a service data request, determining whether the service data corresponding to the service data request has a cache or not, and if the cache exists, reading the service data from the cache;
if no cache exists, the web engine forwards the service data request to a corresponding remote server so as to acquire the service data corresponding to the service data request from the remote server.
In an alternative manner, before the access request generated in response to the user clicking on the H5 function is sent to the web engine, the method further includes:
when a user clicks an H5 function to generate an access request, checking whether the web engine operates normally;
and when the web engine normally operates, splicing the server address in the URL information into the address of the proxy server of the web engine.
In an alternative manner, before the access request generated in response to the user clicking on the H5 function is sent to the web engine, the method further includes:
when the web engine runs abnormally, splicing the server address in the URL information into the address of a remote server;
and sending the access request to the remote server according to the server address in the URL information.
In an alternative manner, the web engine determines whether the access request is a resource request or a service data request according to URL information, including:
the web engine is matched with a preset resource type according to the URL information, and when the matching is successful, the web engine is determined to be a resource request;
When the matching is unsuccessful, determining whether the access request contains remote server information corresponding to the service;
and when the remote server information corresponding to the service is contained, determining that the access request is a service data request.
In an alternative manner, when the access request is a resource request, the web engine loads a local resource according to the resource request, including:
determining whether the local resource corresponding to the access request exists;
if the local resource exists, the MD5 of the local resource is calculated, and when the MD5 of the local resource is consistent with the prestored MD5, the local resource is loaded;
if not, downloading the resource from the remote server, and returning the downloaded resource to the H5 page.
In an optional manner, after downloading the resource from the remote server and returning to the H5 page if the resource does not exist, the method further includes:
and determining whether the MD5 of the resource downloaded from the remote server is consistent with the prestored MD5, and if so, caching the downloaded resource to the local of the client.
In an alternative, the method further comprises:
when the H5 resource management background issues a gray scale upgrading version, generates a gray scale full-scale resource upgrading package, and issues the gray scale full-scale resource upgrading package to a remote gray scale web server, and when the client is started, determining whether a current client hits a gray scale white list or not through a web engine;
If hit, returning the latest gray scale version number, entering a gray scale mode, and forwarding all local resource requests and service requests to a far-end gray scale web server;
if the access request is not hit, the web engine is executed to determine whether the access request is a resource request or a service data request according to the URL information, and when the access request is the resource request, the web engine loads local resources according to the resource request; and when the access request is a service data request, forwarding the service data request to a remote server by the web engine so as to acquire service data corresponding to the service data request from the remote server.
The embodiment of the invention is applied to a client, wherein the client is a client developed by H5 hybrid, and comprises a web engine, and the embodiment of the invention sends an access request generated by responding to a user clicking an H5 function to the web engine, and the web engine determines whether the access request is a resource request or a service data request according to URL information carried in the access request; when the access request is a resource request, the web engine loads local resources according to the resource request; when the access request is a service data request, determining whether the service data corresponding to the service data request has a cache or not, and if the cache exists, reading the service data from the cache; if the cache does not exist, the web engine forwards the service data request to a corresponding remote server so as to acquire the service data corresponding to the service data request from the remote server, and therefore time consumption and flow of network requests can be effectively reduced. By caching the resource file to be loaded of the H5 page to the client, the H5 function page is loaded locally from the client when being displayed, and time consumption and flow of network requests are reduced. The embodiment of the invention improves the loading speed, network safety and user experience by means of proxy obtaining H5 request, resource version management, multi-system integration request routing, gray level release, safety verification and the like.
The embodiment of the invention provides a request processing device of an H5 hybrid development client, which is used for executing the request processing method of the H5 hybrid development client.
The embodiment of the invention provides a computer program which can be called by a processor to enable a computer device to execute the request processing method of the H5 hybrid development client in any of the method embodiments.
An embodiment of the present invention provides a computer program product, where the computer program product includes a computer program stored on a computer readable storage medium, where the computer program includes program instructions, when the program instructions are executed on a computer, cause the computer to execute a request processing method of an H5 hybrid development client in any of the above-mentioned method embodiments.
The algorithms or displays presented herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general-purpose systems may also be used with the teachings herein. The required structure for a construction of such a system is apparent from the description above. In addition, embodiments of the present invention are not directed to any particular programming language. It will be appreciated that the teachings of the present invention described herein may be implemented in a variety of programming languages, and the above description of specific languages is provided for disclosure of enablement and best mode of the present invention.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the above description of exemplary embodiments of the invention, various features of the embodiments of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be construed as reflecting the intention that: i.e., the claimed invention requires more features than are expressly recited in each claim.
Those skilled in the art will appreciate that the modules in the apparatus of the embodiments may be adaptively changed and disposed in one or more apparatuses different from the embodiments. The modules or units or components of the embodiments may be combined into one module or unit or component, and they may be divided into a plurality of sub-modules or sub-units or sub-components. Any combination of all features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or units of any method or apparatus so disclosed, may be used in combination, except insofar as at least some of such features and/or processes or units are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings), may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, third, etc. do not denote any order. These words may be interpreted as names. The steps in the above embodiments should not be construed as limiting the order of execution unless specifically stated.

Claims (10)

1. A method for processing a request of an H5 hybrid development client, wherein the method is applied to a client, the client being an H5 hybrid development client, the client including a web engine, the method comprising:
Responding to an access request generated by clicking an H5 function by a user, and sending the access request to the web engine; the access request carries URL information;
the web engine determines whether the access request is a resource request or a service data request according to the URL information;
when the access request is a resource request, the web engine loads local resources according to the resource request;
when the access request is a service data request, determining whether the service data corresponding to the service data request has a cache or not, and if the cache exists, reading the service data from the cache;
if no cache exists, the web engine forwards the service data request to a corresponding remote server so as to acquire the service data corresponding to the service data request from the remote server.
2. The method of claim 1, wherein before the sending the access request to the web engine in response to the access request generated by the user clicking on the H5 function, the method further comprises:
when a user clicks an H5 function to generate an access request, checking whether the web engine operates normally;
and when the web engine normally operates, splicing the server address in the URL information into the address of the proxy server of the web engine.
3. The method of claim 2, wherein the method further comprises, prior to sending the access request to the web engine in response to the access request generated by the user clicking on the H5 function:
when the web engine runs abnormally, splicing the server address in the URL information into the address of a remote server;
and sending the access request to the remote server according to the server address in the URL information.
4. The method of claim 1, wherein the web engine determining whether the access request is a resource request or a service data request based on URL information comprises:
the web engine is matched with a preset resource type according to the URL information, and when the matching is successful, the web engine is determined to be a resource request;
when the matching is unsuccessful, determining whether the access request contains remote server information corresponding to the service;
and when the remote server information corresponding to the service is contained, determining that the access request is a service data request.
5. The method of any of claims 1-4, wherein when the access request is a resource request, the web engine loading local resources according to the resource request comprises:
Determining whether the local resource corresponding to the access request exists;
if the local resource exists, the MD5 of the local resource is calculated, and when the MD5 of the local resource is consistent with the prestored MD5, the local resource is loaded;
if not, downloading the resource from the remote server, and returning the downloaded resource to the H5 page.
6. The method of claim 5, wherein the method further comprises, after downloading the resource from the remote server and returning to the H5 page if the resource does not exist:
and determining whether the MD5 of the resource downloaded from the remote server is consistent with the prestored MD5, and if so, caching the downloaded resource to the local of the client.
7. The method according to any one of claims 1-4, further comprising:
when the H5 resource management background issues a gray scale upgrading version, generates a gray scale full-scale resource upgrading package, and issues the gray scale full-scale resource upgrading package to a remote gray scale web server, and when the client is started, determining whether a current client hits a gray scale white list or not through a web engine;
if hit, returning the latest gray scale version number, entering a gray scale mode, and forwarding all local resource requests and service requests to a far-end gray scale web server;
If the access request is not hit, the web engine is executed to determine whether the access request is a resource request or a service data request according to the URL information, and when the access request is the resource request, the web engine loads local resources according to the resource request; and when the access request is a service data request, forwarding the service data request to a remote server by the web engine so as to acquire service data corresponding to the service data request from the remote server.
8. A client, wherein the client is a H5 hybrid development client, the client comprising a web engine;
the client responds to an access request generated by a user clicking an H5 function, and sends the access request to the web engine; the access request carries URL information;
the web engine determines whether the access request is a resource request or a service data request according to the URL information;
when the access request is a resource request, the web engine loads local resources according to the resource request;
when the access request is a service data request, determining whether the service data corresponding to the service data request has a cache or not, and if the cache exists, reading the service data from the cache;
If no cache exists, the web engine forwards the service data request to a corresponding remote server so as to acquire the service data corresponding to the service data request from the remote server.
9. A computer device, comprising: the device comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete communication with each other through the communication bus;
the memory is configured to store at least one executable instruction that causes the processor to perform the operations of the request processing method of the H5 hybrid development client according to any one of claims 1-7.
10. A computer readable storage medium, wherein at least one executable instruction is stored in the storage medium, which when executed on a computer device, causes the computer device to perform the operations of the request processing method of the H5 hybrid development client according to any one of claims 1 to 7.
CN202310812856.8A 2023-07-05 2023-07-05 H5 hybrid development client request processing method, client and computer equipment Pending CN116796095A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310812856.8A CN116796095A (en) 2023-07-05 2023-07-05 H5 hybrid development client request processing method, client and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310812856.8A CN116796095A (en) 2023-07-05 2023-07-05 H5 hybrid development client request processing method, client and computer equipment

Publications (1)

Publication Number Publication Date
CN116796095A true CN116796095A (en) 2023-09-22

Family

ID=88036427

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310812856.8A Pending CN116796095A (en) 2023-07-05 2023-07-05 H5 hybrid development client request processing method, client and computer equipment

Country Status (1)

Country Link
CN (1) CN116796095A (en)

Similar Documents

Publication Publication Date Title
CN109787830B (en) Gray scale distribution control method, device, system, electronic device and storage medium
CN109739573B (en) Processing method and device for realizing API (application program interface) call and system for realizing API
US10263910B2 (en) Resource calling for hybrid applications
US9378179B2 (en) RDMA-optimized high-performance distributed cache
US8190703B2 (en) Extensible browser platform for web applications
CN110825479A (en) Page processing method and device, terminal equipment, server and storage medium
US8880634B2 (en) Cache sharing among branch proxy servers via a master proxy server at a data center
US20070174420A1 (en) Caching of web service requests
US9590859B2 (en) Discovering resources of a distributed computing environment
CN111010364B (en) System for offline object-based storage and simulation of REST responses
US11853806B2 (en) Cloud computing platform that executes third-party code in a distributed cloud computing network and uses a distributed data store
CN111294372A (en) Method, device and system for realizing cache in proxy server
CN103338233A (en) Load balancing device, Web server, request information processing method and system
CN111783005B (en) Method, device and system for displaying web page, computer system and medium
US9378178B1 (en) Enhancing HTTP caching by allowing content sharing of data blocks across resources identified by different uniform resource locators
CN116796095A (en) H5 hybrid development client request processing method, client and computer equipment
US20230088115A1 (en) Generating early hints informational responses at an intermediary server
CN113536168B (en) Component processing method and device
CN110851194A (en) Method and device for acquiring code for realizing new interface
CN114579167A (en) Method, device and storage medium for downloading application upgrade file
CN113132447A (en) Reverse proxy method and system
US11055068B1 (en) Proxying a target ECMAScript object regardless whether the target ECMAScript object is a read-only object
CN110825986B (en) Method, system, storage medium and electronic device for client to request data
CN117539564A (en) Page hot updating method and device, electronic equipment and readable storage medium
CN115643253A (en) Cross-domain file request method and device and business service system

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