CN106777348B - The Web system demenstration method and device of disengaging background logic based on HAR - Google Patents
The Web system demenstration method and device of disengaging background logic based on HAR Download PDFInfo
- Publication number
- CN106777348B CN106777348B CN201710031608.4A CN201710031608A CN106777348B CN 106777348 B CN106777348 B CN 106777348B CN 201710031608 A CN201710031608 A CN 201710031608A CN 106777348 B CN106777348 B CN 106777348B
- Authority
- CN
- China
- Prior art keywords
- browser
- transmission process
- har
- http
- server socket
- 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.)
- Expired - Fee Related
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/957—Browsing optimisation, e.g. caching or content distillation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/958—Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The Web system demenstration method and device for the disengaging background logic based on HAR that the invention discloses a kind of, are related to the Web development field towards browser end.This method comprises: installing and running the Web system of successful deployment, obtain the access address of Web system and open corresponding Web page;Various functions operation is carried out in open Web page, and browser is made to collect the HTTP transmission process information in feature operation;HTTP transmission process information preservation is har file by exploitation person's tool;Creation HTTP server socket is simultaneously set to: whenever receiving browse request, just using the har file of preservation as data source, circulation executes all HTTP transmission processes in har file;Finally by the address binding of the server socket set to the machine address, starts server and demonstrated.The invention avoids complicated background logics, heavy data base querying, reduce device hardware requirement, and demonstration fluency is good.
Description
Technical field
It is specifically that a kind of disengaging backstage based on HAR is patrolled the present invention relates to the Web development field towards browser end
The Web system demenstration method and device collected.
Background technique
Increasingly mature with Web technology, the project for bidding based on Web technology is also more and more, and in the trick of Web project
Mark scene, demonstration Web system are exactly the prefered method that bidder shows oneself product.And the common practice demonstrated is exactly in advance will
A whole set of Web system program is deployed in laptop devices, and scene accesses the Web system disposed using notebook in a browser
System, achievees the purpose that demonstration.
But in practical operation, this way is not perfectly safe.Because a powerful Web system is necessarily required to rely on data
Components such as library, caching, while there are also complicated logical code, these often have a very high requirement to hardware, and notebook performance
It is often poor.When being demonstrated inside browser, since the backstage Web needs more hardware resource, corresponding browsing
Hardware resource workable for device just substantially reduces, and browser just will appear Caton, delay phenomenon when demonstration in this way, thus shadow
Ring the fluency of demonstration.And at bid scene, this phenomenon is extremely disadvantageous for product competitive bidding.
Summary of the invention
The purpose of the invention is to overcome the shortcomings of above-mentioned background technique, provide it is a kind of based on HAR disengaging backstage patrol
The Web system demenstration method and device collected, realize Web system as data source by using har file derived from browser
Demonstration, effectively prevent complicated background logic, heavy data base querying, greatly reduce the hardware to demonstration equipment
It is required that improving the fluency of demonstration.
To achieve the above objectives, the technical solution adopted by the present invention is that: a kind of disengaging background logic based on HAR is provided
Web system demenstration method, method includes the following steps:
The Web system for installing and running successful deployment obtains the access address of Web system;
Corresponding Web page is opened according to the access address of Web system, and starts the included developer's tool of browser;
Various functions operation is carried out in open Web page, collects browser various in various functions operation
HTTP transmission process information;
Exploitation person's tool, the various HTTP transmission process information preservations that browser was collected are har file;
HTTP server socket is created, and server socket is arranged are as follows: whenever server socket receives browsing
When device is requested, just using the har file of preservation as data source, circulation executes all HTTP transmission processes in har file, and will
As a result browser is fed back to;
By the address binding of the server socket set to the machine address, starts HTTP server and demonstrated;It drills
During showing, realized according to the server socket set.
The present invention also provides a kind of Web system apparatus for demonstrating of disengaging background logic based on HAR for realizing the above method,
The device includes that access address obtains module, Web page opens module, transmission process information search module, har file generated mould
Module is realized in block, server socket creation module and Web demonstration.The access address obtains module and is used for: installing and is transporting
Row after the Web system of successful deployment, obtains the access address of Web system;The Web page is opened module and is used for: according to Web
The access address of system opens corresponding Web page, and starts the included developer's tool of browser;The transmission process information is searched
Collection module is used for: being carried out various functions operation in open Web page, is collected browser various in various functions operation
HTTP transmission process information;The har file generating module is used for: exploitation person's tool, and the various HTTP collected are passed
Defeated procedural information saves as har file;The server socket creation module is used for: creation HTTP server socket, and
Server socket is arranged are as follows: when server socket receives browse request, just using the har file of preservation as number
According to source, circulation executes all HTTP transmission processes in har file, and result is fed back to browser;The Web demonstration is realized
Module is used for: by the address binding of the server socket set to the machine address, being started HTTP server and is demonstrated;It drills
During showing, realized according to the server socket set.
The beneficial effects of the present invention are:
The present invention carries out various functions operation in open Web page in advance, and browser is made to collect various functions operation
In various HTTP transmission process information, exploitation person's tool, the various HTTP transmission process information that browser was collected
Save as har file;Then, set server socket to when server socket receives browse request, just with
For har file as data source, circulation executes all HTTP transmission processes in har file, and result is fed back to browser.When
When needing to demonstrate, need to only the address binding of the server socket set to the machine address be started HTTP server and be carried out
Demonstration in presentation process, can be realized according to the server socket set.
It compares for traditional browser demonstration mode for needing to rely on the components such as mass data library, caching, the present invention is logical
The demonstration for using har file derived from browser to realize Web system as data source is crossed, without complicated background logic and numerous
The data base querying of weight, it is only necessary to which a small amount of step can reach Web system demonstration purpose, and only read a small amount of file, right
Hardware performance requirements are extremely low, are not in Caton, delay phenomenon, to improve the fluency of demonstration.
Detailed description of the invention
Fig. 1 is the flow chart of the Web system demenstration method of the disengaging background logic based on HAR in the embodiment of the present invention;
Fig. 2 is the schematic diagram that har file is generated in the embodiment of the present invention;
Fig. 3 is the structural block diagram of the Web system apparatus for demonstrating of the disengaging background logic based on HAR in the embodiment of the present invention.
Specific embodiment
With reference to the accompanying drawing and specific embodiment the present invention is described in further detail.
It is needed in the present invention using har file, therefore some explanations is carried out to har file herein.HAR is a kind of
Web standard, its regulation browser want it is detailed record issued in each HTTP transmission process data information (including request header,
Request body) and the data information (including head response, answer code, response contents) that receives.These HTTP transmission process information can be with
Being exported/save as the JSON of the entitled .har of suffix, (JavaScript Object Notation is a kind of data of lightweight
Exchange format) format text file, the text file for being exported/saving is har file.The present invention is then by using browser
Derived har file realizes this programme as data source.
Specifically, shown in Figure 1, the embodiment of the present invention provides a kind of Web system of disengaging background logic based on HAR
System demenstration method, comprising the following steps:
Step S1: installing and runs the Web system of successful deployment, obtains the access address of Web system, is transferred to step
S2.In the present embodiment, the access address of Web system is http: // 127.0.0.1:8000.
Step S2: the access by inputting the Web system in the address field of browser (for example, Google's browser)
Corresponding Web page is opened in location;And start the included developer's tool of browser, it is transferred to step S3.In the present embodiment, by
Input http in the address field of Google's browser: // 127.0.0.1:8000 opens corresponding Web page.
Step S3: carrying out various functions operation in open Web page, which covers the every of Web system
A function makes browser collect the various HTTP transmission process information in various functions operation, is transferred to step S4.It is understood that
It is that HTTP transmission process information includes the data information issued in each HTTP transmission process and the data information received;Wherein,
The data information of sending includes request header, request body, and the data information received includes head response, answer code and response contents.
Step S4: exploitation person's tool, the various HTTP transmission process information preservations that browser was collected are har text
Part is transferred to step S5.When practical operation, as shown in Fig. 2, need to only select " Save in " network " list item of developer's tool
As HAR with content " option, will pop-up prompt save file, then the filename of preservation is set.For example,
The entitled HARFILE of file of the har file of preservation.
Step S5: creation HTTP server socket, and server socket is arranged are as follows: whenever server socket is received
When to browse request, just using the har file of the preservation as data source, circulation executes all HTTP in har file and passes
Defeated process, and result is fed back into browser, it is transferred to step S6.
Further, described in step S5 when server socket receives browse request, just with the preservation
For har file as data source, circulation executes all HTTP transmission processes in har file, and result is fed back to browser, has
Body includes following operation:
1) when server socket receives browse request, request path and the requesting party of current browser are obtained
Method;In practical operation, the request path and requesting method of current browser can be denoted as PATH, METHOD respectively.
2) this document Context resolution is JSON object by the har file for obtaining the preservation.
3) according to the request path and requesting method of the current browser got, circulation executes the JSON object of parsing
HTTP transmission process, and result is fed back into browser.
Further, in step 3, circulation executes the HTTP transmission process of the JSON object of parsing every time, specifically includes
It operates below:
301) request path of current transmission process, i.e. request.url attribute are obtained;Obtain asking for current transmission process
Ask method, i.e. request.method attribute;Obtain the response object of current transmission process, i.e. response attribute.
302) judge browser request path and requesting method whether respectively with the request path of current transmission process and
Requesting method is consistent, i.e. PATH is consistent with the path of request.url and METHOD is consistent with request.method, if so,
Then explanation finds the corresponding resource of current request, is transferred to step 303;Otherwise, illustrate to can not find the corresponding resource of current request, then
Feedback error information is to browser.
303) head response, answer code and the response contents of current transmission process are returned to browser, i.e.,
Response.headers attribute, response.status attribute and response.content.text attribute.
It is understood that head response, answer code and the response contents returned are all data sources due in step 303
Therefore the content kept in har file can effectively avoid complicated background logic and heavy data base querying, improve
The fluency of demonstration.Specifically, the realization code of step 3 can be following content:
Step S6: by the address binding of the server socket set to the machine address, start HTTP server and carry out
Demonstration;In presentation process, realized according to the server socket set.
When going to realize the demonstration of Web system using method of the invention, it is only necessary to which a small amount of step can reach Web system demonstration
Purpose, and a small amount of file is only read, it is extremely low to system performance requirements, it is provided for smooth demonstration Web system powerful
Power.
Shown in Figure 3, the present invention also provides a kind of Web of disengaging background logic based on HAR for realizing the above method
System apparatus for demonstrating, the device include access address obtain module, Web page open module, transmission process information search module,
Module is realized in har file generating module, server socket creation module and Web demonstration.
Wherein, access address obtains module and is used for: after installing and running the Web system of successful deployment, obtaining Web system
The access address of system.Web page is opened module and is used for: opening corresponding Web page according to the access address of Web system, and starts
The included developer's tool of browser.Transmission process information search module is used for: various functions are carried out in open Web page
Operation makes browser collect the various HTTP transmission process information in various functions operation.Har file generating module is used for: benefit
It is har file by the various HTTP transmission process information preservations collected with developer's tool.Server socket creation module
For: creation HTTP server socket, and server socket is arranged are as follows: it is asked whenever server socket receives browser
When asking, just using the har file of preservation as data source, circulation executes all HTTP transmission processes in har file, and by result
Feed back to browser.Web demonstration realizes that module is used for: by the address binding of the server socket set to the machine address,
Starting HTTP server is demonstrated;In presentation process, realized according to the server socket set.
Further, the server socket creation module specifically sets server socket to according to following content
It is operated: when server socket receives browse request, first obtaining request path and the requesting party of current browser
Method;This document Context resolution is JSON object by the har file for obtaining the preservation again;Finally, current clear according to what is got
Look at the request path and requesting method of device, circulation executes the HTTP transmission process of the JSON object of parsing, and result is fed back to
Browser.Wherein, the concrete operations of the HTTP transmission process of the JSON object of circulation execution parsing every time are as follows: obtain current transmission
The request path of process obtains the requesting method of current transmission process, obtains the response object of current transmission process;Judgement browsing
Whether the request path and requesting method of device are consistent with the request path of current transmission process and requesting method respectively, if so, returning
Head response, answer code and the response contents of current transmission process are returned to browser;Otherwise, feedback error information is to browser.
It should be understood that device provided by the above embodiment is when being operated, only drawing with above-mentioned each functional module
Divide and be illustrated, in practical application, can as needed be completed by different functional modules above-mentioned function distribution, i.e., it will dress
The internal structure set is divided into different functional modules, to complete all or part of the functions described above.
The present invention is not limited to the above-described embodiments, for those skilled in the art, is not departing from
Under the premise of the principle of the invention, several improvements and modifications can also be made, these improvements and modifications are also considered as protection of the invention
Within the scope of.The content being not described in detail in this specification belongs to the prior art well known to professional and technical personnel in the field.
Claims (6)
1. a kind of Web system demenstration method of the disengaging background logic based on HAR, which is characterized in that this method includes following step
It is rapid:
The Web system for installing and running successful deployment obtains the access address of Web system;
Corresponding Web page is opened according to the access address of Web system, and starts the included developer's tool of browser;
Various functions operation is carried out in open Web page, the various HTTP for collecting browser in various functions operation are passed
Defeated procedural information;
Exploitation person's tool, the various HTTP transmission process information preservations that browser was collected are har file;
HTTP server socket is created, and server socket is arranged are as follows: is asked whenever server socket receives browser
When asking, just using the har file of preservation as data source, circulation executes all HTTP transmission processes in har file, and by result
Feed back to browser;
By the address binding of the server socket set to the machine address, starts HTTP server and demonstrated;It demonstrated
Cheng Zhong is realized according to the server socket set;
The HTTP transmission process information includes the data information issued in each HTTP transmission process and the data information received;
Wherein, the data information of sending includes request header, request body, and the data information received includes in head response, answer code and response
Hold;
It is described when server socket receives browse request, just using the har file of preservation as data source, circulation execute
All HTTP transmission processes in har file, and result is fed back into browser, specifically include following operation:
1) when server socket receives browse request, the request path and requesting method of current browser are obtained;
2) this document Context resolution is JSON object by the har file for obtaining the preservation;
3) according to the request path and requesting method of the current browser got, circulation executes the HTTP of the JSON object of parsing
Transmission process, and result is fed back into browser.
2. the Web system demenstration method of the disengaging background logic based on HAR as described in claim 1, it is characterised in that: every time
Circulation executes the HTTP transmission process of the JSON object of parsing, specifically includes following operation:
301) request path of current transmission process is obtained;Obtain the requesting method of current transmission process;Obtain current transmission mistake
The response object of journey;
302) judge browser request path and requesting method whether respectively with the request path of current transmission process and request
Method is consistent, if so, being transferred to step 303;Otherwise, feedback error information is to browser;
303) head response, answer code and the response contents of current transmission process are returned to browser.
3. the Web system demenstration method of the disengaging background logic based on HAR as described in any one of claims 1 to 2, special
Sign is: when carrying out various functions operation in open Web page, Web system is covered in the various functions operation carried out
Each function.
4. a kind of Web system apparatus for demonstrating for the disengaging background logic based on HAR for realizing claim 1 the method, special
Sign is: the device includes that access address obtains module, Web page opens module, transmission process information search module, har text
Module is realized in part generation module, server socket creation module and Web demonstration;
The access address obtains module and is used for: after installing and running the Web system of successful deployment, obtaining Web system
Access address;
The Web page is opened module and is used for: opening corresponding Web page according to the access address of Web system, and starts browser
Included developer's tool;
The transmission process information search module is used for: being carried out various functions operation in open Web page, is searched browser
Collect the various HTTP transmission process information in various functions operation;
The har file generating module is used for: exploitation person's tool, the various HTTP transmission process information preservations that will be collected
For har file;
The server socket creation module is used for: creation HTTP server socket, and server socket is arranged are as follows:
When server socket receives browse request, just using the har file of preservation as data source, circulation executes har file
In all HTTP transmission processes, and result is fed back into browser;
The Web demonstration realizes that module is used for: by the address binding of the server socket set to the machine address, starting
HTTP server is demonstrated;In presentation process, realized according to the server socket set;
The HTTP transmission process information includes the data information issued in each HTTP transmission process and the data information received;
Wherein, the data information of sending includes request header, request body, and the data information received includes in head response, answer code and response
Hold;
Server socket specifically is set as operating according to following content by the server socket creation module: whenever
When server socket receives browse request, the request path and requesting method of current browser are first obtained;It obtains again described
This document Context resolution is JSON object by the har file of preservation;Finally, according to the request road of the current browser got
Diameter and requesting method, circulation execute the HTTP transmission process of the JSON object of parsing, and result is fed back to browser.
5. the Web system apparatus for demonstrating of the disengaging background logic based on HAR as claimed in claim 4, it is characterised in that: every time
Circulation executes the concrete operations of the HTTP transmission process of the JSON object of parsing are as follows: the request path of current transmission process is obtained,
The requesting method of current transmission process is obtained, the response object of current transmission process is obtained;Judge browser request path and
Whether requesting method is consistent with the request path of current transmission process and requesting method respectively, if so, returning to current transmission process
Head response, answer code and response contents to browser;Otherwise, feedback error information is to browser.
6. the Web system apparatus for demonstrating of the disengaging background logic based on HAR as described in any one of claim 4 to 5, special
Sign is: when the transmission process information search module carries out various functions operation in open Web page, what is carried out is each
Each function of Web system is covered in item feature operation.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710031608.4A CN106777348B (en) | 2017-01-17 | 2017-01-17 | The Web system demenstration method and device of disengaging background logic based on HAR |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710031608.4A CN106777348B (en) | 2017-01-17 | 2017-01-17 | The Web system demenstration method and device of disengaging background logic based on HAR |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106777348A CN106777348A (en) | 2017-05-31 |
CN106777348B true CN106777348B (en) | 2019-10-25 |
Family
ID=58945982
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710031608.4A Expired - Fee Related CN106777348B (en) | 2017-01-17 | 2017-01-17 | The Web system demenstration method and device of disengaging background logic based on HAR |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106777348B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1241131C (en) * | 2000-11-30 | 2006-02-08 | 国际商业机器公司 | Method for providing resource from network server to client computer |
CN1799051A (en) * | 2003-06-03 | 2006-07-05 | 株式会社爱可信 | Method for browsing contents using page storing file |
-
2017
- 2017-01-17 CN CN201710031608.4A patent/CN106777348B/en not_active Expired - Fee Related
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1241131C (en) * | 2000-11-30 | 2006-02-08 | 国际商业机器公司 | Method for providing resource from network server to client computer |
CN1799051A (en) * | 2003-06-03 | 2006-07-05 | 株式会社爱可信 | Method for browsing contents using page storing file |
Non-Patent Citations (1)
Title |
---|
神器——Chrome开发者工具(一);segmentfault;《https://segmentfault.com/a/1190000000683599》;20150403;第1-3页 * |
Also Published As
Publication number | Publication date |
---|---|
CN106777348A (en) | 2017-05-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103984745B (en) | Distributed video method for vertical search and system | |
WO2016177250A1 (en) | Client page rendering method and apparatus | |
CN105183912B (en) | Abnormal log determines method and apparatus | |
US8468145B2 (en) | Indexing of URLs with fragments | |
CN103246678B (en) | A kind of web page content preview method and apparatus | |
WO2012155593A1 (en) | Method and system for performing local invocation with webpage | |
CN106096050A (en) | A kind of method and apparatus of video contents search | |
US8332467B2 (en) | Lightweight RRD extension framework | |
CN103699635B (en) | Information processing method and device | |
CN108228743A (en) | Real-time big data search engine system | |
US6829619B1 (en) | Information providing server | |
CN114816499A (en) | Electronic resource sharing method and device and storage medium | |
US8271472B2 (en) | System and method for exposing both portal and web content within a single search collection | |
KR102009020B1 (en) | Method and apparatus for providing website authentication data for search engine | |
US10235455B2 (en) | Semantic search system interface and method | |
CN101201833A (en) | System and method for filling PDF document data | |
KR101331854B1 (en) | Apparatus and method for search Open API and generation mashup block skeleton code | |
CN101789901B (en) | Accelerating method and device of transmitting system positioned on multinuclear platform | |
US20140074814A1 (en) | Method and apparatus for switching search engine to repeat search | |
CN105989010B (en) | Web page data generation method, Web server and Web application system | |
CN106993041A (en) | A kind of power marketing moves work data synchronous method | |
US8666951B2 (en) | Managing multiple versions of enterprise meta-models using semantic based indexing | |
CN106777348B (en) | The Web system demenstration method and device of disengaging background logic based on HAR | |
CN107229653A (en) | Pseudo- static Web page generation method and device | |
JP2011523134A (en) | Incremental patrol of multiple content providers using aggregation |
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 | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20191025 Termination date: 20200117 |
|
CF01 | Termination of patent right due to non-payment of annual fee |