File processing method, server and client
By setting the target interface on the server to receive and process the client's file processing requests, the problem of the browser's inability to efficiently manage server files is solved, the visual operation of the browser page is realized, and the system complexity and cost are reduced.
Patent Information
- Application Number
- CN202510794535.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-13
- Publication Date
- 2025-10-03
AI Technical Summary
In the existing technology, browsers are limited by their own security policies and cannot achieve efficient file transfer and management between servers and clients, resulting in increased system complexity and cost.
By setting up a target interface on the server, receiving the client's file processing request, and returning the request result data to the browser through the target interface, visual browsing and interactive operations of the server file resources can be achieved.
It reduces the complexity and cost of the system, improves the operability of browser pages to server file resources, and does not require changes to the existing Web application architecture.
Smart Images

Figure CN120744255A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of Internet technology, and in particular relates to a file processing method, a server, and a client. Background Art
[0002] The information exchange between the server and the client is very important. By using the browser as the core carrier of Web applications, a distributed architecture model that decouples the server and the client is implemented, allowing multiple devices to access a unified data source through standardized protocols.
[0003] Current browsers, constrained by their own security policies, typically only support basic file transfer functions (upload and download) when interacting with servers. Users need dedicated client software or tools to manage server files, increasing system complexity and costs. Summary of the Invention
[0004] This application aims to solve at least one of the technical problems existing in the prior art. To this end, this application proposes a file processing method, server, and client that can realize visual browsing and interactive operations of server file resources through browser pages, reducing the complexity and cost of the system.
[0005] In a first aspect, the present application provides a file processing method, which is applied to a server, the server being provided with a target interface, and the method comprising:
[0006] receiving, through the target interface, a file processing request sent by a client, wherein the file processing request is generated by a browser of the client and is used to instruct an operation to be performed on a file resource of the server;
[0007] In response to the file processing request, generating corresponding request result data;
[0008] The request result data is sent to the client through the target interface so that the browser can display the request result data.
[0009] According to the file processing method of the present application, a target interface is set on the server, a file processing request sent by the client is received, the file resources of the server are operated, and the request result data is returned to the client through the target interface. The corresponding request result data is displayed on the browser page of the client, and visual browsing and interactive operations of the server file resources are realized through the browser page, thereby reducing the complexity and cost of the system.
[0010] According to one embodiment of the present application, generating corresponding request result data in response to the file processing request includes:
[0011] Performing permission verification on the file processing request;
[0012] Generate the request result data corresponding to the permission verification result.
[0013] According to one embodiment of the present application, generating the request result data corresponding to the permission verification result includes:
[0014] If the permission check of the file processing request passes, generating file result data corresponding to the file processing request;
[0015] Alternatively, when the permission check of the file processing request fails, prompt result data corresponding to the file processing request is generated.
[0016] According to one embodiment of the present application, generating corresponding request result data in response to the file processing request includes:
[0017] Determining a file scanning scope of the server based on the file processing request;
[0018] The file resources within the file scanning range in the server are operated to generate the request result data.
[0019] According to one embodiment of the present application, generating the request result data includes:
[0020] Convert the file resource into a predefined file tree structure object to obtain generated request result data;
[0021] The predefined file tree structure objects include: string labels, string paths, Boolean flags, and collection information.
[0022] According to one embodiment of the present application, the server is provided with a plurality of the target interfaces, each of which is used to receive the file processing request of a corresponding request type.
[0023] In a second aspect, the present application provides a file processing method, which is applied to a client and includes:
[0024] In response to the input of the browser of the client, a file processing request is generated, wherein the file processing request is used to instruct to operate the file resource of the server;
[0025] Sending the file processing request to the target interface of the server, so that the server responds to the file processing request and generates corresponding request result data;
[0026] Receive the request result data returned by the server through the target interface, and display the request result data on the browser.
[0027] According to the file processing method of the present application, a file processing request is sent to the target interface of the server, the file resources of the server are operated, and the request result data returned is received through the target interface, and the corresponding request result data is displayed on the browser page of the client. Visual browsing and interactive operations of the server file resources are realized through the browser page, reducing the complexity and cost of the system.
[0028] According to one embodiment of the present application, the request result data is file result data or prompt result data; the browser has an interface component for displaying a tree data structure, and the browser is used to display the file result data based on the tree data structure.
[0029] According to one embodiment of the present application, the browser is used to execute a lazy loading strategy for the request result data.
[0030] In a third aspect, the present application provides a file processing device, which is applied to a server, the server being provided with a target interface, and the device comprising:
[0031] A first receiving module is configured to receive a file processing request sent by a client through the target interface, wherein the file processing request is generated by a browser of the client and is used to instruct an operation to be performed on a file resource of the server;
[0032] A first response module, configured to generate corresponding request result data in response to the file processing request;
[0033] The first sending module is used to send the request result data to the client through the target interface, so that the browser can display the request result data.
[0034] In a fourth aspect, the present application provides a file processing device, which is applied to a client and includes:
[0035] A second response module is configured to generate a file processing request in response to an input from the browser of the client, wherein the file processing request is used to instruct an operation to be performed on a file resource of the server;
[0036] a second sending module, configured to send the file processing request to a target interface of the server, so that the server generates corresponding request result data in response to the file processing request;
[0037] The second receiving module is configured to receive the request result data returned by the server through the target interface, and display the request result data on the browser.
[0038] In a fifth aspect, the present application provides a server, which is provided with a target interface and is used to execute the file processing method as described in the first aspect above.
[0039] In a sixth aspect, the present application provides a client having a browser, and the client is used to execute the file processing method as described in the second aspect above.
[0040] In the seventh aspect, the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the file processing method as described in the first or second aspect above is implemented.
[0041] In an eighth aspect, the present application provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the file processing method as described in the first or second aspect above.
[0042] In a ninth aspect, the present application provides a computer program product, comprising a computer program, which, when executed by a processor, implements the file processing method as described in the first or second aspect above.
[0043] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become obvious from the description below, or will be learned through practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0045] Figure 1 This is one of the flowcharts of the file processing method provided in the embodiment of the present application;
[0046] Figure 2 This is the second flowchart of the file processing method provided in the embodiment of the present application;
[0047] Figure 3 This is one of the structural diagrams of the file processing device provided in the embodiment of the present application;
[0048] Figure 4 This is the second structural diagram of the file processing device provided in the embodiment of the present application;
[0049] Figure 5 This is one of the schematic diagrams of the interaction between the server and the client provided in the embodiment of the present application;
[0050] Figure 6This is the second schematic diagram of the interaction between the server and the client provided in the embodiment of the present application;
[0051] Figure 7 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0052] The following will be combined with the accompanying drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the embodiments described are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field are within the scope of protection of this application.
[0053] The terms "first," "second," and the like in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of this application can be implemented in an order other than that illustrated or described herein, and that the objects distinguished by "first," "second," and the like are generally of the same type, and do not limit the number of objects; for example, the first object can be one or more. In addition, the term "and / or" in the specification and claims refers to at least one of the connected objects, and the character " / " generally indicates that the objects connected are in an "or" relationship.
[0054] The file processing method provided in the embodiment of the present application is implemented based on the browser of the client 520 in cooperation with the server 510. Through the design of the target interface on the server 510, it overcomes the defect that the browser page cannot operate the file resources of the server 510. The file resources of the server 510 can be visually browsed and interactively operated through the browser page, reducing the complexity and cost of the system.
[0055] The following, in conjunction with the accompanying drawings, describes in detail the file processing method, file processing device, server 510, client 520, electronic device and readable storage medium provided in the embodiments of the present application through specific embodiments and their application scenarios.
[0056] The server 510 and the client 520 are two different devices in a computer network. The server 510 can provide various services and file resources to the client 520 , and the client 520 can send a request to the server 510 through the network to obtain services or file resources.
[0057] In an embodiment of the present application, in a system including a server 510 and a client 520, the client 520 generates a file processing request instructing to operate on the file resources of the server 510 in response to the input of the browser (such as a click operation or command input by the user on the browser page). The server 510 receives the file processing request through the target interface, generates corresponding request result data in response to the file processing request, and returns the request result data to the client 520 through the target interface. After receiving the request result data, the client 520 displays the request result data on the browser page.
[0058] It is understandable that communication can be established between the server 510 and the client 520 through HTTP protocol, TCP protocol, etc. to achieve information interaction between the server 510 and the client 520. The target interface set by the server 510 can be an interface based on the HTTP protocol.
[0059] The following describes the embodiments of the present application in detail from two different implementation perspectives: the server 510 and the client 520.
[0060] An embodiment of the present application provides a file processing method, which is applied to a server 510. The server 510 is provided with a target interface. The execution subject of the file processing method can be a functional module or functional entity in the server 510 that can implement the file processing method. The file processing method provided in the embodiment of the present application is described below using the server 510 as an execution subject as an example.
[0061] like Figure 1 As shown, the file processing method includes: step 110, step 120 and step 130.
[0062] Step 110: Receive a file processing request sent by the client 520 through the target interface.
[0063] The file processing request is generated by the browser of the client 520 , and is used to instruct to operate on the file resources of the server 510 .
[0064] In this embodiment, the browser page of the client 520 receives user input, and in response to the user input, generates a file processing request on the client 520. The file processing request is an instruction submitted by the client 520 to the server 510 to move, edit, delete, read, write, etc. the file resources of the server 510.
[0065] In this step, the server 510 is provided with a target interface, the client 520 sends a file processing request to the target interface of the server 510, and the server 510 receives the file processing request through the target interface.
[0066] It should be noted that the number of target interfaces in the server 510 is configurable. Different target interfaces can be set according to the type of operation on the file resources to receive corresponding file processing requests. For example, one target interface is configured for the deletion operation, and one target interface is configured for the move operation. The two target interfaces receive file processing requests for deletion operations and move operations on file resources respectively.
[0067] Step 120: Generate corresponding request result data in response to the file processing request.
[0068] In this step, after receiving the file processing request sent by the client 520, the server 510 parses the file processing request, determines the type of operation on the file resources proposed by the client 520, and performs corresponding operations on the file resources of the server 510 in response to the file processing request, generating request result data corresponding to the file processing request.
[0069] Step 130: Send the request result data to the client 520 through the target interface so that the browser can display the request result data.
[0070] In this step, the server 510 returns the request result data to the client 520 through the target interface. After receiving the request result data, the client 520 displays the request result data on the browser page.
[0071] It should be noted that, through the target interface set by the server 510, the client 520 can submit a file processing request to the server 510 to move, edit, delete, read, write and other operations on the file resources of the server 510. The operation of the file resources is performed on the server 510 and the file resources operated can be physical files. The client 520 only sends a file processing request and is not restricted by the browser's own security policy. Visual browsing and interactive operations of the file resources of the server 510 can be achieved through the browser page.
[0072] In some embodiments, the server 510 is provided with multiple target interfaces, each target interface being used to receive a file processing request of a corresponding type.
[0073] In this embodiment, for different file processing requests, the target interface on the server can be customized to receive and process different types of file processing requests.
[0074] For example, define the target interface D corresponding to the file deletion processing request. If the file processing request includes a deletion parameter (ie, a delete parameter), the target interface D receives the file deletion processing request and deletes the file according to the corresponding file path.
[0075] For another example, a target interface M corresponding to a file move processing request is defined. If the file processing request includes a move parameter (ie, a cp to parameter), the target interface M receives the file move processing request and moves the file according to the corresponding file path.
[0076] It is understandable that different target interfaces receive different requests, and different interfaces can be optimized independently to avoid overloading a single target interface. Server 510 can flexibly expand the target interface and significantly improve concurrent processing capabilities and system stability.
[0077] Among related technologies, Node.js is used to build a middleware proxy, which deviates from the standard Web service architecture, bypasses browser security policies, and performs file system operations. This type of technical architecture significantly increases the complexity and requires redesigning the communication protocol, permission verification system, synchronization mechanism, and other development work between the browser and the backend server. This destroys the architectural integrity of existing Web applications and brings the risk of difficulty in maintenance.
[0078] In an embodiment of the present application, a target interface is set on the server 510, and a file processing request sent by the client 520 is received through the target interface. The server 510 responds to the file processing request and returns the request result data to the client 520 through the target interface, so that the browser page of the client 520 can display the request result data. When browsing and operating the file resources of the server 510 on the browser page, the file attribute content (type, storage path, permissions, encryption status, etc.) other than the file itself can also be obtained. Without changing the existing Web architecture, the visual browsing and interactive operation of the file resources of the server 510 can be realized through the browser page, reducing the complexity and cost of the system.
[0079] According to the file processing method provided in the embodiment of the present application, a target interface is set on the server 510, a file processing request sent by the client 520 is received, the file resources of the server 510 are operated, and the request result data is returned to the client 520 through the target interface, and the corresponding request result data is displayed on the browser page of the client 520. Visual browsing and interactive operations of the file resources of the server 510 are realized through the browser page, thereby reducing the complexity and cost of the system.
[0080] In some embodiments, in response to a file processing request, generating corresponding request result data may include:
[0081] Perform permission verification on file processing requests;
[0082] Generate request result data corresponding to the permission verification result.
[0083] In this embodiment, after receiving the file processing request from the client 520, the server 510 parses the file processing request, performs a permission check on the file processing request, and generates corresponding request result data based on the permission check result of whether the permission check passes or not, and returns it to the client 520.
[0084] In actual implementation, the server 510 may perform permission verification on the file processing request received from the target interface according to preset permission verification rules, and implement dynamic filtering and access control on the input and output data streams.
[0085] It can be understood that performing permission verification on file processing requests can prevent unauthorized clients 520 from accessing sensitive file resources of server 510 and block malicious operations of client 520. Permission verification can effectively verify the user identity and permission scope of client 520, and on the basis of ensuring normal access, improve the security and data integrity of the system where server 510 and client 520 are located.
[0086] In actual execution, the permission check results are divided into permission check passed and permission check failed.
[0087] In some embodiments, generating request result data corresponding to the permission verification result includes:
[0088] When the permission check of the file processing request passes, file result data corresponding to the file processing request is generated.
[0089] It can be understood that passing the permission check of the file processing request indicates that the client 520 that sends the file processing request has the permission to request the server 510 to perform the file resource operation corresponding to the file processing request.
[0090] In this embodiment, the server 510 receives a file processing request from the client 520 through the target interface, performs a permission check on the file processing request, and when the permission check of the file processing request passes, performs the operation corresponding to the file processing request on the file resources of the server 510. After operating the file resources, the corresponding file result data is generated and returned to the client 520.
[0091] For example, the server 510 receives a file processing request sent by the client 520 to delete the file A of the server 510, and performs a permission check. When the permission check of the file processing request passes, the file A of the server 510 is deleted, and the file result data is returned to the client 520. The file result data of the deleted file A of the server 510 is displayed on the browser page of the client 520.
[0092] For another example, the server 510 receives a file processing request sent by the client 520 to move the file A of the server 510 from location B to location C, and performs a permission check. When the permission check of the file processing request passes, the file A of the server 510 is moved from location B to location C, and the file result data is returned to the client 520. The browser page of the client 520 shows that the storage path of the file A of the server 510 has been changed to the file result data of location C.
[0093] In actual implementation, the data structure of the file result data generated by the server 510 may be a tree data structure.
[0094] In some embodiments, sending the request result data to the client 520 via the target interface includes:
[0095] The file result data based on the tree data structure is sent to the client 520 through the target interface.
[0096] Among them, the browser has an interface component for displaying a tree data structure (eg, the el-tree component of element UI).
[0097] In this embodiment, the browser page can display file result data based on a tree data structure. Through the hierarchical expression of the tree data structure, the data affiliation or branch logic of the file resources of the server 510 can be clearly and efficiently displayed, which facilitates quick search and operation and can effectively improve the access efficiency of the client 520 to the server 510.
[0098] In actual implementation, the server 510 may predefine the format of the tree data structure to facilitate the client 520 to display the file result data, thereby helping to improve the efficiency of the client 520 in displaying the tree data.
[0099] For example, the server 510 can define a file tree structure object FileNode (a tree structure object is the implementation of a tree data structure in a specific application): a string label (file / directory name), a string path (the absolute path of the file / directory), a Boolean isDirectory (whether it is a directory), and a collection children (recording all file / directory list objects FileNode at the next level of the label).
[0100] It is understandable that different tree structure object implementations can be designed according to specific page display requirements, and different tree data structure variants can be adapted by adjusting the generation rules of nodes, edges, and paths.
[0101] In other embodiments, generating request result data corresponding to the permission verification result may include:
[0102] When the permission check of the file processing request fails, prompt result data corresponding to the file processing request is generated.
[0103] It is understandable that the failure of the permission check of the file processing request indicates that the client 520 that sends the file processing request does not have the permission to request the server 510 to perform the file resource operation corresponding to the file processing request. At this time, prompt result data can be returned to the client 520 to prompt the client 520 that it does not have the corresponding file resource operation permission.
[0104] In this embodiment, the server 510 receives a file processing request from the client 520 through the target interface, and performs a permission check on the file processing request. When the permission check of the file processing request fails, the operation corresponding to the file processing request is not performed on the file resources of the server 510, and corresponding prompt result data is generated and returned to the client 520.
[0105] For example, the server 510 receives a file processing request sent by the client 520 to delete file A of the server 510, and performs a permission check. When the permission check of the file processing request fails, the prompt result data is returned to the client 520 to prompt the client 520 that the client 520 does not have the permission to delete file A.
[0106] For another example, the server 510 receives a file processing request sent by the client 520 to move the server 510's file A from location B to location C, and performs a permission check. When the permission check of the file processing request fails, the prompt result data is returned to the client 520 to prompt the client 520 that it does not have the permission to change the storage path of file A.
[0107] In some embodiments, in response to a file processing request, corresponding request result data is generated, including:
[0108] Determining a file scanning scope of the server 510 based on the file processing request;
[0109] The file resources within the file scanning range in the operation server 510 are generated to generate request result data.
[0110] In this embodiment, based on the file processing request, the file scanning range is determined, the file resources within the file scanning range are operated, and the request result data corresponding to the file processing request is generated. The range is first determined, and then the file resources are operated within a certain range. This can avoid excessive data volume and long feedback time.
[0111] For example, if the target resource requested by the file processing request is empty, the server 510 only returns the root directory list of its own file resources. If the file processing request corresponds to a specific file resource path and the resource path is determined to be the file scanning range, the server 510 can return the file and target list under the resource path.
[0112] In actual implementation, the file scanning scope of the server 510 may be determined after the server 510 performs permission verification on the file processing request and the permission verification passes, so as to improve the security of the file resources of the server 510.
[0113] It is understandable that the server 510 can implement non-blocking I / O (NIO) through multiplexing and other mechanisms, and cope with multiple concurrent scenarios through NIO, avoid blocking and waiting, and improve the system's throughput and resource utilization in high-concurrency scenarios.
[0114] In some embodiments, generating request result data includes:
[0115] Convert the file resource into a predefined file tree structure object and obtain the generated request result data;
[0116] The predefined file tree structure objects include: string labels, string paths, Boolean flags, and collection information.
[0117] In actual implementation, the server 510 can pre-define the format of the tree data structure, operate the file resources within the file scanning range of the server 510, convert the file resources into a pre-defined file tree structure object, and obtain the generated request result data. The pre-defined file tree structure object facilitates the client 520 to display the file result data, which helps to improve the client 520's 520 display efficiency of the tree data.
[0118] For example, the server 510 can define a file tree structure object FileNode (a tree structure object is the implementation of a tree data structure in a specific application): a string label label (file / directory name), a string path path (absolute path of the file / directory), a Boolean flag isDirectory (whether it is a directory), and collection information children (recording all file / directory list objects FileNode at the next level of label).
[0119] An embodiment of the present application also provides a file processing method, which is applied to a client 520, and the client 520 has a browser. The execution subject of the file processing method can be a functional module or functional entity in the client 520 that can implement the file processing method. The file processing method provided in the embodiment of the present application is explained below using the client 520 as an example of the execution subject.
[0120] It should be noted that the client 520 mentioned in the embodiment of the present application includes but is not limited to mobile phones, tablet computers, computers, cameras and wearable devices.
[0121] like Figure 2 As shown, the file processing method includes: step 210, step 220 and step 230.
[0122] Step 210 : In response to the input of the browser of the client 520 , generate a file processing request.
[0123] The file processing request is used to instruct to operate on the file resources of the server 510 .
[0124] In this step, the user's input in the browser is used to generate a file processing request, which is an instruction from the client 520 to the server 510 to move, edit, delete, read, write, etc. the file resources of the server 510.
[0125] The user input in the browser can be at least one of the following methods:
[0126] First, the input may be a touch operation, including but not limited to a click operation, a slide operation, and a press operation.
[0127] Secondly, the first input may be a physical button input. The client 520 is provided with a physical button to receive an operation of the user pressing the corresponding physical button.
[0128] Of course, in other embodiments, the input may also be in other forms, including but not limited to character input, etc., which can be determined according to actual needs and is not limited in this embodiment of the present application.
[0129] Step 220: Send a file processing request to the target interface of the server 510, so that the server 510 responds to the file processing request and generates corresponding request result data.
[0130] In this step, the client 520 sends a file processing request to the target interface of the server 510. After receiving the file processing request sent by the client 520, the server 510 parses the file processing request, determines the type of operation on the file resources proposed by the client 520, and performs corresponding operations on the file resources of the server 510 in response to the file processing request, generating request result data corresponding to the file processing request.
[0131] Step 230: Receive the request result data returned by the server 510 through the target interface, and display the request result data on the browser.
[0132] In this step, the server 510 returns the request result data to the client 520 through the target interface. The client 520 receives the returned request result data and displays the request result data on the browser page.
[0133] According to the file processing method provided in the embodiment of the present application, a file processing request is sent to the target interface of the server 510, the file resources of the server 510 are operated, and the returned request result data is received through the target interface, and the corresponding request result data is displayed on the browser page of the client 520. Visual browsing and interactive operations of the file resources of the server 510 are realized through the browser page, thereby reducing the complexity and cost of the system.
[0134] In some embodiments, the request result data is file result data or prompt result data; the browser has an interface component for displaying a tree data structure, and the browser is used to display the file result data based on the tree data structure.
[0135] The server 510 receives the file processing request from the client 520 through the target interface, and performs a permission check on the file processing request. When the permission check of the file processing request passes, the operation corresponding to the file processing request is performed on the file resources of the server 510. After operating the file resources, the corresponding file result data is generated and returned to the client 520; when the permission check of the file processing request fails, the operation corresponding to the file processing request is not performed on the file resources of the server 510, and the corresponding prompt result data is generated and returned to the client 520.
[0136] In actual execution, the data structure of the file result data generated by the server 510 may be a tree data structure, and the browser has an interface component for displaying the tree data structure (eg, the el-tree component of the element UI).
[0137] In this embodiment, the client 520 parses the file result data returned by the server 510, converts it into the data format required by the el-tree component, and displays the file result data based on the tree data structure on the browser page. Through the hierarchical expression of the tree data structure, the data subordination or branch logic of the file resources of the server 510 is clearly and efficiently displayed, which facilitates quick search and operation, and can effectively improve the access efficiency of the client 520 to the server 510.
[0138] In actual implementation, the server 510 may predefine the format of the tree data structure to facilitate the client 520 to display the file result data, thereby helping to improve the efficiency of the client 520 in displaying the tree data.
[0139] In some embodiments, the browser is configured to execute a lazy loading strategy for the request result data.
[0140] In this embodiment, the browser executes a lazy loading strategy, requesting the directory and files under the specified path each time, and delaying the loading of other resources in the page, which can reduce the initial network request and memory usage, and avoid a sharp increase in the performance pressure of the client 520 due to an excessive number of file resources on the server.
[0141] The file processing method of the embodiment of the present application can realize visual browsing and operation of the file resources of the server 510 on the browser. The server 510 can perform permission verification on the file processing request of the client 520 according to the permission level and customized requirements, intercept and block the request data that fails the verification, and avoid sensitive operations and data leakage. It can be implemented based on the existing Web application architecture and is easy to maintain and expand.
[0142] A specific embodiment is described below.
[0143] The design requirement is: the user can select the file to be uploaded by the server 510 on the browser page of the client 520, and send the path of the file to the server 510, and the server 510 will implement the upload operation of the file. The file can be a physical file of the server 510.
[0144] The server 510 is provided with a target interface / get_file_tree based on the HTTP protocol, and a corresponding interface request parameter path is configured. Path represents the absolute path of the target directory or file to be queried. If path is empty, the root directory is queried by default.
[0145] Among them, server 510 defines the file tree structure object FileNode: string label (file / directory name), string path (absolute path of file / directory), Boolean isDirectory (whether it is a directory), and collection children (records all file / directory list objects FileNode at the next level of label).
[0146] A file processing request is received through the target interface, the file path that needs to be uploaded is parsed, the local file resources of the server 510 are scanned through NIO technology in the server 510, the upload operation is performed according to the file path, the generated file result data is converted into a FileNode object, and returned to the client 520.
[0147] The browser of client 520 integrates the el-tree component of element UI, calls and parses the data returned by / get_file_tree (which can be in json format), converts it into the tree data required by the el-tree component, and displays the file result data based on the tree data structure on the browser page.
[0148] In actual implementation, the user can see the root directory of the server 510 file list displayed in a tree structure on the browser page, and then can select the target directory to be opened with the mouse, click the "Open" button or "double-click" to call / get_file_tree, and pass parameters to obtain the next level file list of the selected directory. Similarly, the browser page can simulate a file system UI operation similar to Windows to view and select the target file. Finally, after the user confirms the target file or folder, click the "Confirm" button to upload the file to the server 510, realizing the effect of the browser page dynamically operating the server 510 file resources.
[0149] The file processing method provided in the embodiments of the present application has at least one of the following technical effects:
[0150] Reduce workload without changing the existing architecture. Targeting the existing web application architecture, improve the operability of browser pages to server 510 resources without introducing other technical implementations.
[0151] High communication efficiency: through the NIO technology on the backend of the server 510 and the element UI and lazy loading strategy on the client 520, small amounts of data transmission and fast responses are achieved, reducing issues such as lag and waiting caused by data transmission.
[0152] Data security is controllable. Although the target interface setting exposes the server 510 file resources, the returned request result data is also sent from the customized target interface, which allows customized data interception and processing.
[0153] Easy to expand. To meet the needs of displaying and operating the file resources of the server 510 on the client 520, new parameters can be added based on the existing interface.
[0154] The file processing method provided in the embodiment of the present application can be executed by a file processing device. In the embodiment of the present application, the file processing device provided in the embodiment of the present application is described by taking the file processing method executed by the file processing device as an example.
[0155] The embodiment of the present application further provides a file processing device 300 , which is applied to a server 510 , and the server 510 is provided with a target interface.
[0156] like Figure 3 As shown, the file processing device 300 includes:
[0157] The first receiving module 310 is configured to receive a file processing request sent by the client 520 through a target interface. The file processing request is generated by the browser of the client 520 and is used to instruct an operation to be performed on a file resource of the server 510.
[0158] A first response module 320 is configured to generate corresponding request result data in response to a file processing request;
[0159] The first sending module 330 is configured to send the request result data to the client 520 via the target interface, so that the browser can display the request result data.
[0160] According to the file processing device 300 provided in the embodiment of the present application, a target interface is set on the server 510, a file processing request sent by the client 520 is received, the file resources of the server 510 are operated, and the request result data is returned to the client 520 through the target interface, and the corresponding request result data is displayed on the browser page of the client 520. Visual browsing and interactive operations of the file resources of the server 510 are realized through the browser page, thereby reducing the complexity and cost of the system.
[0161] In some embodiments, the first response module 320 is configured to generate corresponding request result data in response to a file processing request, including:
[0162] Perform permission verification on file processing requests;
[0163] Generate request result data corresponding to the permission verification result.
[0164] In some embodiments, the first response module 320 is configured to generate request result data corresponding to the permission verification result, including:
[0165] If the permission check of the file processing request passes, the file result data corresponding to the file processing request is generated;
[0166] Alternatively, when the permission check of the file processing request fails, prompt result data corresponding to the file processing request is generated.
[0167] In some embodiments, the first response module 320 is configured to send the request result data to the client 520 via the target interface, including:
[0168] The file result data based on the tree data structure is sent to the client 520 through the target interface, and the browser has an interface component for displaying the tree data structure.
[0169] In some embodiments, the first response module 320 is configured to generate corresponding request result data in response to a file processing request, including:
[0170] Determining a file scanning scope of the server 510 based on the file processing request;
[0171] The file resources within the file scanning range in the operation server 510 are generated to generate request result data.
[0172] In some embodiments, the first response module 320 is configured to generate corresponding request result data, including:
[0173] Convert the file resource into a predefined file tree structure object and obtain the generated request result data;
[0174] The predefined file tree structure objects include: string labels, string paths, Boolean flags, and collection information.
[0175] In some embodiments, the server 510 is provided with multiple target interfaces, each target interface being used to receive a file processing request of a corresponding request type.
[0176] The file processing device 300 provided in the embodiment of the present application can achieve the following Figure 1 To avoid repetition, the various processes implemented in the file processing method embodiment are not described here.
[0177] The embodiment of the present application further provides a file processing device 400 , which is applied to a client 520 .
[0178] like Figure 4 As shown, the file processing device 400 includes:
[0179] The second response module 410 is configured to generate a file processing request in response to an input from the browser of the client 520, where the file processing request is used to instruct an operation to be performed on a file resource of the server 510;
[0180] The second sending module 420 is configured to send a file processing request to a target interface of the server 510, so that the server 510 generates corresponding request result data in response to the file processing request;
[0181] The second receiving module 430 is configured to receive the request result data returned by the server 510 through the target interface, and display the request result data in the browser.
[0182] According to the file processing device 400 provided in the embodiment of the present application, a file processing request is sent to the target interface of the server 510, the file resources of the server 510 are operated, and the request result data returned is received through the target interface, and the corresponding request result data is displayed on the browser page of the client 520. Visual browsing and interactive operations of the file resources of the server 510 are realized through the browser page, thereby reducing the complexity and cost of the system.
[0183] In some embodiments, the request result data is file result data or prompt result data; the browser has an interface component for displaying a tree data structure, and the browser is used to display the file result data based on the tree data structure.
[0184] In some embodiments, the browser is configured to execute a lazy loading strategy for the request result data.
[0185] The file processing device 400 in the embodiments of the present application can be an electronic device or a component of an electronic device, such as an integrated circuit or chip. The electronic device can be a terminal or other device other than a terminal. For example, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, etc., and the embodiments of the present application do not specifically limit this.
[0186] The file processing device 400 in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0187] The file processing device 400 provided in the embodiment of the present application can achieve the following Figure 2 To avoid repetition, the various processes implemented in the file processing method embodiment are not described here.
[0188] The embodiment of the present application further provides a server 510 , which is provided with a target interface, and is used to execute the file processing method applied to the server 510 as described above.
[0189] According to the server 510 provided in the embodiment of the present application, a target interface is set on the server 510, a file processing request sent by the client 520 is received, the file resources of the server 510 are operated, and the request result data is returned to the client 520 through the target interface, and the corresponding request result data is displayed on the browser page of the client 520. Visual browsing and interactive operations of the file resources of the server 510 are realized through the browser page, thereby reducing the complexity and cost of the system.
[0190] The embodiment of the present application further provides a client 520 , which has a browser and is used to execute the file processing method applied to the client 520 as described above.
[0191] According to the client 520 provided in the embodiment of the present application, a file processing request is sent to the target interface of the server 510, the file resources of the server 510 are operated, and the returned request result data is received through the target interface, and the corresponding request result data is displayed on the browser page of the client 520. Visual browsing and interactive operations of the file resources of the server 510 are realized through the browser page, thereby reducing the complexity and cost of the system.
[0192] like Figure 5 As shown, in a system including a server 510 and a client 520, communication can be established between the server 510 and the client 520 through HTTP protocol, TCP protocol, etc. to realize information interaction between the server 510 and the client 520. The target interface set by the server 510 can be an interface based on the HTTP protocol.
[0193] like Figure 6 As shown, the client 520 generates a file processing request instructing to operate the file resources of the server 510 in response to the user's click operation or instruction input on the browser page, and sends the file processing request to the target interface based on the HTTP protocol.
[0194] The server 510 receives the file processing request through the target interface, performs permission verification, responds to the file processing request, operates the file resources, generates corresponding request result data, and returns the request result data to the client 520 through the target interface based on the HTTP protocol.
[0195] After receiving the request result data, the client 520 displays the request result data on the browser page.
[0196] In this embodiment, the design of the target interface on the server 510 overcomes the defect that the browser page cannot operate the file resources of the server 510. Visual browsing and interactive operations of the file resources of the server 510 can be achieved through the browser page, reducing the complexity and cost of the system.
[0197] In some embodiments, as Figure 7 As shown, an embodiment of the present application also provides an electronic device 700, including a processor 701, a memory 702, and a computer program stored in the memory 702 and executable on the processor 701. When the program is executed by the processor 701, each process of the above-mentioned file processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0198] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0199] An embodiment of the present application also provides a non-transitory computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the various processes of the above-mentioned file processing method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0200] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0201] An embodiment of the present application also provides a computer program product, including a computer program, which implements the above-mentioned file processing method when executed by a processor.
[0202] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0203] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned file processing method embodiment and achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0204] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0205] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element. In addition, it should be noted that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in the opposite order according to the functions involved. For example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0206] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), including a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0207] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.
[0208] Throughout this specification, reference to terms such as "one embodiment," "some embodiments," "illustrative embodiments," "examples," "specific examples," or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
[0209] Although the embodiments of the present application have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions, and variations may be made to the embodiments without departing from the principles and intent of the present application, and that the scope of the present application is defined by the claims and their equivalents.
Claims
1. A file processing method, characterized in that: The method is applied to a server, the server being provided with a target interface, and the method comprises: receiving, through the target interface, a file processing request sent by a client, wherein the file processing request is generated by a browser of the client and is used to instruct an operation to be performed on a file resource of the server; In response to the file processing request, generating corresponding request result data; The request result data is sent to the client through the target interface so that the browser can display the request result data.
2. The file processing method according to claim 1, wherein: The step of generating corresponding request result data in response to the file processing request includes: Performing permission verification on the file processing request; Generate the request result data corresponding to the permission verification result.
3. The file processing method according to claim 1 or 2, characterized in that: The step of generating corresponding request result data in response to the file processing request includes: Determining a file scanning scope of the server based on the file processing request; The file resources within the file scanning range in the server are operated to generate the request result data.
4. The file processing method according to claim 3, wherein: Generating the request result data includes: Convert the file resource into a predefined file tree structure object to obtain generated request result data; The predefined file tree structure objects include: string labels, string paths, Boolean flags, and collection information.
5. The file processing method according to claim 1 or 2, characterized in that: The server is provided with a plurality of target interfaces, each of which is used to receive the file processing request of a corresponding request type.
6. A file processing method, characterized in that: The method is applied to a client, and includes: In response to the input of the browser of the client, a file processing request is generated, wherein the file processing request is used to instruct to operate the file resource of the server; Sending the file processing request to the target interface of the server, so that the server responds to the file processing request and generates corresponding request result data; Receive the request result data returned by the server through the target interface, and display the request result data on the browser.
7. The file processing method according to claim 6, characterized in that: The request result data is file result data or prompt result data; The browser has an interface component for displaying a tree data structure, and the browser is used to display the file result data based on the tree data structure; The browser is used to execute a lazy loading strategy for the request result data.
8. A server, characterized in that: The server is provided with a target interface, and the server is used to execute the file processing method according to any one of claims 1 to 5.
9. A client, characterized in that: The client has a browser, and is used to execute the file processing method according to claim 6 or 7.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the file processing method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Data resource security control method in thin client mode
CN103441986A
Server and client interaction method and apparatus, and electronic device
CN119645993A
Cited By
Lightweight security protection method for file permission access in localized scene
CN121808766A