Webpage display method and system, storage medium, electronic equipment and computer program product
By statically loading local web page files within the power production control area and using a private service bus to transmit requests and processing results, the security risks and system scalability issues of the HTTP protocol are resolved, achieving secure and efficient data transmission.
Patent Information
- Application Number
- CN202411151539.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2026-03-03
AI Technical Summary
The existing communication scheme for power production control zones relies on the HTTP protocol, which poses risks of man-in-the-middle attacks and data eavesdropping. Furthermore, deploying the client and server on the same physical machine increases deployment complexity and reduces system scalability and resource utilization efficiency.
The front-end page is generated by statically loading local web page files, and a private service bus is used to transmit request messages and processing results, avoiding communication via the HTTP protocol and using binary format for data format conversion to improve security.
It enables secure data transmission within the power production control area, meeting stringent security requirements, while also improving system scalability and resource utilization efficiency.
Smart Images

Figure CN121597925A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of power grid dispatching systems, specifically to a method, system, storage medium, electronic device, and computer program product for web page display. Background Technology
[0002] In power production control zones, data security is paramount. Current system architectures generally rely on the Hypertext Transfer Protocol (HTTP) for client-server communication. However, HTTP lacks built-in security encryption mechanisms, making it vulnerable to man-in-the-middle attacks and data eavesdropping, posing a threat to the high security requirements of power production control zones.
[0003] Some current solutions attempt to circumvent HTTP communication between nodes by deploying the client and server on the same physical machine, thereby reducing the time data is exposed on the network.
[0004] However, the inventors of this application have discovered that deploying the client and server on the same physical machine increases the complexity and workload of deployment. Each machine needs to be configured and maintained separately, which reduces the scalability and resource utilization efficiency of the system. Summary of the Invention
[0005] According to one aspect of this application, this application provides a method for displaying a webpage, the method comprising: statically loading a local webpage file according to preset conditions to generate a front-end page, wherein the preset conditions are updating the local webpage file and / or restarting the front-end page; obtaining a request message initiated by the front-end page; sending the request message to the server through a private service bus; receiving a processing result from the server through the private service bus; and sending the processing result to the front-end page so that the front-end page displays the processing result.
[0006] According to some embodiments of this application, the request message initiated by the front-end page satisfies a first format; after the above-described step of obtaining the request message initiated by the front-end page, the method further includes: converting the first format request message into a second format request message; the above-described step of sending the request message to the server through the private service bus may include: sending the second format request message to the server through the private service bus; the above-described step of receiving the processing result from the server through the private service bus may include: receiving the second format processing result from the server through the private service bus; converting the second format processing result into a first format processing result; the above-described step of sending the processing result to the front-end page so that the front-end page displays the processing result may include: sending the first format processing result to the front-end page so that the front-end page displays the first format processing result.
[0007] According to some embodiments of this application, the second format is a binary format.
[0008] According to some embodiments of this application, the method should be applicable to power production control areas.
[0009] According to one aspect of this application, this application provides a method for displaying a webpage, the method comprising: receiving a request message sent by a client via a private service bus; querying an available service list according to the request type of the request message to obtain a query result; sending the request message via a remote procedure call according to the query result; performing logical processing on the request message to obtain a processing result; obtaining the processing result obtained from the request message via a remote procedure call; and sending the processing result to the client via the private service bus.
[0010] According to some embodiments of this application, the request message is a second-format request message, and the processing result is a second-format processing result.
[0011] According to some embodiments of this application, the second format is a binary format.
[0012] According to some embodiments of this application, prior to the step of receiving request messages sent by the client via a private service bus, the method further includes: registering services to obtain a service list.
[0013] According to one aspect of this application, a webpage display system is provided. The system includes a client and a server. The client includes a webpage container, which statically loads local webpage files according to preset conditions to generate a front-end page. The preset conditions are updating the local webpage files and / or restarting the front-end page. The webpage container receives request messages initiated by the front-end page and sends the request messages through a private service bus. The server includes a service gateway, a service registry, and an application service. The application service registers services in the service registry to obtain a service list. The service gateway receives request messages through the private service bus and queries the list of available services based on the request type of the request message. The service registry sends the query results to the service gateway. Based on the query results, the service gateway sends request messages to the application service via remote procedure call. The application service receives the request messages and performs logical processing based on them to obtain a processing result. The application service sends the processing result to the service gateway via remote procedure call. The service gateway sends the processing result to the webpage container through the private service bus. The webpage container sends the processing result to the front-end page so that the front-end page displays the processing result.
[0014] According to some embodiments of this application, the request message initiated by the front-end page conforms to a first format; after obtaining the request message initiated by the front-end page, the web page container converts the first format request message into a second format request message, and sends the second format request message to the service gateway through a private service bus; the service gateway also sends the second format request message to the application service through a remote procedure call; the application service performs logical processing according to the second format request message to obtain a processing result that conforms to the second format. The application service sends the second format processing result to the service gateway through a remote procedure call; the service gateway also sends the second format processing result to the web page container through a private service protocol; the web page container also converts the second format processing result into a first format processing result and sends the first format processing result to the front-end page so that the front-end page displays the first format processing result.
[0015] According to one aspect of this application, a non-volatile computer-readable storage medium is also provided, on which a computer program is stored, which, when executed by a processor, can implement the webpage display method as described above.
[0016] According to one aspect of this application, an electronic device is also provided, comprising: one or more processors; and a storage device for storing one or more programs, which, when executed by the one or more processors, enable the one or more processors to implement the webpage display method as described above.
[0017] According to one aspect of this application, a computer program product is also provided, comprising: a computer program stored on a computer-readable storage medium; the computer program includes program instructions that, when executed by a computer, cause the computer to perform the webpage display method as described above.
[0018] According to one aspect of this application, a non-volatile computer-readable storage medium is also provided, on which a computer program is stored, which, when executed by a processor, can implement the webpage display method as described above.
[0019] According to one aspect of this application, an electronic device is also provided, comprising: one or more processors; and a storage device for storing one or more programs, which, when executed by the one or more processors, enable the one or more processors to implement the webpage display method as described above.
[0020] According to one aspect of this application, a computer program product is also provided, comprising: a computer program stored on a computer-readable storage medium; the computer program includes program instructions that, when executed by a computer, cause the computer to perform the webpage display method as described above.
[0021] The technical solution of this application loads web page files locally, eliminating the need to dynamically retrieve web page files from a web server via the HTTP protocol. This solution transmits web page request messages via a private service bus, without relying on the HTTP protocol, thus complying with the security constraints of the power production control area. Furthermore, the private service bus effectively prevents potential risks during data transmission, meeting the stringent data security requirements of the power production control area. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 A flowchart illustrating a method 1000 for displaying a webpage according to an embodiment of this application is shown.
[0024] Figure 2 A schematic flowchart of a webpage display method 2000 according to an embodiment of this application is shown;
[0025] Figure 3 A flowchart illustrating a method 3000 for displaying a webpage according to an embodiment of this application is shown.
[0026] Figure 4 A schematic diagram of the structure of a webpage display system 400 according to an embodiment of this application is shown. Detailed Implementation
[0027] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, they are provided so that this application will be thorough and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted.
[0028] The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a full understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced without one or more of these specific details, or other methods, components, materials, devices, etc. In these cases, well-known structures, methods, devices, implementations, materials, or operations will not be shown or described in detail.
[0029] Furthermore, the terms “comprising” and “having”, and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the steps or units listed, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or apparatus.
[0030] The terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order.
[0031] The technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0032] The Power Production Control Zone is a dedicated network area established by China's power industry to ensure the safe and stable operation of the power system. This zone is primarily used for real-time monitoring and control of critical components such as power generation, transmission, and substation. To protect power infrastructure from cybersecurity threats, the Hypertext Transfer Protocol (HTTP) is not permitted for communication within the Power Production Control Zone.
[0033] Existing technical solutions involve deploying the client and server on the same physical machine to circumvent HTTP communication between nodes. However, the inventors of this application have discovered that this co-location strategy does not fundamentally solve the security problem; it only mitigates network-level risks to a certain extent without addressing local security issues such as operating system vulnerabilities and internal data leaks. These remain significant security challenges that power production control areas must confront.
[0034] According to one aspect of this application, this application provides a method 1000 for displaying a webpage, see [link to relevant documentation]. Figure 1 The method 1000 includes steps S110-S150. Exemplarily, the method 1000 can be executed by a computer system. The computer system can be a client device (such as a host) with data processing capabilities.
[0035] In step S110, local web page files are statically loaded according to preset conditions to generate a front-end page. The preset conditions are updating the local web page files and / or restarting the front-end page.
[0036] For example, in step S110, the computer system can statically load local web page files according to preset conditions to generate a front-end page. The preset conditions can be updating the local web page files, such as upgrading them or repackaging and deploying them to the client machine. The preset conditions can also be restarting the front-end page, requiring it to be regenerated. Alternatively, the preset conditions can be that both updating the local web page files and restarting the front-end page occur simultaneously.
[0037] According to the example implementation, since conventional browsers cannot be installed and run in the power production control area, a web page container based on a browser kernel is developed to parse, render, and execute web page files such as Hyper Text Markup Language (HTML), Cascading Style Sheets (CSS), and JavaScript files. For example, the web page container can be developed based on open-source Qt Web Engine components, enabling bidirectional calls between JavaScript and C++ functions, and providing interfaces for sending and receiving service requests.
[0038] According to the example embodiment, the relevant web page files can be packaged and deployed to the client machine to form local web page files. The computer system can statically load, render, and execute the local web page files according to preset conditions, thereby providing users with an intuitive front-end page.
[0039] This application uses a computer system to statically load local web page files, which can dynamically obtain web page files from a web server without using network protocols, thus meeting the security requirements of the power production control area.
[0040] For example, a computer system develops a webpage container for loading local webpage files. First, it creates a QWebEngineView component, which is based on the Chromium browser engine. The computer system can then load and render webpage files using this container. The computer system calls the QWebEngineView component's load function to load the local HTML file.
[0041] Computer systems parse HTML files and construct a Document Object Model (DOM) tree. During the parsing process, if the computer system encounters... <style>标签可以加载并解析CSS文件应用到文档对象模型(Document Object Model,DOM)上,生成渲染树(Render Tree);计算机系统如遇到<script>标签可以加载并执行JavaScrip代码,可能会修改DOM结构或样式,从而影响渲染树的生成。
[0042] 解析完成后,计算机系统根据渲染树和布局信息绘制页面到屏幕上,从而生成用户所看到的前端页面。前端页面加载完成后会响应用户的操作,用户可以通过点击、滚动等方式与前端页面交互,比如可以向服务器端请求数据、请求文本、请求图片等。
[0043] 在步骤S120中,获取前端页面发起的请求报文。
[0044] 根据示例实施例,用户可以在前端页面进行操作,生成用户指令。前端页面根据用户指令,可以通过脚本函数调用的方式发起请求报文。在步骤S120中,计算机系统获取前端页面发起的请求报文。请求报文中包括服务类型和请求参数等信息。
[0045] 例如,前端页面的本地HTML文件中创建一个按钮对象<button>,并将其点击事件关联JavaScript脚本函数GetData,在用户点击这个按钮的情况下,会触发计算机系统进行GetData脚本的执行。GetData脚本执行时,计算机系统基于网页容器调用服务总线的请求报文发送函数SendRequest,将请求某个应用数据的请求报文发送到服务器端。这个请求应用数据内容为{"type":"RequestData","sql":"select value from substation"}。
[0046] 在步骤S130中,通过私有服务总线发送请求报文至服务器端。
[0047] 根据示例实施例,私有服务总线为基于ZeroMQ消息队列实现的消息传递机制。例如,在步骤S130中,计算机系统通过私有服务总线发送请求报文至服务器端,而不是通过网络协议,计算机系统可以安全地将请求报文发送至服务器端。
[0048] 例如,在服务器端可以基于服务网关启动的情况下,会创建ZeroMQ服务并监听客户端请求。计算机系统可以通过网页容器在接受到请求报文时会连接到服务器端,从而与服务器端建立起私有服务总线,并通过此私有服务总线将请求报文发送到服务器端。
[0049] 在步骤S140中,通过私有服务总线接收来自服务器端的处理结果。
[0050] 根据示例实施例,服务器端根据请求报文的请求类型在服务列表中进行查询。得到查询结果后,服务器端可以通过远程过程调用(Remote Procedure Call,RPC)的方式调用应用服务对请求报文进行逻辑处理,得到处理结果并发送。在步骤S140中,计算机系统通过私有服务总线接收来自服务器端的处理结果。
[0051] 例如,服务器端可以基于服务网关接收到请求报文后,调用服务器端的服务注册中心QueryAppList方法,根据请求报文的请求类型查询是否有应用服务能处理该请求。如果查询到对应的应用服务,服务注册中心将会返回该应用服务的服务地址和服务端口至服务网关,服务网关再通过远程过程调用(RPC)方式调用服务器端的对应应用服务的数据查询接口查询数据。
[0052] 应用服务查询完后,会把查询到的结果数据通过远程过程调用(RPC)方式返回给服务网关,计算机系统基于网页容器通过私有服务总线接收该查询到的结果数据。
[0053] 在步骤S150中,将处理结果发送至前端页面,以使得前端页面展示处理结果。
[0054] 例如,在步骤S150中,计算机系统可以通过通知方式将处理结果发送至前端页面。前端页面可以通过脚本方式,将该处理结果进行展示。
[0055] 例如,计算机系统基于网页容器接收到该查询到的结果数据后,通知前端页面已经查询到结果数据,并将查询到的结果数据返回给前端页面,前端页面在HTML文本组件中把数据展示出来。
[0056] 通过上述的实施例,本申请通过本地化加载网页文件,无需通过HTTP协议动态到网页服务器上获取网页文件。本申请通过私有服务总线传输网页的请求报文,不依赖HTTP协议进行请求报文传输,符合电力生产控制大区的安全约束;并且私有服务总线可有效防止数据在传输过程中的潜在风险,满足电力生产控制大区对数据安全的严格要求。
[0057] 可选地,本申请还提供一种网页的展示方法2000,参见图2,方法2000包括步骤S210-步骤S251。
[0058] 参加图2,步骤S210-步骤S220与上述的步骤S110-步骤S120相同,在此不做赘述。
[0059] 根据示例实施例,前端网页发起的请求报文为满足第一格式,例如,第一格式可以为Json(JavaScript Object Notation)格式。
[0060] 在步骤S221中,将第一格式请求报文转换为第二格式请求报文。
[0061] 例如,在步骤S221中,计算机系统可以通过c++函数将Json格式请求报文转换为第二格式请求报文。示例性地,第二格式可以为二进制格式,以提高请求报文传输过程中的安全性。
[0062] 例如,计算机系统基于网页容器通过JavaScript脚本Json.stringify将Json对象转换为字符串并调用网页容器的SendRquest方法将字符串作为参数传递给网页容器,网页容器通过QString.toUtf8方法将字符串转换为二进制格式。
[0063] 在步骤S231中,通过私有服务总线发送第二格式请求报文至服务器端。
[0064] 例如,在步骤S231中,通过私有服务总线,计算机系统发送二进制格式请求报文发送至服务器端。
[0065] 例如,服务器端基于服务网关在启动时就会创建ZeroMQ服务并监听计算机系统请求,计算机系统基于网页容器在接受到请求报文时会连接到服务器端,从而与服务器端建立起私有服务总线,计算机系统调用ZeroMQ的send方法即可将二进制格式请求报文发送到服务器端。
[0066] 在步骤S241中,通过私有服务总线接收来自服务器端的第二格式处理结果。
[0067] 根据是示例实施例,服务器端基于服务网关接收到客户端的二进制格式请求报文后会将二进制报文转换为Json格式报文,并根据请求报文的请求类型到服务注册中心查询能处理该请求的应用服务信息。
[0068] 得到查询结果后,服务网关通过远程过程调用(Remote Procedure Call,RPC)的方式调用应用服务,应用服务根据请求报文进行逻辑处理,并返回Json格式处理结果。服务网关将Json格式处理结果转换为二进制格式并通过私有服务总线发送到客户端的计算机系统。在步骤S241中,计算机系统通过私有服务总线接收来自服务器端的二进制格式处理结果。
[0069] 例如,服务器端基于服务网关接收到客户端的二进制格式请求报文后通过QString的fromUtf8函数将二进制请求报文转换Json格式请求报文,并调用服务注册中心QueryApp函数根据请求类型查询能处理该请求的应用服务信息。得到查询结果后,服务网关通过远程过程调用(Remote Procedure Call,RPC)的方式调用应用服务,应用服务根据请求报文进行逻辑处理,并返回Json格式处理结果。服务器端基于服务网关将Json格式处理结果转换为二进制格式并通过私有服务总线发送到客户端的计算机系统。
[0070] 在步骤S242中,将第二格式处理结果转换为第一格式处理结果。
[0071] 例如,在步骤S242中,计算机系统可以通过c++函数方式将二进制格式处理结果转换为Json格式处理结果。例如,计算机系统可以通过QString的fromUtf8函数将二进制格式处理结果转换为Json字符串格式处理结果。
[0072] 在步骤S251中,将第一格式处理结果发送至前端页面,以使得前端页面展示第一格式处理结果。
[0073] 例如,在步骤S251中,计算机系统可以以通知的方式将Json格式处理结果发送至前端页面,前端页面可以通过脚本函数方式,展示Json格式处理结果。
[0074] 例如,计算机系统基于网页容器的Qt Webchannel的信号槽机制将Json格式处理结果返回至前端页面的GetData脚本,前端页面可以基于GetData脚本修改文本的文本(text)属性的方法来展示Json格式处理结果。
[0075] 可选地,网页的展示方法2000还可以应用于电力生产控制大区。
[0076] 上述的实施例,通过将请求报文与处理结果进行格式转换,在传输请求报文与处理结果的过程中传输二进制格式,可以提高传输速度,并且,二进制格式的数据难以被读懂,从而进一步提高电力生产控制大区中数据传输的安全性。
[0077] 根据本申请的一方面,还提供一种网页展示的方法3000,参见图3,该方法3000包括步骤S310-步骤S360,示例性地,该方法3000可以由计算机处理系统所执行,计算机处理系统可以为具有数据处理能力的服务器端设备(如主机等)。
[0078] 在步骤S310中,通过私有服务总线接收客户端所发送的请求报文。
[0079] 根据示例实施例,在客户端开发基于浏览器内核的网页容器来解析、渲染和执行超文本标记语言(Hyper Text Markup Language,HTML)文件、层叠样式表文件(CascadingStyle Sheets,CSS)和JavaScript文件等网页文件。例如,网页容器可以基于开源的Qt WebEngine组件开发网页容器,可以进行JavaScript和C++函数的双向调用,网页容器可以提供发送和接收服务请求接口。
[0080] 根据示例实施例,相关的网页文件可以打包部署到客户端机器上,形成本地网页文件,客户端可以根据预设条件静态加载、渲染和执行本地网页文件,从而为用户提供直观的前端页面。
[0081] 根据示例实施例。预设条件可以为本地网页文件更新,例如,本地网页文件升级,重新打包部署到客户端机器。预设条件还可以为前端页面重新启动,需要重新生成前端页面。预设条件还可以为本地网页文件更新和前端页面重新启动两者同时发生。
[0082] 根据示例实施例,用户可以在前端页面进行操作,生成用户指令,前端页面根据用户指令,可以通过脚本函数调用的方式发起请求报文,客户端获取请求报文。请求报文中包括服务类型和请求参数等信息。在步骤S310中,计算机处理系统通过私有服务总线接收客户端所发送的请求报文。
[0083] 根据示例实施例,私有服务总线可以为基于ZeroMQ消息队列实现的消息传递机制。通过私有服务总线,而不是通过http协议,计算机处理系统可以安全地接收客户端发送的请求报文。
[0084] 例如,计算机处理系统可以基于服务网关,在服务网关启动时创建ZeroMQ服务并监听客户端请求,客户端的网页容器在接受到请求报文时会连接到计算机处理系统,从而与计算机处理系统建立起私有服务总线,并通过此私有服务总线将请求报文发送到计算机处理系统。
[0085] 可选地,在步骤S310之前,计算机处理系统还注册服务得到以得到服务注册列表。例如,计算机处理系统可以提供查询数据、查询图片、查询文本等应用服务,通过将应用服务进行注册,可以得到可用服务列表。
[0086] 在步骤S320中,根据请求报文的请求类型查询可用服务列表,以得到查询结果。
[0087] 根据示例实施例,在步骤S320中,计算机处理系统根据请求报文的请求类型查询可用服务列表,以得到查询结果。例如,计算机处理系统基于服务网关接受到请求后,会根据请求类型QueryData到服务注册中心查询可用的服务列表,如果有能处理QueryData的应用服务,服务注册中心就会返回该服务的服务地址和服务端口。
[0088] 在步骤S330中,根据查询结果,通过远程过程调用发送请求报文。
[0089] 例如,在步骤S330中,计算机处理系统根据查询结果,通过远程过程调用发送请求报文。计算机处理系统基于服务网关在服务注册中心查询到能处理QueryData请求的应用服务的服务地址和服务端口后,就会使用远程过程调用方式将请求报文发送给该应用服务。
[0090] 在步骤S340中,根据请求报文进行逻辑处理,以得到处理结果
[0091] 例如,在步骤S340中,计算机处理系统根据请求报文进行逻辑处理,以得到处理结果。例如,计算机系统基于应用服务收到请求报文后,根据其中的sql语句到数据库查询数据。
[0092] 在步骤S350中,通过远程过程调用获取根据请求报文得到的处理结果。
[0093] 例如,在步骤S350中,计算机处理系统通过远程过程调用获取根据请求报文得到的处理结果。例如,计算机处理系统基于应用服务查询到数据后通过远程过程调用将查询到的结果数据返回至服务网关。
[0094] 在步骤S360中,通过私有服务总线发送处理结果至客户端。
[0095] 例如,在步骤S360中,计算机处理系统通过私有服务总线发送处理结果至客户端。例如,计算机系统基于服务网关将查询到的结果数据通过ZeroMQ消息队列发送到客户端。
[0096] 通过上述的实施例,通过远程过程调用的方式传输请求报文与处理结果,不依赖HTTP协议进行请求报文与处理结果的传输,符合电力生产控制大区的安全约束。
[0097] 可选地,客户端获取的请求报文可以为第一格式,例如,Json格式,客户端可以将第一格式请求报文转换为第二格式请求报文,以防止数据泄密。示例性地,第二格式可以为二进制格式。计算机处理系统通过私有服务总线接收二进制格式请求报文,计算机处理系统根据二进制格式请求报文的请求类型在服务列表中进行查询,得到查询结果后,计算机处理系统可以通过远程过程调用(Remote Procedure Call,RPC)的方式发送二进制格式请求报文,根据查询结果,对二进制格式请求报文进行逻辑处理,得到二进制格式处理结果并发送至客户端。
[0098] 例如,计算机处理系统端基于服务网关接收到客户端的二进制格式请求报文后通过QString的fromUtf8函数将二进制请求报文转换Json格式请求报文,并调用服务注册中心QueryApp函数根据请求类型查询能处理该请求的应用服务信息。
[0099] 得到查询结果后,服务网关通过远程过程调用(RPC)的方式调用应用服务,应用服务根据请求报文进行逻辑处理,并返回Json格式处理结果。计算机处理系统基于服务网关将Json格式处理结果转换为二进制格式并通过私有服务总线发送到客户端。
[0100] 根据本申请的一方面,本申请提供一种网页展示的系统400,参见图4,该系统400包括客户端410和服务器端420。客户端410包括网页容器411,服务器端420包括服务网关421、服务注册中心422和应用服务423。
[0101] 根据示例实施例,网页容器411根据预设条件静态加载本地网页文件,以生成前端页面,预设条件为本地网页文件更新和 / 或前端页面重启,网页容器411获取前端页面发起的请求报文。
[0102] 根据示例实施例,电力生产控制大区不能安装和运行常规浏览器,开发基于浏览器内核的网页容器411来解析、渲染和执行超文本标记语言(Hyper Text MarkupLanguage,HTML)文件、层叠样式表文件(Cascading Style Sheets,CSS)和JavaScript文件等网页文件。例如,网页容器411可以基于开源的Qt Web Engine组件开发网页容器411,可以进行JavaScript和C++函数的双向调用,网页容器411可以提供发送和接收服务请求接口。
[0103] 根据示例实施例,相关的网页文件可以打包部署到客户端410机器上,形成本地网页文件,网页容器411可以根据预设条件静态加载、渲染和执行本地网页文件,从而为用户提供直观的前端页面。
[0104] 根据示例实施例。预设条件可以为本地网页文件更新,例如,本地网页文件升级,重新打包部署到客户端410机器。预设条件还可以为前端页面重新启动,需要重新生成前端页面。预设条件还可以为本地网页文件更新和前端页面重新启动两者同时发生。
[0105] 本申请通过网页容器411静态加载本地网页文件,可以不通过网络协议到网页服务器端420端动态获取网页文件,满足电力生产控制大区的安全要求。
[0106] 例如,开发了用于加载本地网页文件的网页容器411,首先创建一个QWebEngineView组件,该组件基于Chromium浏览器内核,可以进行本地网页文件的加载和渲染。然后网页容器411通过调用QWebEngineView组件的load函数加载本地HTML文件。
[0107] 在QWebEngineView加载HTML文件之后,网页容器411开始解析HTML文件并构建文档对象模型(Document Object Model)树。在解析过程中,网页容器411如遇到<style>标签会加载并解析CSS文件应用到DOM上,生成渲染树(Render Tree),网页容器411如遇到<script>标签会加载并执行JavaScript代码,可能会修改DOM结构或样式,从而影响渲染树的生成。
[0108] 解析完成后,网页容器411根据渲染树和布局信息绘制页面到屏幕上,从而生成用户所看到的前端页面。前端页面加载完成后会响应用户的操作,用户可以通过点击、滚动等方式与页面交互,比如可以向服务器端请求数据、请求文本、请求图片等。
[0109] 根据示例实施例,用户可以在前端页面进行操作,生成用户指令,前端页面根据用户指令,可以通过脚本函数调用的方式发起请求报文,网页容器411获取请求报文。请求报文中包括服务类型和请求参数等信息。
[0110] 例如,前端页面的本地HTML文件中创建一个按钮对象<button>,并将其点击事件关联JavaScript脚本函数GetData,在用户点击这个按钮的情况下,会触发网页容器411进行GetData脚本的执行。
[0111] 在GetData脚本执行的情况下,网页容器411调用服务总线的请求报文发送函数SendRequest,将请求某个应用数据的请求报文发送到服务器端。这个请求应用数据的请求报文可以为Json格式,内容为{"type":"RequestData","sql":"select value fromsubstation"}。
[0112] 根据示例实施例,网页容器411通过私有服务总线发送请求报文。私有服务总线可以为基于ZeroMQ消息队列实现的消息传递机制。通过私有服务总线,而不是通过网络协议,网页容器411可以安全地将请求报文发送至客户端410。
[0113] 例如,在服务网关421在启动的情况下,服务网关421就会创建ZeroMQ服务并监听客户端请求,网页容器411在接受到请求报文时会连接到,从而与服务器端420建立起私有服务总线,并通过此私有服务总线将请求报文发送到服务器端420。
[0114] 根据示例实施例,应用服务423在服务注册中心422进行服务的注册,以得到服务列表。例如,应用服务423可以提供查询数据、查询图片、查询文本等应用服务423,应用服务423通过将服务进行注册,服务注册中心422可以得到可用服务列表。服务注册时应用服务423提供详细的元数据,如服务名称、版本、接口描述等,以便于服务发现,服务注册中心422可以动态更新服务列表,确保服务发现的准确性。
[0115] 应用服务423启动后,可以通过调用服务注册中心422注册接口进行服务注册增加服务类型,提供自身的元数据,比如服务名称、IP地址、端口、运行状况等信息。在服务注册后,应用服务423可以按照预设频率向服务注册中心422发送心跳,从而持续通知服务注册中心422应用服务423的运行状态。例如,预设频率可以为每30秒发送一次心跳。
[0116] 根据示例实施例,服务网关421通过私有服务总线接收请求报文,服务网关421根据请求报文的请求类型查询可用服务列表,示例性地,查询方式可以为远程过程调用(RPC)。
[0117] 根据示例实施例,服务注册中心422将查询结果发送至服务网关421,服务网关421根据查询结果,通过远程过程调用发送请求报文至对应的应用服务423。应用服务423接收请求报文,并根据请求报文中的参数对请求报文进行逻辑处理,以得到处理结果,应用服务423通过远程过程调用发送处理结果至服务网关421。
[0118] 例如,服务网关421收到客户端410的请求报文后调用服务注册中心422QueryAppList方法,服务网关421根据请求类型查询是否有应用服务能处理该请求。如果查询到对应的应用服务423,服务注册中心422将会返回该应用服务423的服务地址和服务端口至服务网关421。
[0119] 服务网关421再通过远程过程调用(RPC)方式调用该应用服务423的数据查询接口查询数据。应用服务423查询完后,将查询到的结果数据通过远程过程调用(RPC)方式返回给服务网关421。
[0120] 根据示例实施例,服务网关421通过私有服务总线发送处理结果至网页容器411,网页容器411将处理结果发送至前端页面,以使得前端页面展示处理结果。
[0121] 根据示例实施例,网页容器411可以以通知的方式将处理结果发送至前端页面,前端页面可以通过脚本方式,将该处理结果进行展示。例如,网页容器411通知前端页面已经查询到结果数据,并将结果数据返回给前端页面,前端页面在HTML文本组件中把数据展示出来。
[0122] 可选地,服务网关421在接收多个请求报文的情况下,还可以通过轮询方式提供负载均衡机制,以使得应用服务423可以同时处理多个请求报文。
[0123] 通过上述的实施例,网页容器411通过本地化加载网页文件,无需通过HTTP协议动态到网页服务器端420上获取网页文件;并且网页容器411通过私有服务总线传输网页的请求报文,不依赖HTTP协议进行请求报文传输,符合电力生产控制大区的安全约束。并且私有服务总线可有效防止数据在传输过程中的潜在风险,满足电力生产控制大区对数据安全的严格要求。
[0124] 通过上述的实施例,服务网关421通过远程过程调用的方式传输请求报文与处理结果,不依赖HTTP协议进行请求报文与处理结果的传输,符合电力生产控制大区的安全约束。
[0125] 可选地,前端网页发起的请求报文为满足第一格式,例如,第一格式可以为Json(JavaScript Object Notation)格式。网页容器411在获取前端页面发起的请求报文之后,还将第一格式请求报文转换为第二格式请求报文。
[0126] 示例性地,第二格式可以为二进制格式,以提高请求报文传输过程中的安全性。例如,网页容器411可以通过c++函数函数的方式将Json格式请求报文转换为二进制格式请求报文。
[0127] 例如,网页容器411通过JavaScript脚本Json.stringify将Json对象转换为字符串,并调用网页容器411的SendRquest方法将字符串作为参数传递给网页容器411,网页容器411通过QString.toUtf8方法将字符串转换为二进制格式。
[0128] 根据示例实施例,网页容器411通过私有服务总线发送第二格式请求报文至服务网关421。服务网关421通过私有服务总线接收二进制格式请求报文,服务网关421根据二进制格式请求报文的请求类型在服务列表中进行查询,得到查询结果后,服务网关421可以通过远程过程调用的方式发送二进制格式请求报文至对应的应用服务423。应用服务423接收二进制格式请求报文,并根据二进制格式请求报文中的参数对请求报文进行逻辑处理,以得到二进制格式处理结果,应用服务423通过远程过程调用发送二进制格式处理结果至服务网关421。
[0129] 例如,服务网关421在启动时就会创建ZeroMQ服务并监听客户端410请求,客户端410的网页容器411在接受到请求报文时会连接到服务器端420,从而与服务器端420建立起私有服务总线,客户端410调用ZeroMQ的send方法即可将二进制格式请求报文发送到服务器端420。
[0130] 根据示例实施例,服务网关421通过私有服务总线发送第二格式处理结果至网页容器411,网页容器411将第二格式处理结果转换为第一格式处理结果。例如,网页容器411可以通过c++函数方式将二进制格式处理结果转换为Json格式处理结果。
[0131] 例如,服务器端420的服务网关421接收到客户端410的二进制格式请求报文后,通过QString的fromUtf8函数将二进制格式请求报文转换Json格式请求报文,并调用服务注册中心422的QueryApp函数根据请求类型查询能处理该请求的应用服务信息,得到查询结果后,服务网关421通过远程过程调用(RPC)的方式调用应用服务423,应用服务423根据请求报文进行逻辑处理,并返回Json格式处理结果。
[0132] 服务网关421将Json格式处理结果转换为二进制格式并通过私有服务总线发送到客户端410的网页容器411。网页容器411通过QString的fromUtf8函数将二进制格式处理结果转换为Json格式处理结果。
[0133] 根据示例实施例,网页容器411将第一格式处理结果发送至前端页面,以使得前端页面展示第一格式处理结果。例如,网页容器411可以通过通知方式将Json格式处理结果发送至前端页面,前端页面可以通过脚本方式,展示Json格式处理结果。
[0134] 例如,网页容器411利用Qt Webchannel的信号槽机制将Json格式处理结果返回至前端页面的GetData脚本,脚本通过修改文本框文本(text)属性的方法来展示Json格式处理结果。
[0135] 上述的实施例,通过将请求报文和处理结果进行格式转换,可以提高在请求报文和处理结果通过私有服务总线传输的过程中的安全性,防止泄密。
[0136] 根据本申请的一方面,还提供一种非易失性计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时能够实现如上文所述的网页展示的方法。
[0137] 根据本申请的一方面,还提供一种电子设备,包括:一个或多个处理器;存储装置,用于存储一个或多个程序,当一个或多个程序被一个或多个处理器执行时,使得一个或多个处理器,能够实现如上文所述的网页展示的方法。
[0138] 根据本申请的一方面,还提供一种计算机程序产品,包括:存储在计算机可读存储介质上的计算机程序;计算机程序包括程序指令,当程序指令被计算机执行时,使计算机执行如上文所述的网页展示的方法。
[0139] 根据本申请的一方面,还提供一种非易失性计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时能够实现如上文所述的网页展示的方法。
[0140] 根据本申请的一方面,还提供一种电子设备,包括:一个或多个处理器;存储装置,用于存储一个或多个程序,当一个或多个程序被一个或多个处理器执行时,使得一个或多个处理器,能够实现如上文所述的网页展示的方法。
[0141] 根据本申请的一方面,还提供一种计算机程序产品,包括:存储在计算机可读存储介质上的计算机程序;计算机程序包括程序指令,当程序指令被计算机执行时,使计算机执行如上文所述的网页展示的方法。
[0142] 最后应说明的是,以上所述仅为本申请的优选实施例而已,并不用于限制本申请,尽管参照前述实施例对本申请进行详细的说明,对于本领域的技术人员来说,其依然可以对前述各实施例的技术方案进行修改,或者对其中部分技术特征进行等同替换。凡在本申请的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。< / style>
Claims
1. A method for displaying a webpage, characterized in that, The method includes: Local web page files are statically loaded according to preset conditions to generate a front-end page, wherein the preset conditions are updating the local web page files and / or restarting the front-end page; Obtain the request message initiated by the front-end page; The request message is sent to the server via a private service bus. The processing results are received from the server via a private service bus; The processing result is sent to the front-end page so that the front-end page can display the processing result.
2. The method according to claim 1, characterized in that, The request message initiated by the front-end page meets the first format; After obtaining the request message initiated by the front-end page, the method further includes: converting the first format request message into a second format request message; Sending the request message to the server via the private service bus includes: Send the second format request message to the server via the private service bus; Receiving the processing results from the server via the private service bus includes: Receive the second format processing result from the server via a private service bus; Convert the result processed in the second format to the result processed in the first format; Sending the processing result to the front-end page so that the front-end page displays the processing result includes: The first format processing result is sent to the front-end page so that the front-end page displays the first format processing result.
3. The method according to claim 2, characterized in that, The second format is a binary format.
4. The method according to claim 3, characterized in that, The method is applied to the power production control area.
5. A method for displaying a webpage, characterized in that, The method includes: Receive request messages sent by clients through a private service bus; The available service list is queried based on the request type of the request message to obtain the query results; Based on the query results, the request message is sent via remote procedure call; The request message is logically processed to obtain the processing result; The processing result obtained from the request message is obtained through the remote procedure call; The processing result is sent to the client via the private service bus.
6. The method according to claim 5, characterized in that, The request message is a second-format request message, and the processing result is a second-format processing result.
7. The method according to claim 6, characterized in that, The second format is a binary format.
8. The method according to any one of claims 5-7, characterized in that, Before receiving the request message sent by the client via the private service bus, the method further includes: Register for the service to obtain the aforementioned list of services.
9. A webpage display system, characterized in that, The system includes a client and a server. The client includes: A webpage container statically loads local webpage files according to preset conditions to generate a front-end page. The preset conditions are that the local webpage files are updated and / or the front-end page is restarted. The webpage container obtains the request message initiated by the front-end page and sends the request message through a private service bus. The server side includes a service gateway, a service registry, and application services; The application service registers its services with the service registry to obtain a service list; The service gateway receives the request message through the private service bus, and the service gateway queries the list of available services according to the request type of the request message; The service registry sends the query results to the service gateway; Based on the query result, the service gateway sends the request message to the application service via remote procedure call; The application service receives the request message and performs logical processing on the request message to obtain a processing result. The application service then sends the processing result to the service gateway via the remote procedure call. The service gateway sends the processing result to the webpage container through the private service bus; The webpage container sends the processing result to the front-end page so that the front-end page can display the processing result.
10. The system according to claim 9, characterized in that, The request message initiated by the front-end page meets the first format; After obtaining the request message initiated by the front-end page, the web page container also converts the first format request message into a second format request message, and sends the second format request message to the service gateway through the private service bus; The service gateway also sends a request message in the second format to the application service via the remote procedure call; The application service performs logical processing on the second format request message to obtain a processing result. The processing result satisfies the second format. The application service sends the second format processing result to the service gateway through the remote procedure call. The service gateway also sends the second format processing result to the web page container through the private service protocol; The webpage container also converts the second format processing result into a first format processing result and sends the first format processing result to the front-end page so that the front-end page displays the first format processing result.
11. A non-volatile computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the method for displaying a webpage that satisfies the security constraints of the power production control area as described in any one of claims 1-4.
12. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method for displaying web pages that meet the security constraints of the power production control area as described in any one of claims 1-4.
13. A computer program product, characterized in that, The method includes a computer program stored on a computer-readable storage medium, the computer program including program instructions that, when executed by a computer, cause the computer to perform the method for displaying a webpage that satisfies the security constraints of a power production control area as described in any one of claims 1-4.
14. A non-volatile computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the method for displaying a webpage that satisfies the security constraints of the power production control area as described in any one of claims 5-8.
15. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method for displaying web pages that meet the security constraints of the power production control area as described in any one of claims 5-8.
16. A computer program product, characterized in that, The method includes a computer program stored on a computer-readable storage medium, the computer program including program instructions that, when executed by a computer, cause the computer to perform the method for displaying a webpage that satisfies the security constraints of a power production control area as described in any one of claims 5-8.
Citation Information
Patent Citations
Web request processing method and web request processing device
CN107040609A
Data processing method and device, equipment and computer readable storage medium
CN111988418A
Webpage resource processing method and device, electronic equipment and storage medium
CN113312577A
A qualified electronic signature system, associated method and mobile phone device for a qualified electronic signature
EP2582115A1