CN115421730A - Method for dynamically loading unlimited-format static resource file in page - Google Patents

Method for dynamically loading unlimited-format static resource file in page Download PDF

Info

Publication number
CN115421730A
CN115421730A CN202211173772.6A CN202211173772A CN115421730A CN 115421730 A CN115421730 A CN 115421730A CN 202211173772 A CN202211173772 A CN 202211173772A CN 115421730 A CN115421730 A CN 115421730A
Authority
CN
China
Prior art keywords
static resource
file
page
directory
files
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211173772.6A
Other languages
Chinese (zh)
Inventor
杜东威
王青月
于宙宙
武育竹
李晨光
沈智峰
孙宇洋
牛梦丽
牛旭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jiangsu Shenrui Huiyang Energy Technology Co ltd
Original Assignee
Jiangsu Shenrui Huiyang Energy Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jiangsu Shenrui Huiyang Energy Technology Co ltd filed Critical Jiangsu Shenrui Huiyang Energy Technology Co ltd
Priority to CN202211173772.6A priority Critical patent/CN115421730A/en
Publication of CN115421730A publication Critical patent/CN115421730A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Mining & Analysis (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a method for dynamically loading unlimited format static resource files in a page, which comprises the following steps: firstly, installing, deploying and configuring Nginx proxy service; (2) Mapping the absolute path of the static resource file to a specified folder directory; (3) Copying the static resource file with unlimited format to the path mapping directory in the step (2); (4) The single page application configuration dynamically accesses static resource files of different formats. The method can completely replace the current scheme of storing the compiling program package in the static resource, and update and replace the resource file to be replaced at any time, thereby avoiding a series of complicated operations such as iteratively uploading the compiling version to the server after the source program is replaced, reducing the time, space and labor cost, and even supporting the batch offline quick access response mechanism of the static file.

Description

Method for dynamically loading unlimited-format static resource file in page
Technical Field
The invention relates to the field of computer web systems, in particular to a method for dynamically loading unlimited-format static resource files in a page.
Background
With the rapid development of modern network communication, dynamic web system page rendering is indispensable. Friendly pages are in an interface form by means of static Resource pictures (in the formats of jpg/png/svg/gif/ttf and the like) with different formats, the static resources are almost stored in system source code static Resource Assets and Resource directories, and online Resource files provided by the extranet service are loaded under the condition that the service network support of the system is deployed and extranet information is allowed to be accessed.
However, with continuous change and iteration of service requirements, the source code static resource files gradually become too bloated and large, and each time iterative upgrade, compilation and packaging of system products wastes much energy and time cost, so that the later operation and maintenance cost is high, the instantaneity is low, the maintainability is low, and even the change and dynamic off-line access to the source code static resource files cannot be performed at any time. In view of the above, there is a need for a method for dynamically loading unlimited format static resource files in a page to solve the above-mentioned problems.
Disclosure of Invention
The invention aims to: the invention aims to provide a method for dynamically loading unlimited-format static resource files in a page, aiming at the defects of the prior art, so that the compiling, packaging and releasing processes of a source code program are reduced, the occupied space of the running and compiling program is saved, and the execution efficiency of a running environment is improved.
The technical scheme is as follows: the invention discloses a method for dynamically loading unlimited format static resource files in a page, which comprises the following steps:
(1) Firstly, installing, deploying and configuring Nginx proxy service;
(2) Mapping the absolute path of the static resource file to a specified folder directory;
(3) Copying the static resource file with unlimited format to the path mapping directory in the step (2);
(4) The single page application configuration dynamically accesses static resource files of different formats.
A further preferable technical scheme of the present invention is that, in the step (1), the installing and deploying configuration of the Nginx proxy service is divided into windows and linux system versions, an official network address is searched to download the corresponding server system version, the server system version is installed according to the operation steps, a host address IP and a PORT number PORT are configured, and finally, the Nginx proxy server is started.
Preferably, the specific method under the static resource file absolute path mapping specified folder directory in step (2) is as follows:
and configuring a location block according to the Nginx conventional request level, wherein the location block specifies a prefix of the comparison between the file-api and the URI from the request, adds the URI to a path specified in the root instruction according to the matching request, and creates a conventional directory and a specific directory for storing static resource files with different formats under the setting of an absolute resource directory by the server.
Preferably, the specific method under the static resource file copy path mapping directory in the unlimited format in step (3) is as follows:
and migrating the local static resource file to the remote proxy server file path mapping absolute directory by using a file transfer tool or a cmd command line.
Preferably, when the local static resource file is migrated to the remote proxy server file path mapping absolute directory, the number of the copied files is single or multiple, and the copied files are stored according to file type storage, module storage or slicing service type storage.
Preferably, the method for dynamically accessing static resource files of different formats by single-page application configuration in step (4) includes:
the method comprises the steps of utilizing a proxy forwarding characteristic principle of a scaffold tool to configure a key point execution option in a single-page component to configure a static resource file mapping path Location, starting single-page service around the scaffold tool under a Node operation environment, inputting a single-page access address into a browser, and dynamically loading a static resource single file, a plurality of files or a batch of slicing service files of a corresponding directory of an access server in a single page.
Has the advantages that: (1) Compared with the prior art, the method for dynamically loading unlimited format static resource files in the page mainly depends on a Nginx proxy server, and a file root directory is appointed by a configuration option location matching server.
(2) The invention can dynamically load the remote server static resource directory specified file and the subdirectory file, and the file type is not limited; meanwhile, other directories can be changed, added, deleted or even migrated at any time, and the directory hierarchy is not constrained, namely only the absolute address of the mapping root directory of the file is stored; the source code packing and issuing server and even the server are not recompiled and restarted due to the change of the static resources, so that the expense can be effectively reduced by avoiding the cost of project operation and maintenance.
(3) The invention can create the static resource catalog corresponding to the multi-project multi-module catalog according to the specific requirements of different projects, can reduce the size of resource files occupied by the local source code program space, enhance the source code compiling and executing efficiency, improve the program executing efficiency and shorten the time for uploading the compiled packages to the server. Multiple projects can share the same static resource file, the file format is not limited to be changed, the space size of the disk occupancy rate can be reduced, and the resource public utilization rate is improved.
Drawings
FIG. 1 is a flowchart illustrating the operation of a method for dynamically loading an unlimited format static resource file in a page according to the present invention.
Detailed Description
The technical solution of the present invention is described in detail below with reference to the accompanying drawings, but the scope of the present invention is not limited to the embodiments.
Example (b): a method for dynamically loading static resource files with unlimited formats in a page includes device type pictures, device state pictures and device entity pictures.
The specific steps are shown in fig. 1, and comprise:
(1) Firstly, installing, deploying and configuring Nginx proxy service; the installing and deploying configuration of the Nginx proxy service is divided into windows and linux system versions, an official network address is searched for downloading the corresponding server system version, the server system version is installed according to the operation steps, a host address IP and a PORT number PORT are configured, and finally the Nginx proxy server is started.
(2) Mapping the absolute path of the static resource file to a specified folder directory:
the location block is configured according to the Nginx conventional request level, and the detailed matching rule is as follows:
Figure BDA0003863294530000031
Figure BDA0003863294530000041
the location block specifies the prefix "", where the file-api compares against the URI from the request, and for matching requests, the URI will be added to the path specified in the root instruction, i.e. the path of the request file is formed in the server static resource file absolute path directory for/xxx/xxx/nginx/html/static rootfile, under which the regular directory for storing static resource files of different formats can be created and the specific resource directory (e.g. slicing services WMTS, WMS) can be created.
(3) Copying the static resource file with unlimited format to the path mapping directory in the step (2):
and migrating the local static resource file to a remote proxy server file path mapping absolute static RootFile directory by using a file transfer tool or a cmd command line. The number of the copied files is single or multiple, and the copied files are stored according to file types, module storage or slicing service types.
(4) The single page application configuration dynamically accesses static resource files of different formats:
in a single-page component, by using a proxy forwarding characteristic principle of a scaffold tool (such as conventional vite and webpack), a key point execution option is configured to configure a static resource file mapping path Location, a single-page service is started around the scaffold tool under a Node operating environment, a single-page access address is input into a browser, and a static resource single file, multiple files or a batch of slicing service files for accessing a corresponding directory of a server are dynamically loaded in the single page. And inputting a single-page access address in the browser to see whether the static resource file under the Nginx mapping path of the remote proxy server is successfully accessed. The technical reliability and practicability of all static resource files with unlimited formats for dynamic loading of the page are verified, and the decoupling local static resource directory is completely separated from a subsequent systematic web architecture platform.
When a Web user inputs a single-page webpage address in a browser, an http protocol is automatically sent to request a static resource file, a gateway automatically resolves a domain name server IP, maps an appointed absolute path directory for storing static resources according to a path matching rule, if the appointed static resource file is successfully accessed, a static resource file stream is returned and a status code of 200 is returned, otherwise, abnormal access failure of the status code 404 is displayed.
As noted above, while the present invention has been shown and described with reference to certain preferred embodiments, it is not to be construed as limited thereto. Various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (6)

1. A method for dynamically loading unlimited format static resource files in a page is characterized by comprising the following steps:
(1) Firstly, installing, deploying and configuring Nginx proxy service;
(2) Mapping the absolute path of the static resource file to a specified folder directory;
(3) Copying the static resource file with unlimited format to the path mapping directory in the step (2);
(4) The single page application configuration dynamically accesses static resource files of different formats.
2. The method for dynamically loading unlimited format static resource files in the page according to claim 1, wherein in the step (1), the installation and deployment configuration of the Nginx proxy service is divided into windows and linux system versions, an official network address is searched to download the corresponding server system version, the server system version is installed according to the operation steps, a host address IP and a PORT number are configured, and finally, the Nginx proxy server is started.
3. The method for dynamically loading unlimited format static resource files in a page according to claim 1, wherein the specific method under the static resource file absolute path mapping specified folder directory in the step (2) is as follows:
and configuring a location block according to the Nginx conventional request level, wherein the location block specifies a prefix of the relative ratio of file-api and URI from the request, adds the URI to a path specified in a root instruction according to the matching request, and creates a conventional directory and a specific directory for storing static resource files with different formats under the condition that the server sets an absolute resource directory.
4. The method for dynamically loading unlimited format static resource files in a page according to claim 1, wherein the specific method in the unlimited format static resource file copy path mapping directory in the step (3) is as follows:
and migrating the local static resource file to the remote proxy server file path mapping absolute directory by using a file transfer tool or a cmd command line.
5. The method for dynamically loading unlimited format static resource files in a page according to claim 4, wherein when a local static resource file is migrated to a remote proxy server file path mapping absolute directory, the number of the copied files is single or multiple, and the copied files are stored according to file type storage, module storage or slicing service type storage.
6. The method for dynamically loading static resource files with unlimited formats in a page according to claim 1, wherein the method for dynamically accessing static resource files with different formats by single-page application configuration in step (4) comprises the following steps:
the method comprises the steps of configuring a key point execution option to configure a mapping path Location of a static resource file by utilizing a proxy forwarding characteristic principle of a scaffold tool in a single-page component, starting a single-page service around the scaffold tool based on a Node operating environment, inputting a single-page access address into a browser, and dynamically loading a static resource single file, multiple files or a batch slicing service file for accessing a corresponding directory of a server in the single page.
CN202211173772.6A 2022-09-26 2022-09-26 Method for dynamically loading unlimited-format static resource file in page Pending CN115421730A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211173772.6A CN115421730A (en) 2022-09-26 2022-09-26 Method for dynamically loading unlimited-format static resource file in page

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211173772.6A CN115421730A (en) 2022-09-26 2022-09-26 Method for dynamically loading unlimited-format static resource file in page

Publications (1)

Publication Number Publication Date
CN115421730A true CN115421730A (en) 2022-12-02

Family

ID=84204525

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211173772.6A Pending CN115421730A (en) 2022-09-26 2022-09-26 Method for dynamically loading unlimited-format static resource file in page

Country Status (1)

Country Link
CN (1) CN115421730A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117910438A (en) * 2024-03-13 2024-04-19 江苏中威科技软件***有限公司 Dynamic format file DLF generation device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117910438A (en) * 2024-03-13 2024-04-19 江苏中威科技软件***有限公司 Dynamic format file DLF generation device

Similar Documents

Publication Publication Date Title
CN107515776B (en) Method for upgrading service continuously, node to be upgraded and readable storage medium
EP2021937B1 (en) Techniques to perform gradual upgrades
CN107577475B (en) Software package management method and system of data center cluster system
US8645672B2 (en) Configuring a computer system for a software package installation
KR100761551B1 (en) A method, a controller, an arrangement and a computer program for managing a configuration of clustered computers
JP4549715B2 (en) Peripheral device driver maintenance scheme for networked peripheral device clients
JP4936629B2 (en) Network-based software extensions
CN1266597C (en) System for mounting and starting network application program
US8346886B2 (en) System, method, and medium for configuring client computers to operate disconnected from a server computer while using a master instance of the operating system
CN107368331B (en) Configuration file updating method and device for application program
US20030195951A1 (en) Method and system to dynamically detect, download and install drivers from an online service
CN105765526A (en) Bootstrapping from a remote disk image via a network
US20040221146A1 (en) Build time dynamic installation of drivers on cloned systems
CN102455915A (en) Method for automatically configuring distributed system, and server
CN107797767A (en) One kind is based on container technique deployment distributed memory system and its storage method
CN111538625B (en) Ambari cluster deployment and data backup method based on Docker technology and electronic equipment
CN111399855B (en) Automatic application instance publishing method based on container technology
CN109634840A (en) Method for testing software, device, equipment and storage medium
CN115421730A (en) Method for dynamically loading unlimited-format static resource file in page
CN102355499A (en) Cloud computing system
CN104360839A (en) Method for automatically migrating LINUX system to WINDOWS system
CN102567050A (en) Method and device for remote deployment of project of B/S (browser/server) system
CN117707543A (en) Application installation package manufacturing and installation method, computing device and storage medium
JP2008090578A (en) Application performance system, computer, and application performance method for application performance system and program
CN116601605A (en) Declaratively provisioning resources on a cloud platform

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination