Webpage resource bundle uploading method and device

A technology for webpage resources and resource packages, applied in the field of webpage resource package uploading devices and webpage resource package uploading, can solve the problem of wasting CDN server space, etc., and achieve the effect of improving space utilization.

Active Publication Date: 2016-04-27
BEIJING QIHOO TECH CO LTD
View PDF5 Cites 11 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

These webpage resource packages may be developed by different developers, and each webpage resource package may also refer to the same picture, so when uploading these webpage resource packages to the CDN server, the pictures also need to be uploaded to the CDN server, then for the same pictures, it will waste the space of the CDN server

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Webpage resource bundle uploading method and device
  • Webpage resource bundle uploading method and device
  • Webpage resource bundle uploading method and device

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0085] refer to figure 1 , which shows a flow chart of the steps of an embodiment of a method for uploading a web page resource package according to an embodiment of the present invention, which may specifically include the following steps:

[0086] Step S110, acquiring a webpage resource package.

[0087] In practical applications, if a user wants to access a certain webpage, he can send a webpage access request to the web server through the client, and the web server can return HTML (HyperTextMarkupLanguage, hypertext markup language) code to the client. When the browser parses the HTML code, it needs to load the corresponding web page resource package, such as a JS (JavaScript) file, a CSS file, and the like. When executing these web page resource bundles, the images referenced therein need to be loaded.

[0088] For live webpages, in order to enable users to quickly access the webpage resource packages and reduce delays, the above webpage resource packages need to be up...

Embodiment 2

[0116]参照图2,示出了根据本发明一个实施例的一种网页资源包上传方法实施例的步骤流程图,具体可以包括如下步骤:

[0117]步骤S210,上传客户端获取网页资源包。

[0118]该网页资源包包括JavaScript组合资源包;所述JavaScript组合资源包是通过打包工具将多个JavaScript资源包合并获得。

[0119]步骤S220,上传客户端对于各网页资源包,获取所述网页资源包中各第一图片地址对应的图片,并将所述图片进行归一化。

[0120]在本发明实施例中,对于各个网络资源包,可以遍历其中的每行代码,逐个根据网络资源包中各图片在本地的服务器中的第一图片地址,获取图片暂存到上传客户端中;然后对这些暂存的图片进行归一化,相同的图片只存一份。

[0121]优选的,步骤S220,具体包括:

[0122]子步骤S221,计算各图片的MD5值。

[0123]其中的MD5是Message-DigestAlgorithm5,信息摘要算法5。MD5可以将整个文件当作一个大文本信息,也可以针对一段字符串,通过其不可逆的字符串变换算法,计算出这个文件或字符串唯一的MD5值。由此可见MD5值具有唯一性。

[0124]对于图片而言,MD5值的唯一性具体是指,不同图片的MD5值是唯一且互不相同的,而同样图片的MD5值是一样的。

[0125]在实际应用中,可以利用MD5值计算器,如完美MD5计算器等,计算各路经信息的MD5值。当然,也可以采用其他的算法对图片进行归一化,本发明实施例不对其加以限制。。

[0126]子步骤S222,将相同MD5值的图片进行归一化。

[0127]由MD5值的唯一性,所以可以利用图片的MD5值将图片进行归一化,具体为对于MD5相同的各图片,只保留其中一个图片。在本发明实施例中,可以选择保留首次计算出MD5值的图片,而不保留重复计算出MD5值的图片。当然,对于归一化可以有很多种具体方式,对此,本发明不加以限定。

[0128]例如,经步骤S221计算出的各图片的MD5值如表(1):

[0129]图片 MD5值 图片1 0ca175b9c0f726a831d895e269332461 图片2 0eerq874t97qdhsyhc1d895eu945985d 图片3 5u99w4hfsiyt9wy5tw909r0q4q4vt850 图片4 0ca175b9c0f726a831d89...

Embodiment 3

[0165]参照图3,示出了根据本发明一个实施例的一种网页资源包上传方法实施例的步骤流程图,具体可以包括如下步骤:

[0166]步骤S310,上传客户端获取网页资源包。

[0167]该网页资源包包括该网页资源包包括JavaScript组合资源包;所述JavaScript组合资源包是通过打包工具将多个JavaScript资源包合并获得。

[0168]步骤S320,上传客户端对于各网页资源包,将所述网页资源包中各第一图片地址,按第一图片地址进行归一化。

[0169]在本发明实施例中,对于各个网络资源包,可以遍历其中的每行代码,读取其中的各个第一图片地址,然后对这些第一图片地址进行归一化。

[0170]优选的,步骤S320,具体包括:

[0171]子步骤S321,逐行读取所述网页资源包中的代码,判断是否有包括图片格式的路径信息。

[0172]所述图片格式包括:jpg图片格式、和 / 或PNG图片格式。当然,还可能包括其他格式,本发明不对其加以限制。

[0173]在本发明实施例中,网页资源包中包含由JavaScript资源包合并而成的JavaScript组合资源包,其中的JavaScript资源包为一系列代码行,其中可以包括图片格式的路径信息。

[0174]在本发明实施例中,图片格式包括jpg图片格式、和 / 或PNG图片格式。其中jpg图片格式的路径信息一般是一段以".jpg”结尾的代码,PNG图片格式则一般是一段以".png”结尾的代码。

[0175]例如,http: / / p1.qhimg.com / t01e1863ffab91d5971.jpg为一个jpg图片格式的路径信息;http: / / p1.qhimg.com / t010a8d81330826f08e.png为一个PNG图片格式的路径信息。

[0176]在本发明实施例中,可以利用上述的".jpg”和".png”判断网页资源包中的代码中是否有包括图片格式的路径信息。当然,也可以采用其他的方式判断,对此本发明不加以限定。

[0177]子步骤S322,如果有包括图片格式的路径信息,则确认所述包括图片格式的路径信息为第一图片地址并进行记录。

[0178]在本发明实施例中,对于包括图片格式的路径信息,即为本发明实施例所述的第一图片地址,可以将其记录在消息队列中。

[0179]子步骤S323,对于记录的各路径信息,将相同的路径信息归一化为一个路径信息。

[0180...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The embodiment of the invention provides a webpage resource bundle uploading method, and relates to the technical field of computers. The method comprises the steps of obtaining a webpage resource bundle; normalizing first picture addresses of the same pictures quoted in the webpage resource bundle; uploading the picture corresponding to each normalized first picture address to a content distribution network sever; replacing each first picture address in the webpage resource bundle with the second picture address of the corresponding picture in the content distribution network server; and uploading the webpage resource bundle of which the first picture addresses are replaced to the content distribution network server. According to the webpage resource bundle uploading method, the problem that in the prior art, the space of the CDN server is wasted due to the same pictures is solved, and the advantages of reducing the repetitive rate of pictures in the CDN server and improving the utilization rate of space of the CDN server are achieved.

Description

technical field [0001] The invention relates to the field of computer technology, in particular to a method for uploading a webpage resource package and a device for uploading a webpage resource package. Background technique [0002] With the development of the network, the network has become more and more inseparable from people's life. For example, people can conduct activities such as searching for information, shopping, and communicating through the Internet. In practical applications, the user sends a webpage access request to the web server through the client, and the web server will return the corresponding webpage source code to the client according to the received webpage access request, and the client calls the webpage required to display the webpage according to the webpage source code. Various files and pictures, etc., and then display the webpage on the client for users to browse. [0003] Generally, the source code used to support a web page may depend on mul...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): H04L29/08
CPCH04L67/06H04L67/5651
Inventor 冯鹏
Owner BEIJING QIHOO TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products