CN103139298B - A method and apparatus for data transmission network - Google Patents

A method and apparatus for data transmission network Download PDF

Info

Publication number
CN103139298B
CN103139298B CN 201310040161 CN201310040161A CN103139298B CN 103139298 B CN103139298 B CN 103139298B CN 201310040161 CN201310040161 CN 201310040161 CN 201310040161 A CN201310040161 A CN 201310040161A CN 103139298 B CN103139298 B CN 103139298B
Authority
CN
Grant status
Grant
Patent type
Prior art keywords
file
css
compressed
javascript
terminal
Prior art date
Application number
CN 201310040161
Other languages
Chinese (zh)
Other versions
CN103139298A (en )
Inventor
赵宏波
Original Assignee
北京京东世纪贸易有限公司
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
Grant date

Links

Abstract

本发明提供一种传输网络数据的方法和装置,能够提高页面从开发到测试、修改直至上线运行中的更新的效率,并且减小页面的出错率。 The present invention provides a network data transmission method and apparatus, the error rate can be improved page from development to testing, on-line modification efficiency until the update operation, and to reduce the page. 本发明的传输网络数据的方法包括:服务器响应于终端的访问网络地址的请求,向所述终端发送网页源代码,所述网页源代码中包含用于指定javascript文件和/或层叠样式表(CSS)文件的指令;服务器响应于所述终端根据所述指令生成的请求信息,将压缩文件提供给所述终端,所述压缩文件中包含有所述指令指定的javascript文件和/或CSS文件。 Network data transmission method of the present invention comprises: a server in response to a request to access the network address of the terminal, and transmits to the terminal page source code, the source code contains the page for specifying a javascript file and / or Cascading Style Sheet (CSS ) instruction file; a server terminal in response to the request according to the instruction information generated by the compressed file to the terminal, the compressed javascript file and / or CSS file contains the file specified by the instruction.

Description

_种传输网络数据的方法和装置 Method and apparatus for network data transmission species _

技术领域 FIELD

[0001] 本发明涉及一种传输网络数据的方法和装置。 [0001] The present invention relates to a network data transmission method and apparatus.

背景技术 Background technique

[0002] 在基于B/S架构的软件开发过程中,经常需要用到大量的javascript框架、控件、 自定义的javascript代码和大量的层叠样式表文件(CSS),为了提高终端即浏览器的下载速度,在页面开发过程中,开发人员将网页中用到的多个javascript和/或css文件通过第三方工具压缩合并为一个压缩文件并且对应于该页面保存下来,这样页面上线之后,浏览器在解析网页源代码并且发送请求时,服务器获取上述压缩文件然后提供给浏览器。 [0002] In the process of software development based on B / S structure, it is often requires a great deal of javascript framework, control, custom javascript code and a large number of cascading style sheet file (the CSS), in order to improve the terminal to download the browser i.e. after the plurality of javascript and / or velocity css files, the page development process, the developer used in the web by the third-party tools combined into a compressed file compressed and saved corresponds to the page, so the page line browser parsing the page source and transmits a request, the server then acquires the compressed file to the browser.

[0003] 如果网页内容被修改并且涉及了用到的javascript和/或css文件,则开发人员重新制作上述的压缩文件,并且相应修改页面中的其他内容例如压缩文件的文件名。 [0003] If the content has been modified and involve javascript and / or css files used, the developer to re-create the above file compression, and accordingly modify other content pages such as the file name of the compressed file.

[0004] 在页面从开发到测试、修改直至上线运行中的更新,页面内容通常要修改多次,按照现有的上述做法,需开发人员多次制作压缩文件,导致效率低下以及出错率增加。 [0004] In the page from development to testing, modification updating until the on-line operation, to modify the page content is typically several times, according to the conventional practice, the developer needs to create multiple compressed file, and inefficient to increase the error rate.

发明内容 SUMMARY

[0005] 有鉴于此,本发明提供一种传输网络数据的方法和装置,能够提高页面从开发到测试、修改直至上线运行中的更新的效率,并且减小页面的出错率。 [0005] Accordingly, the present invention provides a network data transmission method and apparatus, the error rate can be improved page from development to testing, on-line modification efficiency until the update operation, and to reduce the page.

[0006] 为实现上述目的,根据本发明的一个方面,提供了一种传输网络数据的方法。 [0006] To achieve the above object, according to one aspect of the invention, there is provided a method of data transmission network.

[0007] 本发明的传输网络数据的方法包括:服务器响应于终端的访问网络地址的请求, 向所述终端发送网页源代码,所述网页源代码中包含用于指定javascript文件和层叠样式表(CSS)文件的指令,所述指令包括所述javascript文件和CSS文件的文件路径;所述网页是页面开发过程中的网页;服务器响应于所述终端根据所述指令生成的请求信息,从文件系统中读取所述javascript文件和CSS文件,然后将压缩文件提供给所述终端,所述压缩文件中包含有所述指令指定的javascript文件和CSS文件。 [0007] network data transmission method of the present invention comprises: a server in response to a request to access the network address of the terminal, and transmits to the terminal page source code, the source code contains the page for specifying a javascript file and Cascading Style Sheets ( command CSS) file, the instructions of the file path of the file and a CSS file javascript; the web is a web page development process; a server in response to the request information terminal according to the instructions generated from the file system the read javascript file and a CSS file, the compressed file is then provided to the terminal, the compressed javascript file and a CSS file contains the file specified by the instruction.

[0008] 可选地,压缩得到所述压缩文件的步骤之后,还包括:设置有效时长;从所述压缩文件被保存在分布式缓存中起经过所述有效时长后,将所述压缩文件从所述分布式缓存中删除。 After [0008] Optionally, the step of compressing the compressed file obtained, further comprising: setting a valid duration; from the compressed file is stored in a distributed cache since the effective length of the elapsed time, from the compressed file the distributed cache deleted.

[0009]可选地,压缩得到所述压缩文件的步骤包括:将从文件系统中获取的所述指令指定的javascript文件和CSS文件进行压缩处理,并且根据获取的javascript文件和css文件的文件名得到唯一对应于获取的javascript文件和CSS文件的字段,将该字段作为所述压缩处理得到的压缩文件的文件名。 [0009] Alternatively, the compression of the resulting compressed file comprises: the instruction acquired from the file system designated javascript file and a CSS file compression process, and javascript file and file name as the acquired file css the only field obtained javascript file and a CSS file corresponding to the acquisition of this field as the file name of the compressed file compression process obtained.

[0010]根据本发明的另一方面,提供了一种传输网络数据的装置。 [0010] According to another aspect of the present invention, there is provided an apparatus for data transmission network.

[0011]本发明的传输网络数据的装置设置在服务器中,该装置包括:第一接收模块,用于接收终端的访问网络地址的请求;第一发送模块,用于向所述终端发送网页源代码,所述网页源代码中包含用于指定javascript文件和层叠样式表(CSS)文件的指令,所述指令包括所述javascript文件和CSS文件的文件路径;所述网页是页面开发过程中的网页;第二接收模块,用于接收所述终端根据所述指令生成的请求信息;第二发送模块,用于从文件系统中读取所述javascript文件和CSS文件,然后将压缩文件提供给所述终端,所述压缩文件中包含有所述指令指定的javascript文件和CSS文件。 [0011] In the server, the apparatus comprising means arranged data transmission network of the present invention: a first receiving module, configured to receive a request to access the network address of the terminal; a first sending module, configured to send to the source terminal webpage codes, the web page source code containing instructions for specifying a javascript file and Cascading style Sheets (CSS) files, the instructions including the file path javascript file and a CSS file; the web is a web page development process ; a second receiving module configured to receive the request information generated by the terminal according to the instruction; second transmitting means for reading the javascript file and a CSS file from the file system, and then the compressed file to the terminal, the compressed file contains the instructions specified javascript file and a CSS file.

[0012] 可选地,所述第二发送模块还用于:设置有效时长;从所述压缩文件被保存在分布式缓存中起经过所述有效时长后,将所述压缩文件从所述分布式缓存中删除。 [0012] Alternatively, the second sending module is further configured to: set the valid duration; from the compressed file is stored after the date of the effective length of elapsed time, the compressed file in a distributed cache distributed from the caching deleted.

[0013]可选地,所述第二发送模块还用于:将从文件系统中获取的所述指令指定的javascript文件和CSS文件进行压缩处理,并且根据获取的javascript文件和CSS文件的文件名得到唯一对应于获取的javascript文件和CSS文件的字段,将该字段作为所述压缩处理得到的压缩文件的文件名。 [0013] Alternatively, the second sending module is further configured to: the instruction acquired from the file system designated javascript file and a CSS file compression process, and according to the file name acquired javascript files and CSS files the only field obtained javascript file and a CSS file corresponding to the acquisition of this field as the file name of the compressed file compression process obtained.

[0014]根据本发明的技术方案,服务器响应于终端的访问网络地址的请求,向终端发送网页源代码,该网页源代码中包含用于指定javascript文件和层叠样式表(CSS)文件的指令;然后服务器响应于该终端根据上述指令生成的请求彳目息,将压缩文件提供给该终端,该压缩文件中包含有上述指令指定的javascript文件和CSS文件,从而在网页中事先指定要提供的javascript文件和CSS文件,无需网页开发人员手动制作压缩文件,而是在网页被浏览时临时由服务器制作压缩文件,并且在修改页面、改变要提供的j avascript文件和CSS文件的情况下,只需修改网页代码,仍无需网页开发人员手动制作压缩文件,提高了网页开发、修改和测试的效率;并且减小了人工参与的程度,于是减小了页面的出错率。 [0014] According to the present invention, the server response to a request to access the network address of the terminal, the terminal transmits page source code, the instruction specifies a javascript file and Cascading Style Sheets (CSS) file containing the source code of the Web page; the server then in response to the terminal at the request of the left foot mesh information of the command generated, the compressed file to the terminal, the compressed file contains the command specified javascript file and a CSS file, and thus pre-specified javascript to be provided in the page files and CSS files without web developers to make the compressed file manually, but temporary zip file from the server made when the page was viewed, and in the case of modified pages, changing j avascript files and CSS files to be provided, simply modify the web page code, web developers still do not need to manually make compressed files, improved web development, modification and testing efficiency; and reduce the degree of human intervention, thus reducing the error rate of the page. 并且根据本发明实施例的技术方案,优先从读写速度较快的缓存中读取现成的压缩文件,如果没有该压缩文件再临时读取javascript文件和CSS文件并压缩得到压缩文件,并且将得到的压缩文件保存到缓存中,这样,只有当页面被第一次浏览时需要临时生成压缩文件,使页面的呈现速度受到影响以外,页面被再次浏览时因为缓存中已经保存了压缩文件所以呈现速度较快,提高了页面上线运行的效率。 According to the embodiment and the embodiment of the present invention, the priority is read from the compressed file ready faster read and write cache, if not read the temporary file and then compressed javascript file and a CSS file and the compressed file is compressed, and the resulting save the compressed file into the cache, so that only when the page is first necessary to temporarily generate a compressed file browser, the page rendering speed is affected outside the browser when the page is saved again because the cache has been so compressed file rendering speed faster, improve the efficiency of the line to run the page.

附图说明 BRIEF DESCRIPTION

[0015]附图用于更好地理解本发明,不构成对本发明的不当限定。 [0015] The accompanying drawings for a better understanding of the present invention, without unduly limiting the present invention. 其中: among them:

[0016]图1是根据本发明实施例的传输网络数据的方法的基本步骤的示意图; [0016] FIG. 1 is a diagram showing the basic steps of the method of the embodiment of a data transmission network of the present invention;

[0017]图2是根据本发明实施例的传输网络数据的装置的示意图。 [0017] FIG. 2 is a schematic diagram of a data transmission network apparatus embodiment in accordance with the embodiment of the invention.

具体实施方式 detailed description

[0018]以下结合附图对本发明的示范性实施例做出说明,其中包括本发明实施例的各种细节以助于理解,应当将它们认为仅仅是示范性的。 [0018] DESCRIPTION OF THE DRAWINGS made below of exemplary embodiments of the present invention, including various details of the embodiments to assist in understanding the present invention, they should be regarded as merely exemplary. 因此,本领域普通技术人员应当认识到,可以对这里描述的实施例做出各种改变和修改,而不会背离本发明的范围和精神。 Accordingly, those of ordinary skill in the art of the present embodiment will be appreciated that embodiments described herein may make various changes and modifications without departing from the scope and spirit of the invention. 同样,为了清楚和简明,以下的描述中省略了对公知功能和结构的描述。 Also, for clarity and conciseness, the following description is omitted the description of known functions and Structure. ^0191图1是根据本发明实施例的传输网络数据的方法的基本步骤的示意图。 0191 ^ 1 is a schematic of the basic steps of a method for transmitting network data according to the embodiment of the present invention. 如图1所示,本发明实施例的传输网络数据的方法主要包括如下的步骤s 11至步骤s 14。 1, the network data transmission method of an embodiment of the present invention mainly comprises the steps of step s 11 to s 14.

[0020]步骤S11:终端向服务器发送访问网络地址的请求。 [0020] Step S11: the network address of the access terminal sends a request to the server.

[0021]步骤S12:服务器向终端发送网页源代码。 [0021] Step S12: The server sends to the terminal the page source. 在本步骤中,作为向步骤S11中的请求的响应,服务器将网页源代码发送给终端。 In this step, as a response to the request in step S11, the web server source code to the terminal. 网页源代码中包含用于指定javascript文件和/或CSS文件的指令。 Page source code containing instructions for specifying a javascript file and / or a CSS file.

[0022] 步骤S13:终端解析网页源代码并且向服务器发送请求信息。 [0022] Step S13: The terminal parses the page source and the transmission request information to the server. 本步骤中,终端解析接收到的网页源代码,在解析到步骤S12中所述的指令后,根据该指令生成请求信息以请求获得相应的javascript文件和/或CSS文件。 In this step, the terminal parses the received web page source code, in S12 after the instruction to the analysis step, according to the instruction generation request information corresponding to request a javascript file and / or a CSS file.

[0023] 步骤S14:服务器将压缩文件提供给终端。 [0023] Step S14: The compressed file server to the terminal. 在本步骤中,作为向步骤S13中的请求信息的响应,服务器有两种方式向终端提供压缩文件。 In this step, as a response to the request information in step S13, the server there are two ways to provide the compressed file to the terminal. 如果服务器的分布式缓存中已经有相应的压缩文件,则直接将该压缩文件发送给终端;否则从文件系统中读出终端所请求的、实际上也是步骤S12中的指令所指定的各个javascript文件和/或CSS文件,然后将这些文件压缩,得到上述的相应的压缩文件,再将该压缩文件发送给终端。 If the distributed cache server has the appropriate compressed file, the compressed file directly to the transmitting terminal; otherwise, reading out respective javascript file requested by the terminal, the step S12 is actually specified by the instruction from the file system and / or a CSS file, and these files are compressed to give the above respective compressed files, and then transmits the compressed file to the terminal.

[0024] 从上述步骤可以看出,在网页中事先指定要提供的javascript文件和/或CSS文件,就无需网页开发人员手动制作压缩文件,而是在网页被浏览时临时由服务器制作压缩文件,并且在修改页面、改变要提供的javascript文件和/或CSS文件的情况下,只需修改网页代码,仍无需网页开发人员手动制作压缩文件,提高了网页开发、修改和测试的效率;并且减小了人工参与的程度,于是减小了页面的出错率。 [0024] As can be seen from the above steps, specified in advance javascript files and / or CSS file to be provided in a web page, web developers do not need to manually make a compressed file, the compressed file from the server but temporary production when the page was viewed, and in the case of modifying the page, change the javascript files and / or CSS file to be provided, simply modify the page code, web developers still do not need to manually make compressed files, improved web development, modification and testing efficiency; and reduce the degree of human intervention, thus reducing the error rate of the page.

[0025] 而且从上述步骤中还可以看出,由于是在浏览过程中临时制作压缩文件,所以对于浏览时的页面在终端的呈现速度有一定的影响,所以在步骤S14中,优先从读写速度较快的缓存中读取现成的压缩文件,如果没有该压缩文件再临时读取javascript文件和/或CSS 文件并压缩得到压缩文件,并且将得到的压缩文件保存到缓存中。 [0025] and can also be seen from the above step, since the production is temporary compression during browsing files, so the page when browsing to a certain extent in the presentation speed of the terminal, so in step S14, the priority from the reader faster cache read existing compressed file, the compressed file and then if there is no temporary files read javascript and / or CSS files get compressed and compressed file, and save the resulting compressed file into the cache. 这样,只有当页面被第一次浏览时需要临时生成压缩文件,使页面的呈现速度受到影响以外,页面被再次浏览时因为缓存中已经保存了压缩文件所以呈现速度较快,提高了页面上线运行的效率。 In this way, only when the page is first necessary to temporarily generate a compressed file browser, the page rendering speed is affected outside the browser when the page is saved again because the cache has been presented so compressed file faster, improve the running line on the page s efficiency.

[0026] 需要说明的是,在步骤S13中,通常的浏览器都会先从本地缓存中查找需要的javascript文件和/或CSS文件,在没有查找到的情况下再执行步骤S13中的向服务器发送请求信息。 [0026] It should be noted that, in step S13, the browser will usually find the required javascript files and / or CSS files start with the local cache, and then sent to the server to perform step S13 in the case of not found request information.

[0027] 为了保证javascript文件和/或CSS文件与压缩这些javascript文件和/或CSS文件所得到的压缩文件之间的唯一对应性,可以在压缩完成之后,根据被压缩的javascript 文件和/或CSS文件的文件名得到唯一对应于这些javascript文件和/或CSS文件的字段,例如可以将这些javascript文件和/或CSS文件的文件名首尾相连之后进行散列计算,将得到的散列值作为压缩文件的文件名。 [0027] In order to guarantee a unique correspondence between a javascript file and / or a compressed file and CSS file compress javascript file and / or CSS document obtained after the compression can be completed, according to the compressed javascript file and / or CSS to give a unique name of a file corresponding to the javascript file and / or CSS document fields, for example, the file name javascript file and / or a CSS file hash calculation performed after connected end to end, the hash value obtained as a compressed file file name. 相应地,服务器在步骤S13中收到请求信息后,根据请求信息中的javascript文件和/或CSS文件的文件名,进行相同方式的处理例如相同方式的散列计算从而得到相应的压缩文件的文件名。 Accordingly, in step S13, the server receives the request message, the file name javascript file request information and / or CSS file, for example, be treated in the same manner as the hash calculated in the same manner to obtain the corresponding file the compressed file name.

[0028] 因为页面即使在上线运行期间也有可能被进一步修改,所以可以对保存在缓存中的压缩文件设置有效时长,在生成压缩文件并且保存在缓存时开始计时,经过上述有效时长后就从缓存中删除该压缩文件。 [0028] is further modified because the page even during on-line operation is also possible, so long valid may be provided for the compressed file stored in the cache, the generated compressed file and stored in a cache start timing, after the effective duration after from the buffer To remove the compressed file.

[0029] 根据本实施例的上述方案,在实现中,可以选用velocity自定义标签作为端统一的调用方式,合并压缩引擎可采用yuicompressor,对压缩合并后的文件内容可采用memcahced作为缓存,同时可以通过实现不同的缓存接口来进行缓存框架的平滑切换。 [0029] According to the above embodiment of the present embodiment, the implementation may be chosen as a terminal velocity custom tag is called a unified, combined compression engine YUICompressor employed, the compressed content file can be merged memcahced as the cache, while smooth switching to buffer framework by implementing various cache interface. 当然在开发页面时不限于采用^1〇以0模板引擎,其他开发工具也可以使用。 Of course, in the development of the page is not limited to the use of ^ 0 1〇 template engine, other development tools can also be used. 以下对于velocity自定义标签进行举例说明。 For the velocity custom tags exemplified.

[0030] velocity自定义标签VelocityCompressTag [0030] velocity custom label VelocityCompressTag

[0031] public String parsejs (List<String>fileNames,String version) [0031] public String parsejs (List <String> fileNames, String version)

[0032] 该方法实现了,从前端vm页面中批量传入一个或多个js文件,服务端根据当前的配置的运行环境来决定是否进行压缩。 [0032] The method implements, from the front page vm in one or more of the incoming batch js file, the server to determine whether compressed according to the current configuration of the operating environment.

[0033] 参数说明: [0033] Parameters:

[0034] fi leNames:传入的js相对路径 [0034] fi leNames: relative path incoming js

[0035] version: js文件的列表的版本号 [0035] version: a list of js file version number

[0036] public String inlinejs (String [] fileNames) [0036] public String inlinejs (String [] fileNames)

[0037] 该方法实现将多个js文件的内容读取出来内联的html页面中,这样做的好处是便于开发人员在开发中进行调试 [0037] The method enables the contents of multiple js files read out inline html page, the benefits of doing so is easier for developers to debug in development

[0038] 参数说明: [0038] Parameters:

[0039] fi leNames:传为的js相对路径 [0039] fi leNames: js pass for the relative path

[0040] 合并压缩核心服务实现CompressService [0040] The combined compression core service implementation CompressService

[0041] public String compress (HttpServletRequest request,int type) [0041] public String compress (HttpServletRequest request, int type)

[0042] 该方法实现了对多个文件进行循环压缩及合并功能。 [0042] The method enables a plurality of files and merge compression cycles. _] 参数说明: _] Parameter Description:

[0044] request: HttpServletRequest 请求 [0044] request: HttpServletRequest request

[0045] type:文件类型,1表不js,2表不css [0045] type: file type, Table 1 is not js, 2 table is not css

[0046] public String getFileContent (HttpServletRequest request, String fileName,int type) [0046] public String getFileContent (HttpServletRequest request, String fileName, int type)

[0047]该方法实现了对某一个文件的内容的读取。 [0047] The method enables the reading of the contents of a file.

[0048] 参数说明: [0048] Parameters:

[0049] request: HttpServletRequest 请求 [0049] request: HttpServletRequest request

[0050] fileName: js或css的文件路径 Js css or the file path: [0050] fileName

[0051] type:文件类型,1表不js,2表不css [0051] type: file type, Table 1 is not js, 2 table is not css

[0052] public static void set Re spon s eHeade r Ca ch e (long addday s , HttpServletRequest request,HttpServletResponse response, String encoding) [0052] public static void set Re spon s eHeade r Ca ch e (long addday s, HttpServletRequest request, HttpServletResponse response, String encoding)

[0053] 该方法实现缓存策略。 [0053] The method enables caching strategy.

[0054] 参数说明: [0054] Parameters:

[0055] adddays:客户端的缓存秒数 [0055] adddays: the number of seconds the client's cache

[0056] request:请求 [0056] request: a request

[0057] response:响应 [0057] response: Response

[0058] encoding:字符编码,默认为UTF-8 [0058] encoding: character encoding, default is UTF-8

[0059] 图2是根据本发明实施例的传输网络数据的装置的示意图。 [0059] FIG. 2 is a schematic diagram of a data transmission network apparatus embodiment in accordance with the embodiment of the invention. 如图2所示,传输网络数据的装置20主要包括第一接收模块201、第一发送模块202、第二接收模块203、以及第二发送模块204。 2, the network data transmission apparatus 20 mainly includes a first receiving module 201, a first transmitting module 202, a second receiving module 203, and a second transmitting module 204. 图2还示出了分布式缓存22以及服务器的文件系统23。 2 also illustrates a distributed cache server 22 and file system 23.

[0060] 第一接收模块201用于接收终端的访问网络地址的请求;第一发送模块2〇2用于向所述终端发送网页源代码,所述网页源代码中包含用于指定javascript文件和/或层叠样式表(CSS)文件的指令;第二接收模块203用于接收所述终端根据所述指令生成的请求信息;第二发送模块204用于将压缩文件提供给所述终端,所述压缩文件中包含有所述指令指定的javascript文件和/或CSS文件。 [0060] a first receiving module 201 for receiving a request to access the network address of the terminal; a first transmitting module for transmitting 2〇2 page source code to the terminal, the web page is used to specify source comprises javascript file and code / or instructions Cascading style Sheets (CSS) file; a second receiving module 203 for receiving the request information generated by the terminal according to the instruction; and a second module 204 for transmitting the compressed file to the terminal, wherein the compressed file contains the instructions specified javascript file and / or a CSS file.

[0061] 第二发送模块204还可用于:从分布式缓存22中获取压缩文件然后发送给所述终端;在分布式缓存22中不存在所述压缩文件的情况下,从文件系统23中获取所述指令指定的javascript文件和/或CSS文件然后压缩得到所述压缩文件,再将该压缩文件发送给所述终端并且保存在分布式缓存22中。 [0061] The second sending module 204 may also be used: the terminal is then transmitted to the distributed cache 22 acquires from the compressed file; acquired from the file system 23 in the case of a distributed cache 22 in the compressed file does not exist the instructions specified javascript file and / or CSS file is then compressed to obtain the compressed file, and then transmits the compressed file to the terminal and stored in the distributed cache 22.

[0062] 第二发送模块204还可用于:设置有效时长;从所述压缩文件被保存在分布式缓存22中起经过所述有效时长后,将所述压缩文件从分布式缓存22中删除。 [0062] The second sending module 204 may also be configured to: set the valid duration; is stored in the effective length of said distributed cache 22 since elapsed from the compressed file, the compressed file is deleted from the distributed cache 22. t〇〇63] 第二发送模块204还可用于:将从文件系统中获取的所述指令指定的javascript 文件和/或CSS文件进行压缩处理,并且根据获取的javascript文件和/或CSS文件的文件名得到唯一对应于获取的javascript文件和/或CSS文件的字段,将该字段作为所述压缩处理得到的压缩文件的文件名。 t〇〇63] The second transmitting module 204 may also be used: the instruction acquired from the file system designated javascript file and / or compression processing CSS file, and the file according to the acquired javascript file and / or CSS file It was obtained corresponding to the acquired unique javascript file and / or field CSS file, the file name of the compressed file field as the compression processing obtained.

[0064] 根据本发明实施例的技术方案,服务器响应于终端的访问网络地址的请求,向终端发送网页源代码,该网页源代码中包含用于指定javascript文件和/或层叠样式表(CSS) 文件的指令;然后服务器响应于该终端根据上述指令生成的请求信息,将压缩文件提供给该终端,该压缩文件中包含有上述指令指定的javascript文件和/或CSS文件,从而在网页中事先指定要提供的javascript文件和/或CSS文件,无需网页开发人员手动制作压缩文件,而是在网页被浏览时临时由服务器制作压缩文件,并且在修改页面、改变要提供的javascript文件和/或CSS文件的情况下,只需修改网页代码,仍无需网页开发人员手动制作压缩文件,提高了网页开发、修改和测试的效率;并且减小了人工参与的程度,于是减小了页面的出错率。 [0064] According to the embodiment of the present invention, the server response to a request to access the network address of the terminal, the terminal transmits page source code, the source code comprising the page for specifying a javascript file and / or Cascading Style Sheets (CSS) instruction file; and the server in response to the terminal according to the request information of the generated command, the compressed file to the terminal, the compressed file contains the command specified javascript file and / or CSS files, to specify in advance in the page javascript files and / or CSS file to be provided without web developers to make the compressed file manually, but temporary zip file from the server made when the page was viewed, and modify the page, change the javascript files to be provided and / or CSS files under the circumstances, simply modify the page code, web developers still do not need to manually make a compressed file, improve the efficiency of web development, modification and testing; and reduces the degree of human intervention, thus reducing the error rate of the page. 并且根据本发明实施例的技术方案,优先从读写速度较快的缓存中读取现成的压缩文件,如果没有该压缩文件再临时读取javascript文件和/或CSS文件并压缩得到压缩文件,并且将得到的压缩文件保存到缓存中,这样,只有当页面被第一次浏览时需要临时生成压缩文件,使页面的呈现速度受到影响以外,页面被再次浏览时因为缓存中已经保存了压缩文件所以呈现速度较快,提高了页面上线运行的效率。 According to the embodiment and the embodiment of the present invention, the priority is read from the compressed file ready faster read and write cache, if not read the temporary file and then compressed javascript file and / or CSS file and the compressed file is compressed, and save the compressed file will get to the cache, so that only when the page is first necessary to temporarily generate a compressed file browser, the page rendering speed is affected outside the browser when the page is saved again because the cache has been so compressed file rendering faster, improve the efficiency of the line to run the page.

[0065]以上结合具体实施例描述了本发明的基本原理,但是,需要指出的是,对本领域的普通技术人员而言,能够理解本发明的方法和设备的全部或者任何步骤或者部件,可以在任何计算装置(包括处理器、存储介质等)或者计算装置的网络中,以硬件、固件、软件或者它们的组合加以实现,这是本领域普通技术人员在阅读了本发明的说明的情况下运用他们的基本编程技能就能实现的。 [0065] with reference to specific embodiments describe the basic principles of the invention, however, to be noted that those of ordinary skill in the art can understand that all the methods and apparatus of the present invention or any steps or components, may be any computing device (including a processor, a storage medium etc.) or a network computing device, hardware, firmware, software, or a combination thereof be implemented, which those of ordinary skill in the art to use in reading the description of the present invention their basic programming skills will be able to achieve.

[0066]因此,本发明的目的还可以通过在任何计算装置上运行一个程序或者一组程序来实现。 [0066] Accordingly, an object of the present invention may also be achieved by running a program on any computing device or a set of programs. 所述计算装置可以是公知的通用装置。 The device may be a general purpose computing device known. 因此,本发明的目的也可以仅仅通过提供包含实现所述方法或者装置的程序代码的程序产品来实现。 Accordingly, an object of the present invention may also be provided only by comprising program code means implementing the method or program products. 也就是说,这样的程序产品也构成本发明,并且存储有这样的程序产品的存储介质也构成本发明。 That is, such a program product also forms the present invention, and a storage medium storing such a program product also forms the present invention. 显然,所述存储介质可以是任何公知的存储介质或者将来开发出的任何存储介质。 Obviously, the storage medium may be any known storage medium, or any storage medium developed in the future.

[0067]还需要指出的是,在本发明的装置和方法中,显然,各部件或各步骤是可以分解和/或重新组合的。 [0067] also to be noted that, in the apparatus and method of the present invention, obviously, the parts or steps may be decomposed and / or recombined. 这些分解和/或重新组合应视为本发明的等效方案。 These decomposition and / or recombination of the present invention should be considered equivalents. 并且,执行上述系列处理的步骤可以自然地按照说明的顺序按时间顺序执行,但是并不需要一定按照时间顺序执行。 Further, the above-described series of processing steps can naturally be performed chronologically in order of description but need not necessarily be performed chronologically. 某些步骤可以并行或彼此独立地执行。 Some steps may be performed in parallel or independently of one another.

[0068]上述具体实施方式,并不构成对本发明保护范围的限制。 [0068] The specific embodiments do not limit the scope of the present invention. 本领域技术人员应该明白的是,取决于设计要求和其他因素,可以发生各种各样的修改、组合、子组合和替代。 Those skilled in the art would understand that, depending on design requirements and other factors that can occur various modifications, combinations, sub-combinations and alternatives. 任何在本发明的精神和原则之内所作的修改、等同替换和改进等,均应包含在本发明保护范围之内。 Any modifications within the spirit and principle of the present invention, equivalent substitutions and improvements should be included within the scope of the present invention.

Claims (2)

  1. 1 •一种传输网络数据的方法,其特征在于,包括: 服务器响应于终端的访问网络地址的请求,向所述终端发送网页源代码,所述网页源代码中包含用于指定javascript文件和层叠样式表(CSS)文件的指令,所述指令包括所述javascript文件和CSS文件的文件路径;所述网页是页面开发过程中的网页; 服务器响应于所述终端根据所述指令生成的请求信息,从文件系统中读取所述javascript文件和CSS文件,然后将压缩文件提供给所述终端,所述压缩文件中包含有所述指令指定的javascript文件和CSS文件。 1 • A method for transmitting data in a network, characterized by comprising: a server in response to a request to access the network address of the terminal, and transmits to the terminal page source code, the source code of the web page contains a javascript file and specifies laminated instruction style sheet (CSS) files, the instructions including the file path javascript file and a CSS file; the web is a web page development process; a server terminal in response to the request information generated in accordance with the instructions, read from the file system of the javascript file and a CSS file, the compressed file is then provided to the terminal, the compressed javascript file and a CSS file contains the file specified by the instruction.
  2. 2.根据权利要求1所述的方法,其特征在于,压缩得到所述压缩文件的步骤之后,还包括: 设置有效时长; 从所述压缩文件被保存在分布式缓存中起经过所述有效时长后,将所述压缩文件从所述分布式缓存中删除。 2. The method according to claim 1, wherein, after the step of compressing the compressed file obtained, further comprising: setting a valid duration; from the compressed file is stored in a distributed cache elapsed since said effective duration after the compressed file is deleted from the distributed cache. 3 •根据权利要求1所述的方法,其特征在于,压缩得到所述压缩文件的步骤包括: 将从文件系统中获取的所述指令指定的javascript文件和CSS文件进行压缩处理,并且根据获取的javascript文件和CSS文件的文件名得到唯一对应于获取的javascript文件和CSS文件的字段,将该字段作为所述压缩处理得到的压缩文件的文件名。 3 • method of claim 1, wherein the step of compressing the resulting compressed file comprising: the instruction acquired from the file system designated javascript file and a CSS file compression process, and in accordance with the acquired javascript file and a CSS file name of documents are unique field javascript file and a CSS file corresponding to the acquired, and the file name field as the compression process of the compressed file obtained. 4 •一种传输网络数据的装置,其特征在于,设置在服务器中,该装置包括: 第一接收模块,用于接收终端的访问网络地址的请求; 第一发送模块,用于向所述终端发送网页源代码,所述网页源代码中包含用于指定javascript文件和层叠样式表(CSS)文件的指令,所述指令包括所述javascript文件和CSS 文件的文件路径;所述网页是页面开发过程中的网页; 第二接收模块,用于接收所述终端根据所述指令生成的请求信息; 第二发送模块,用于从文件系统中读取所述javascript文件和CSS文件,然后将压缩文件提供给所述终端,所述压缩文件中包含有所述指令指定的javascript文件和CSS文件。 4 • An apparatus for data transmission network, characterized in that, arranged in the server, the apparatus comprising: a first receiving module, for requesting access to the network address of the receiving terminal; a first sending module, configured to the terminal send page source code, instructions for specifying a javascript file and Cascading style Sheets (CSS) file containing the source code of the web page, the instructions comprising the file path javascript file and a CSS file; the web page development process is the web page; a second receiving module configured to receive the request information generated by the terminal according to the instruction; second transmitting means for reading the javascript file and a CSS file from the file system, the file is then compressed to provide to the terminal, the compressed javascript file and a CSS file contains the file specified by the instruction. 5 •根据权利要求4所述的装置,其特征在于,所述第二发送模块还用于: 设置有效时长; 从所述压缩文件被保存在分布式缓存中起经过所述有效时长后,将所述压缩文件从所述分布式缓存中删除。 5 • apparatus as claimed in claim 4, wherein said second sending module is further configured to: set the valid duration; from the compressed file to be played in a distributed cache stored after the valid duration, the compressed file is deleted from the distributed cache. 6 •根据权利要求4所述的装置,其特征在于,所述第二发送模块还用于: 将从文件系统中获取的所述指令指定的javascript文件和CSS文件进行压缩处理,并且根据获取的javascript文件和CSS文件的文件名得到唯一对应于获取的javascript文件和CSS文件的字段,将该字段作为所述压缩处理得到的压缩文件的文件名。 6 • apparatus as claimed in claim 4, wherein said second sending module is further configured to: the instruction acquired from the file system designated javascript file and a CSS file compression process, and based on the obtained javascript file and a CSS file name of documents are unique field javascript file and a CSS file corresponding to the acquired, and the file name field as the compression process of the compressed file obtained.
CN 201310040161 2013-02-01 2013-02-01 A method and apparatus for data transmission network CN103139298B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201310040161 CN103139298B (en) 2013-02-01 2013-02-01 A method and apparatus for data transmission network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201310040161 CN103139298B (en) 2013-02-01 2013-02-01 A method and apparatus for data transmission network

Publications (2)

Publication Number Publication Date
CN103139298A true CN103139298A (en) 2013-06-05
CN103139298B true CN103139298B (en) 2017-04-12

Family

ID=48498595

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201310040161 CN103139298B (en) 2013-02-01 2013-02-01 A method and apparatus for data transmission network

Country Status (1)

Country Link
CN (1) CN103139298B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104283947A (en) * 2014-09-28 2015-01-14 深圳市中科无软件有限公司 Java script dynamic consolidated server and work process thereof
CN105159677A (en) * 2015-09-09 2015-12-16 深圳Tcl数字技术有限公司 Controlled display method of terminal user interface and controlled display device of terminal user interface

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1988576A (en) * 2006-12-18 2007-06-27 韩壮 Method for realizing mobile terminal dynamic cache memory multimedia interactive advertisement
CN101446960A (en) * 2008-12-30 2009-06-03 深圳市茁壮网络技术有限公司 Method for browsing web page at digital television terminal and browser thereof
CN102096712A (en) * 2011-01-28 2011-06-15 深圳市五巨科技有限公司 Method and device for cache-control of mobile terminal

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102081633A (en) * 2009-11-27 2011-06-01 阿里巴巴集团控股有限公司 JavaScript file management method, device and system
US9864611B2 (en) * 2010-12-15 2018-01-09 Microsoft Technology Licensing, Llc Extensible template pipeline for web applications

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1988576A (en) * 2006-12-18 2007-06-27 韩壮 Method for realizing mobile terminal dynamic cache memory multimedia interactive advertisement
CN101446960A (en) * 2008-12-30 2009-06-03 深圳市茁壮网络技术有限公司 Method for browsing web page at digital television terminal and browser thereof
CN102096712A (en) * 2011-01-28 2011-06-15 深圳市五巨科技有限公司 Method and device for cache-control of mobile terminal

Also Published As

Publication number Publication date Type
CN103139298A (en) 2013-06-05 application

Similar Documents

Publication Publication Date Title
US20090019105A1 (en) Methods and systems for java script parsing
US20110010690A1 (en) System and Method of Automatically Transforming Serial Streaming Programs Into Parallel Streaming Programs
US8285813B1 (en) System and method for emulating different user agents on a server
US20090083714A1 (en) Remote monitoring of local behavior of network applications
US20100223322A1 (en) Server based framework for improving ajax performance
US20120079057A1 (en) Acceleration and optimization of web pages access by changing the order of resource loading
US20120084346A1 (en) Page Loading Optimization Using Page-Maintained Cache
CN101067819A (en) Web page resource issuing method and issuing system
US8260845B1 (en) System and method for auto-generating JavaScript proxies and meta-proxies
CN101127783A (en) A website buffering method and device
US20090106296A1 (en) Method and system for automated form aggregation
US20100199169A1 (en) Web browser extension for simplified utilization of web services
US20090024982A1 (en) Apparatus, system, and method for archiving small objects to improve the loading time of a web page
CN101382958A (en) Web page loading method and device
US8527860B1 (en) System and method for exposing the dynamic web server-side
CN102109989A (en) Method, device and system for controlling browser cache
US20110191431A1 (en) Method and system for updating display screens
US8639743B1 (en) System and method for on-the-fly rewriting of JavaScript
US20130074052A1 (en) Run time incremental compilation of script code
CN103034727A (en) System for intercepting pop-up window in webpage
CN102368213A (en) Page downloading control method and system for IE (Internet Explorer) core browser
CN102346770A (en) WebKit browser webpage content loading method and device
CN101196815A (en) Installation package generating device and method, installation progress transferring method
US20130086138A1 (en) Implementing a java method
CN102508710A (en) Method and system for switching between IE6 kernel and novel IE kernel

Legal Events

Date Code Title Description
C06 Publication
C10 Entry into substantive examination
GR01