CN107704464A - Parse the method and device in the path of static resource - Google Patents

Parse the method and device in the path of static resource Download PDF

Info

Publication number
CN107704464A
CN107704464A CN201610643161.1A CN201610643161A CN107704464A CN 107704464 A CN107704464 A CN 107704464A CN 201610643161 A CN201610643161 A CN 201610643161A CN 107704464 A CN107704464 A CN 107704464A
Authority
CN
China
Prior art keywords
path
resource
website
static
static resource
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.)
Granted
Application number
CN201610643161.1A
Other languages
Chinese (zh)
Other versions
CN107704464B (en
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.)
Beijing Gridsum Technology Co Ltd
Original Assignee
Beijing Gridsum 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 Beijing Gridsum Technology Co Ltd filed Critical Beijing Gridsum Technology Co Ltd
Priority to CN201610643161.1A priority Critical patent/CN107704464B/en
Publication of CN107704464A publication Critical patent/CN107704464A/en
Application granted granted Critical
Publication of CN107704464B publication Critical patent/CN107704464B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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]

Abstract

The embodiments of the invention provide a kind of method and device in the path for parsing static resource, this method includes:Obtain the resource path for the static resource that requestor requests access;If resource path is not present under the root path of the website of supplicant access, according to resource path, the Actual path of static resource is determined;The Actual path of static resource is returned into requesting party, so that requesting party loads the static resource according to the Actual path.If the path for solving static resource in the prior art is arranged to relative path, the problem of normal load static resource can be led to not, due to that the resource path of static resource can be arranged into relative path, when the address of website orientation needs modification, modified without the resource path to the static resource, when avoiding because using absolute path, when modification is needed in the address of website orientation, the problem of needing to modify to all absolute path, be advantageous to the deployment of website using the embodiment of inventive embodiments.

Description

Parse the method and device in the path of static resource
Technical field
The present invention relates to technical field of data processing, more particularly to a kind of method and dress in the path for parsing static resource Put.
Background technology
That the content of the address field of browser generally represents is the URL (URL) of current browsing content. In many cases, in order to clearly represent the path of current browsing content, column or level, URL is usually used The style of RESTFul forms, such as news list page address are expressed as http:// 127.0.0.1/news, it is actual in service end This address can be finally mapped to the Html files of a reality and returned, this Html file is by browser resolves, when browsing When device loads the external resource in HtmL files, it can go to load according to the path of external resource.
In Html files, path type includes:Absolute path and relative path, using relative path, it is commonly angled relative to When root path is to write, such as introduce a picture, the address with respect to root path is write as:/ images/login.png, is now loaded Static resource will be unable to normal load, and reason is that browser thinks that the path of the picture is http://127.0.0.1/news/ Images/login.png, still, actually this path is not present.
For in the prior art, if the path of static resource is arranged to relative path, leading to not normal load, this is quiet The problem of state resource, effective solution is not yet proposed at present.
The content of the invention
In view of the above problems, it is proposed that the present invention so as to provide one kind overcome above mentioned problem or at least in part solve on State the method and device in the path of the parsing static resource of problem.
One side, there is provided a kind of method in the path for parsing static resource, including:
Obtain the resource path for the static resource that requestor requests access;
If the resource path is not present under the root path of the website of supplicant access, according to the resource path, really The Actual path of the fixed static resource;
The Actual path of the static resource is returned into the requesting party, so that the requesting party is according to the actual road Footpath loads the static resource.
Alternatively, methods described also includes:
Judge that the resource path whether there is under the root path of the website of supplicant access;
If the resource path exists under the root path of the website of supplicant access, the resource path is returned into institute Requesting party is stated, so that the requesting party loads the static resource according to the resource path.
Alternatively, it is described according to the resource path, the Actual path of the static resource is determined, including:
The resource path of a RESTFul styles is determined according to the resource path of the static resource;
Root of the static resource in the website that the request accesses is determined according to the resource path of the RESTFul styles Actual path under path.
Alternatively, determine what the static resource accessed in the request according to the resource path of the RESTFul styles Actual path under the root path of website, including:
A division unit is deleted from the resource path of the RESTFul styles in a predetermined sequence, wherein, it is described The resource path of RESTFul styles includes dividing obtained multiple division units with separator;
Judge that remaining resource path whether there is in the case where the root path of website is visited in the request;
If being not present, continuation deletes next stroke from the resource path of the RESTFul styles in a predetermined sequence Subdivision, then judge that remaining resource path whether there is under the root path of the website, if being not present, continue above-mentioned mistake Journey, until remaining resource path exists under the root path of described website, and the remaining path is defined as described Actual path.
Alternatively, the resource path for obtaining the static resource that requestor requests access, including:
Obtain the request of website described in the supplicant access;
Judge that the resource that request accesses whether there is static resource;
If the resource that the request accesses has static resource, the resource path of the static resource is obtained.
Second aspect, a kind of device in the path for parsing static resource is additionally provided, including:
Acquisition module, the resource path of the static resource for obtaining requestor requests access;
Determining module, if being not present for the resource path under the root path of the website of supplicant access, according to institute Resource path is stated, determines the Actual path of the static resource;
Sending module, for the Actual path of the static resource to be returned into the requesting party, so that the requesting party The static resource is loaded according to the Actual path.
Alternatively, described device also includes:
Judge module, it whether there is for judging the resource path under the root path of the website of supplicant access;
The sending module, exist if being additionally operable to the resource path under the root path of the website of supplicant access, will The resource path returns to the requesting party, so that the requesting party loads the static resource according to the resource path.
Alternatively, the determining module includes:
Resolution unit, for determining the resource path of a RESTFul styles according to the resource path of the static resource;Really Order member, for determining root of the static resource in the website that request accesses according to the resource path of the RESTFul styles Actual path under path.
Alternatively, the determining unit is further used for:In a predetermined sequence from the resource road of the RESTFul styles A division unit is deleted in footpath, wherein, the resource paths of the RESTFul styles includes dividing to obtain with separator multiple Division unit;Judge that remaining resource path whether there is under the root path for the website that request accesses;If being not present, continue by Next division unit is deleted from the resource path of the RESTFul styles according to predetermined order, then judges remaining resource Path whether there is under the root path for the website that request accesses, if being not present, proceed as described above, until remaining resource road Footpath exists under the root path for the website that request accesses, and the remaining path is defined as into the Actual path.
Alternatively, the acquisition module includes:
First acquisition unit, for obtaining the request of website described in the supplicant access;
Judging unit, for judging that the resource that the request accesses whether there is static resource;
Second acquisition unit, if static resource be present for the resource that the request accesses, obtain the static resource Resource path.
The beneficial effect of the embodiment of the present invention is:If the resource path of the static resource accessed is in the website of supplicant access Root path under be not present, the resource path of the static resource is converted into Actual path, and Actual path is returned into request Side, to enable the requestor to according to the Actual path normal load static resource, if solving static resource in the prior art Path is arranged to relative path, the problem of leading to not the normal load static resource, due to can be by the money of static resource Source path is arranged to relative path, when the address of website orientation needs modification, without the resource path to the static resource Modify, when avoiding because using absolute path, it is necessary to enter to all absolute path when needing to change in the address of website orientation The problem of row modification, be advantageous to the deployment of website using the embodiment of inventive embodiments.
Described above is only the general introduction of technical solution of the present invention, in order to better understand the technological means of the present invention, And can be practiced according to the content of specification, and in order to allow above and other objects of the present invention, feature and advantage can Become apparent, below especially exemplified by the embodiment of the present invention.
Brief description of the drawings
Fig. 1 is one of schematic diagram of method in path of parsing static resource of the first embodiment of the present invention;
Fig. 2 is the schematic diagram of step 101 in the first embodiment of the present invention;
Fig. 3 is the schematic diagram of step 103 in the first embodiment of the present invention;
Fig. 4 is the two of the schematic diagram of the method in the path of the parsing static resource of the first embodiment of the present invention;
Fig. 5 is one of block diagram of device in path of parsing static resource of the second embodiment of the present invention;
Fig. 6 is the two of the block diagram of the device in the path of the parsing static resource of the second embodiment of the present invention.
Embodiment
The exemplary embodiment of the disclosure is more fully described below with reference to accompanying drawings.Although the disclosure is shown in accompanying drawing Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth here Limited.On the contrary, these embodiments are provided to facilitate a more thoroughly understanding of the present invention, and can be by the scope of the present disclosure Completely it is communicated to those skilled in the art.
It should be noted that term " comprising " and " having " in description and claims of this specification and they Any deformation, it is intended that cover it is non-exclusive include, such as series of steps or unit, but may include unclear It is that ground is listed or for other intrinsic steps of these processes, method, product or equipment or unit.
It should be noted that in the case where not conflicting, the feature in embodiments of the invention and embodiment can phase Mutually combination.Describe technical scheme in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
First embodiment
Fig. 1 is the flow chart of the method in the path of parsing static resource according to embodiments of the present invention, as shown in figure 1, should The steps can be included by parsing the method in the path of static resource:
Step 101, the resource path for obtaining the static resource that requestor requests access, subsequently into step 103.
Above-mentioned requesting party can be the electronic equipments such as computer, mobile phone, tablet personal computer, it is necessary to explanation, at this The particular type of requesting party is not limited in embodiment.
Above-mentioned static resource (StaticResource) determines its object or value after being compiled in first time, afterwards can not be right It is modified, and static resource can be the files such as css (CSS), the js (Javascript) of website in itself, or It can also be the resources such as the picture in web site contents, it is necessary to explanation, not limit the tool of static resource in the present embodiment Hold in vivo.
Above-mentioned resource path can be the absolute path of resource or the relative path of resource, wherein,
Absolute path, refer to complete path.The absolute path of resource represents:The address of resource be one utterly Location, such as http://127.0.0.1/login.png;
Relative path, it is exactly the position positioning between different files under same website.The file of reference is relative works as For the position of preceding webpage, relative path is drawn according to this relative position.The relative path of above-mentioned resource can represent:Money The address in source is the address relative to root path, such as during one picture of introducing, the address with respect to root path is write as:/images/ login.png。
The root path of website, it is exactly the Logical Disk root path of web space storage site file, what different spaces business provided Space is different, and root path is also different.
Embodiments of the present invention are better understood from for the ease of people in the art, below to absolute path and relative road Footpath is described in detail.
Absolute path refers to the path that file is truly present on hard disk.Such as " bg.jpg " this picture is to be stored in firmly " the E of disk:Book page layout code the 2nd chapter " under catalogue, then the absolute path of " bg.jpg " this picture is exactly " E:\ Book webpage cloth code the 2nd chapter bg.GIF ".If that the background picture of absolute path named web page is used just should Use following sentence:
<Body backround=" E:Book page layout code the 2nd chapter bg.GIF ">
Relative path, it is exactly the file destination position relative to oneself.Such as above example, draw in " s1.htm " file It is in same catalogue because " bg.jpg " picture is for " s1.htm " with " bg.jpg " picture, then be After using code below in " s1.htm " file, as long as (that is or same the relative position of both of these documents does not become In one catalogue), then which position of Web server no matter is uploaded to, picture can be correctly shown in browser.
<Body background=" bg.GIF ">
Give one example again, it is assumed that catalogue where " s1.htm " file is " E:Book page layout code the 2nd chapter ", And catalogue where " bg.jpg " picture is " E:Book page layout code the 2nd chapter img ", then " bg.jpg " picture phase It is in catalogue " img " subdirectory where it, then quoting the sentence of picture should be for " s1.htm " file:
<Body background=" img/bg.GIF ">
It should be noted that relative path uses separating character of the "/" character as catalogue, and absolute path can use " " or separating character of the "/" character as catalogue.Because " img " catalogue is the subdirectory under " the 2nd chapter " catalogue, therefore Do not have to add "/" separating character before " img ".
Often upper level catalogue is represented in relative path using " ../".If multiple upper level catalogues, can use Multiple " ../", such as " http://www.cnblogs.com/ " represents top-ranking's catalogue.Assuming that mesh where " s1.htm " file Record as " E:Book page layout code the 2nd chapter ", and " bg.jpg " picture where catalogue be " E:Book page layout Code ", then " bg.jpg " picture for " s1.htm " file, be catalogue where it higher level's catalogue in, then draw Should be with the sentence of picture:
<Body background=" ../bg.GIF ">
Referring to Fig. 2, step 1011, step 1013 and step 1015 can be included in step 101.
In step 1011, the request of supplicant access website is obtained, subsequently into step 1013.
Above-mentioned website can be portal website, government website or official website of enterprise, it is necessary to illustrate, in this implementation The particular type of the website is not limited in example.
In step 1013, judge that the resource that the request accesses whether there is static resource, enter step if existing 1015;Otherwise, it can return to step 1013;
In step 1015, if the resource that the request accesses has static resource, the resource path of static resource is obtained.
Such as:Request path is so that requesting party loads the static resource according to resource path.
Specifically, intercepted and captured for resource type for all requests of file, such as by writing one HttpHandler (being the processing center of a http request) intercepts and captures request, and whether the resource for then judging request is static money Source, if so, then obtaining the resource path of the static resource.
If step 103, resource path are not present under the root path of the website of supplicant access, according to resource path, really The Actual path of static resource is determined, subsequently into step 105.
In the present embodiment, the Actual path of above-mentioned static resource refers to the root path for the website for being present in supplicant access Under path corresponding with the static resource, requesting party can be by the Actual path normal load static resource, it is necessary to say It is bright, the concrete form of the Actual path is not limited in the present embodiment.
Referring to Fig. 3, step 103 includes:Step 1031, step 1033 and step 1035.
Step 1031, the resource path for determining according to the resource path of static resource a RESTFul styles, subsequently into step Rapid 1033;
The URL of RESTFul styles:Refer to the URL of the resource of access being organized into RESTFul styles, this URL is not It is the actual address of resource, rear end needs to map.
Such as:Resource path is 127.0.0.1/test/home/login/images/login.png,
One kind is optionally achieved in that:By separator according to being from left to right divided into the resource path of static resource Multiple units, first unit " 127.0.0.1 " is deleted for the first time, obtains the resource path of RESTFul styles:/test/ home/login/images/login.png
It is, of course, understood that the resource of RESTFul styles can also be determined by other means in the present embodiment Path.Such as:In PHP, typically by $ _ SERVER [' HTTP_HOST'] come with obtaining in URL the domain name of website or IP Location, such as resource path are 127.0.0.1/test/home/login/images/login.png, by $ _ SERVER [' HTTP_HOST'] obtain and "/127.0.0.1 " and then delete from 127.0.0.1/test/home/login/images/login.png Remove, you can obtain the resource path of RESTFul styles.
Step 1033, determined according to the resource path of RESTFul styles the static resource in the website that request accesses Actual path under root path.
Specifically, in step 1033, one is deleted from the resource path of the RESTFul styles in a predetermined sequence Individual division unit, wherein, the resource paths of the RESTFul styles includes dividing obtained multiple division units with separator; Judge that remaining resource path whether there is under the root path for the website that the request accesses;If being not present, continue according to pre- Fixed order deletes next division unit from the resource path of the RESTFul styles, then judges remaining resource path It whether there is under the root path for the website that request accesses, if being not present, proceed as described above, until remaining resource path exists Exist under the root path for the website for asking to access, and the remaining path is defined as the Actual path.
With reference to the example in step 1033, the resource path "/test/home/login/images/ of RESTFul styles The division unit that login.png " includes is "/test ", "/home ", "/login ", "/images ", "/login.png ".
It should be noted that the resource path of static resource separates according to separator '/', each character string is one after separation Individual division unit.For example, the resource path of static resource is:127.0.0.1/test/login.png, division unit is successively 127.0.0.1、test、login.png。
With continued reference to Fig. 1, step 105, the Actual path of static resource returned into requesting party, so that requesting party is according to reality Border path loads the static resource.
Alternatively, on the basis of Fig. 1, method also includes:Step 107 and step 108, referring to Fig. 4.
After step 101, into step 107, in step 107, judge resource path in the website of supplicant access Root path under whether there is, if in the presence of step 103 can be entered;Otherwise step 108 is entered.
If step 108, resource path exist under the root path of the website of supplicant access, will be returned to resource path The requesting party, so that requesting party loads static resource according to the resource path.
It is exemplified below, such as the resource path of the static resource of some request access is:
127.0.0.1/test/home/login/images/login.png
It is first according to list separator "/" and is from left to right divided into each unit, for the first time, deletion/127.0.0.1, obtains RESTFul styles path:/ test/home/login/images/login.png, see remaining path:/test/home/ Login/images/login.png whether there is under root path, if being not present, then delete/test, then judge whether This file, in the absence of then proceeding as described above, until finding file true path or judging that file really there is no.
In the present embodiment, if access static resource resource path under the root path of the website of supplicant access not In the presence of, the resource path of the static resource is converted into Actual path, and Actual path is returned into requesting party, so that requesting party Can be according to the Actual path normal load static resource, if the path for solving static resource in the prior art is arranged to relative Path, the problem of normal load static resource can be led to not, due to that the resource path of static resource can be arranged into phase To path, when the address of website orientation needs modification, modified without the resource path to the static resource, avoid because During using absolute path, it is necessary to which the problem of being modified to all absolute path, adopts when needing to change in the address of website orientation Be advantageous to the deployment of website with the embodiment of inventive embodiments.
Second embodiment
Referring to Fig. 5, a kind of device in the path for parsing static resource is shown in figure, the device includes:Acquisition module 501st, determining module 503 and sending module 505.Wherein,
Acquisition module 501, the resource path of the static resource for obtaining requestor requests access;Above-mentioned static resource bag Include the money such as picture in the files, in addition to web site contents such as css (CSS), the js (Javascript) of website in itself Source, it is necessary to explanation, in the present embodiment not limit static resource particular content.Above-mentioned resource path can be resource Absolute path or resource relative path, wherein, the absolute path of resource represents:The address of resource is one exhausted To address, such as http://127.0.0.1/login.png;The relative path of resource can represent:The address of resource is relative In the address of root path, such as during one picture of introducing, the address with respect to root path is write as:/images/login.png.
Determining module 503, if being not present for the resource path under the root path of the website of supplicant access, according to The resource path, determine the Actual path of the static resource.In the present embodiment, the Actual path of above-mentioned static resource is Refer to the path corresponding with the static resource being present under the root path of website, requesting party can normally be remembered by the Actual path The static resource is carried, it is necessary to illustrate, does not limit the concrete form of the Actual path in the present embodiment.
Sending module 505, for the Actual path of the static resource to be returned into the requesting party, so that the request Root loads the static resource according to the Actual path.
Alternatively, in the present embodiment, sending module 506, if being additionally operable to net of the resource path in supplicant access Exist under the root path stood, the resource path is returned into the requesting party, so that the requesting party is according to the resource road Footpath loads the static resource.
On the basis of Fig. 5, alternatively, device also includes:Judge module 507, referring to Fig. 6.
Judge module 507, it whether there is for judging the resource path under the root path of the website of supplicant access.
On the basis of Fig. 5, optionally it is determined that module 503 includes:Resolution unit 5031 and determining unit 5035, referring to Fig. 6.
Resolution unit 5031, for determining the resource road of a RESTFul styles according to the resource path of the static resource Footpath;
Determining unit 5035, for determining the static resource described according to the resource path of the RESTFul styles Actual path under root path.
Alternatively, the determining unit 5035 is further used for:In a predetermined sequence from the money of the RESTFul styles A division unit is deleted in source path, wherein, the resource path of the RESTFul styles includes dividing what is obtained with separator Multiple division units;Judge that remaining resource path whether there is under the root path for the website that request accesses;If being not present, after It is continuous to delete next division unit from the resource path of the RESTFul styles in a predetermined sequence, then judge remaining Resource path whether there is under the root path for the website that request accesses, if being not present, proceed as described above, until remaining money Source path exists under the root path for the website that request accesses, and the remaining path is defined as into the Actual path.
On the basis of Fig. 5, alternatively, acquisition module 501 includes:First acquisition unit 5011, the and of judging unit 5013 Second acquisition unit 5015, referring to Fig. 6.
First acquisition unit 5011, for obtaining the request of website described in the supplicant access;
Judging unit 5013, for judging that the resource that the request accesses whether there is static resource;
Second acquisition unit 5015, if static resource be present for the resource that the request accesses, obtain the static money The resource path in source.
The device in the path of the parsing static resource includes processor and memory, above-mentioned acquisition module, determining module, Sending module, judge module etc. in memory, are stored in memory as program unit storage by computing device Said procedure unit realizes corresponding function.
Kernel is included in processor, is gone in memory to transfer corresponding program unit by kernel.Kernel can set one Or more, if being arranged to relative path by adjusting kernel parameter to solve the path of static resource in the prior art, can cause Can not the normal load static resource the problem of.
Memory may include computer-readable medium in volatile memory, random access memory (RAM) and/ Or the form such as Nonvolatile memory, such as read-only storage (ROM) or flash memory (flash RAM), memory includes at least one deposit Store up chip.
In the present embodiment, if access static resource resource path under the root path of the website of supplicant access not In the presence of, the resource path of the static resource is converted into Actual path, and Actual path is returned into requesting party, so that requesting party Can be according to the Actual path normal load static resource, if the path for solving static resource in the prior art is arranged to relative Path, the problem of normal load static resource can be led to not, due to that the resource path of static resource can be arranged into phase To path, when the address of website orientation needs modification, modified without the resource path to the static resource, avoid because During using absolute path, it is necessary to which the problem of being modified to all absolute path, adopts when needing to change in the address of website orientation Be advantageous to the deployment of website with the embodiment of inventive embodiments.
Present invention also provides a kind of computer program product, when being performed on data processing equipment, is adapted for carrying out just The program code of beginningization there are as below methods step:Obtain the resource path for the static resource that requestor requests access;If the money Source path is not present under the root path of the website of supplicant access, according to the resource path, determines the static resource Actual path;The Actual path of the static resource is returned into the requesting party, so that the requesting party is according to the reality Path loads the static resource.
It should be understood by those skilled in the art that, embodiments herein can be provided as method, system or computer program Product.Therefore, the application can use the reality in terms of complete hardware embodiment, complete software embodiment or combination software and hardware Apply the form of example.Moreover, the application can use the computer for wherein including computer usable program code in one or more The computer program production that usable storage medium is implemented on (including but is not limited to magnetic disk storage, CD-ROM, optical memory etc.) The form of product.
The application is with reference to the flow according to the method for the embodiment of the present application, equipment (system) and computer program product Figure and/or block diagram describe.It should be understood that can be by every first-class in computer program instructions implementation process figure and/or block diagram Journey and/or the flow in square frame and flow chart and/or block diagram and/or the combination of square frame.These computer programs can be provided The processors of all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing devices is instructed to produce A raw machine so that produced by the instruction of computer or the computing device of other programmable data processing devices for real The device for the function of being specified in present one flow of flow chart or one square frame of multiple flows and/or block diagram or multiple square frames.
These computer program instructions, which may be alternatively stored in, can guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works so that the instruction being stored in the computer-readable memory, which produces, to be included referring to Make the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one square frame of block diagram or The function of being specified in multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that counted Series of operation steps is performed on calculation machine or other programmable devices to produce computer implemented processing, so as in computer or The instruction performed on other programmable devices is provided for realizing in one flow of flow chart or multiple flows and/or block diagram one The step of function of being specified in individual square frame or multiple square frames.
In a typical configuration, computing device includes one or more processors (CPU), input/output interface, net Network interface and internal memory.
Memory may include computer-readable medium in volatile memory, random access memory (RAM) and/ Or the form such as Nonvolatile memory, such as read-only storage (ROM) or flash memory (flash RAM).Memory is computer-readable Jie The example of matter.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method Or technology come realize information store.Information can be computer-readable instruction, data structure, the module of program or other data. The example of the storage medium of computer includes, but are not limited to phase transition internal memory (PRAM), static RAM (SRAM), moved State random access memory (DRAM), other kinds of random access memory (RAM), read-only storage (ROM), electric erasable Programmable read only memory (EEPROM), fast flash memory bank or other memory techniques, read-only optical disc read-only storage (CD-ROM), Digital versatile disc (DVD) or other optical storages, magnetic cassette tape, the storage of tape magnetic rigid disk or other magnetic storage apparatus Or any other non-transmission medium, the information that can be accessed by a computing device available for storage.Define, calculate according to herein Machine computer-readable recording medium does not include temporary computer readable media (transitory media), such as data-signal and carrier wave of modulation.
Embodiments herein is these are only, is not limited to the application.To those skilled in the art, The application can have various modifications and variations.All any modifications made within spirit herein and principle, equivalent substitution, Improve etc., it should be included within the scope of claims hereof.

Claims (10)

  1. A kind of 1. method in the path for parsing static resource, it is characterised in that including:
    Obtain the resource path for the static resource that requestor requests access;
    If the resource path is not present under the root path of the website of supplicant access, according to the resource path, institute is determined State the Actual path of static resource;
    The Actual path of the static resource is returned into the requesting party, so that the requesting party adds according to the Actual path Carry the static resource.
  2. 2. according to the method for claim 1, it is characterised in that methods described also includes:
    Judge that the resource path whether there is under the root path of the website of supplicant access;
    If the resource path exists under the root path of the website of supplicant access, the resource path is returned into described ask The side of asking, so that the requesting party loads the static resource according to the resource path.
  3. 3. according to the method for claim 1, it is characterised in that it is described according to the resource path, determine the static money The Actual path in source, including:
    The resource path of a RESTFul styles is determined according to the resource path of the static resource;
    Root path of the static resource in the website that the request accesses is determined according to the resource path of the RESTFul styles Under Actual path.
  4. 4. according to the method for claim 3, it is characterised in that institute is determined according to the resource path of the RESTFul styles Actual path of the static resource under the root path for the website that the request accesses is stated, including:
    A division unit is deleted from the resource path of the RESTFul styles in a predetermined sequence, wherein, it is described The resource path of RESTFul styles includes dividing obtained multiple division units with separator;
    Judge that remaining resource path whether there is in the case where the root path of website is visited in the request;
    If being not present, it is single that next division is deleted in continuation from the resource path of the RESTFul styles in a predetermined sequence Member, then judge that remaining resource path whether there is under the root path of the website, if being not present, proceed as described above, directly Exist to remaining resource path under the root path of described website, and the remaining path is defined as the actual road Footpath.
  5. 5. according to the method for claim 1, it is characterised in that the money for obtaining the static resource that requestor requests access Source path, including:
    Obtain the request of website described in the supplicant access;
    Judge that the resource that request accesses whether there is static resource;
    If the resource that request accesses has static resource, the resource path of the static resource is obtained.
  6. A kind of 6. device in the path for parsing static resource, it is characterised in that including:
    Acquisition module, the resource path of the static resource for obtaining requestor requests access;
    Determining module, if being not present for the resource path under the root path of the website of supplicant access, according to the money Source path, determine the Actual path of the static resource;
    Sending module, for the Actual path of the static resource to be returned into the requesting party so that the requesting party according to The Actual path loads the static resource.
  7. 7. device according to claim 6, it is characterised in that described device also includes:
    Judge module, it whether there is for judging the resource path under the root path of the website of supplicant access;
    The sending module, exist if being additionally operable to the resource path under the root path of the website of supplicant access, by described in Resource path returns to the requesting party, so that the requesting party loads the static resource according to the resource path.
  8. 8. device according to claim 6, it is characterised in that the determining module includes:
    Resolution unit, for determining the resource path of a RESTFul styles according to the resource path of the static resource;
    Determining unit, for determining that the static resource is visited in the requesting party according to the resource path of the RESTFul styles Actual path under the root path for the website asked.
  9. 9. device according to claim 8, it is characterised in that the determining unit is further used for:According to predetermined suitable Sequence deletes a division unit from the resource path of the RESTFul styles, wherein, the resource road of the RESTFul styles Footpath includes dividing obtained multiple division units with separator;Judge remaining resource path on the root road for the website that request accesses It whether there is under footpath;If being not present, continuation is deleted next from the resource path of the RESTFul styles in a predetermined sequence Individual division unit, then judge that remaining resource path whether there is under the root path for the website that request accesses, if being not present, after Continuous said process, until remaining resource path exists under the root path for the website that request accesses, and by the remaining road Footpath is defined as the Actual path.
  10. 10. device according to claim 6, it is characterised in that the acquisition module includes:
    First acquisition unit, for obtaining the request of website described in the supplicant access;
    Judging unit, for judging that the resource that request accesses whether there is static resource;
    Second acquisition unit, if static resource be present for the resource for asking to access, obtain the resource path of the static resource.
CN201610643161.1A 2016-08-08 2016-08-08 Method and device for analyzing path of static resource Active CN107704464B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610643161.1A CN107704464B (en) 2016-08-08 2016-08-08 Method and device for analyzing path of static resource

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610643161.1A CN107704464B (en) 2016-08-08 2016-08-08 Method and device for analyzing path of static resource

Publications (2)

Publication Number Publication Date
CN107704464A true CN107704464A (en) 2018-02-16
CN107704464B CN107704464B (en) 2021-05-07

Family

ID=61168620

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610643161.1A Active CN107704464B (en) 2016-08-08 2016-08-08 Method and device for analyzing path of static resource

Country Status (1)

Country Link
CN (1) CN107704464B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110008182A (en) * 2019-04-15 2019-07-12 山东浪潮云信息技术有限公司 A kind of method that static resource is saved and generated in document
CN113055443A (en) * 2021-02-20 2021-06-29 北京奇艺世纪科技有限公司 Resource data deployment method, device, equipment and storage medium
CN117076010A (en) * 2023-09-15 2023-11-17 腾讯科技(深圳)有限公司 Program module processing method, apparatus, device and computer readable storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7293012B1 (en) * 2003-12-19 2007-11-06 Microsoft Corporation Friendly URLs
CN101242229A (en) * 2008-03-17 2008-08-13 北京创毅视讯科技有限公司 A data transmission method and terminal in mobile multimedia broadcasting system
CN101576908A (en) * 2009-03-12 2009-11-11 北京中星微电子有限公司 Method and system for acquiring file handle by file name
CN101763418A (en) * 2009-12-16 2010-06-30 中兴通讯股份有限公司 File resource access method and device
CN102214224A (en) * 2011-06-15 2011-10-12 中兴通讯股份有限公司 Network resource access optimizing method, Web page browser and terminal
CN103491451A (en) * 2013-09-26 2014-01-01 深圳Tcl新技术有限公司 Method and device for obtaining webpage data
CN103685400A (en) * 2012-09-17 2014-03-26 联想(北京)有限公司 Information processing method, server and electronic equipment
CN104573001A (en) * 2015-01-07 2015-04-29 北京联合大学 Mobile terminal-based webpage data acqusition and classification method
CN104978373A (en) * 2014-06-09 2015-10-14 腾讯科技(深圳)有限公司 Webpage display method and webpage display device

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7293012B1 (en) * 2003-12-19 2007-11-06 Microsoft Corporation Friendly URLs
CN101242229A (en) * 2008-03-17 2008-08-13 北京创毅视讯科技有限公司 A data transmission method and terminal in mobile multimedia broadcasting system
CN101576908A (en) * 2009-03-12 2009-11-11 北京中星微电子有限公司 Method and system for acquiring file handle by file name
CN101763418A (en) * 2009-12-16 2010-06-30 中兴通讯股份有限公司 File resource access method and device
CN102214224A (en) * 2011-06-15 2011-10-12 中兴通讯股份有限公司 Network resource access optimizing method, Web page browser and terminal
CN103685400A (en) * 2012-09-17 2014-03-26 联想(北京)有限公司 Information processing method, server and electronic equipment
CN103491451A (en) * 2013-09-26 2014-01-01 深圳Tcl新技术有限公司 Method and device for obtaining webpage data
CN104978373A (en) * 2014-06-09 2015-10-14 腾讯科技(深圳)有限公司 Webpage display method and webpage display device
CN104573001A (en) * 2015-01-07 2015-04-29 北京联合大学 Mobile terminal-based webpage data acqusition and classification method

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
SOUTH-FLY: "Spring MVC Restful构建中静态资源访问问题", 《HTTPS://BLOG.CSDN.NET/SUNLOVEFLY2008/ARTICLE/DETAILS/47055173?UTM_MEDIUM=DISTRIBUTE.PC_RELEVANT.NONE-TASK-BLOG-OPENSEARCH-1.CHANNEL_PARAM&DEPTH_1-UTM_SOURCE=DISTRIBUTE.PC_RELEVANT.NONE-TASK-BLOG-OPENSEARCH-1.CHANNEL_PARAM》 *
YANJUNLU: "用html的base标签,解决静态资源、请求的相对路径问题", 《HTTPS://BLOG.CSDN.NET/YANJUNLU/ARTICLE/DETAILS/7997020》 *
刘俊: "面向资源构架的就业管理信息系统研究与设计", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *
平凡希: "SpringMVC访问静态资源的三种方式", 《HTTPS://BLOG.CSDN.NET/U012730299/ARTICLE/DETAILS/51872704》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110008182A (en) * 2019-04-15 2019-07-12 山东浪潮云信息技术有限公司 A kind of method that static resource is saved and generated in document
CN113055443A (en) * 2021-02-20 2021-06-29 北京奇艺世纪科技有限公司 Resource data deployment method, device, equipment and storage medium
CN117076010A (en) * 2023-09-15 2023-11-17 腾讯科技(深圳)有限公司 Program module processing method, apparatus, device and computer readable storage medium
CN117076010B (en) * 2023-09-15 2024-01-19 腾讯科技(深圳)有限公司 Program module processing method, apparatus, device and computer readable storage medium

Also Published As

Publication number Publication date
CN107704464B (en) 2021-05-07

Similar Documents

Publication Publication Date Title
CN106484383B (en) Page rendering method, device and equipment
US9613156B2 (en) Cookie information sharing method and system
CN103546498B (en) It is a kind of that the method and apparatus accessing webpage is provided for mobile terminal
CN110968824B (en) Page data processing method and device
US20160301732A1 (en) Systems and Methods for Recording and Replaying of Web Transactions
CN110069683B (en) Method and device for crawling data based on browser
CN108932332A (en) The loading method and device of static resource
CN107807937B (en) Website SEO processing method, device and system
CN103064989B (en) Webpage preservation, deployment method and device
CN108279903A (en) The method and device of page presentation
CN107294918B (en) Phishing webpage detection method and device
CN106886547A (en) A kind of scenario generation method and device
CN107704464A (en) Parse the method and device in the path of static resource
US10606935B2 (en) Transforming a website for dynamic web content management
JP6779307B2 (en) Method and device for page display
US20190379748A1 (en) Systems, devices, and methods for presenting customized content through web api
CN107040606B (en) Method and device for processing http request
CN106446640B (en) User knows method for distinguishing and server
CN111328394A (en) Locally secure rendering of WEB content
US20140337709A1 (en) Method and apparatus for displaying web page
CN106919595B (en) Cookie mapping method and device and electronic equipment
CN106611118A (en) Login credential applying method and apparatus
US10417296B1 (en) Intelligent bookmarking with URL modification
CN105589870B (en) Method and system for filtering webpage advertisements
CN115297042A (en) Method for detecting consistency of web pages under different networks and related equipment

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
GR01 Patent grant
GR01 Patent grant