CN106126663B - Page aggregation method and device - Google Patents
Page aggregation method and device Download PDFInfo
- Publication number
- CN106126663B CN106126663B CN201610489019.6A CN201610489019A CN106126663B CN 106126663 B CN106126663 B CN 106126663B CN 201610489019 A CN201610489019 A CN 201610489019A CN 106126663 B CN106126663 B CN 106126663B
- Authority
- CN
- China
- Prior art keywords
- page
- fragment
- rendering
- preset
- 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.)
- Active
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/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 embodiment of the invention provides a page aggregation method and a page aggregation device, and relates to the field of network page creation. The page aggregation method comprises the following steps: receiving an acquisition request for acquiring a preset page sent by mobile equipment, and acquiring page resources of the preset page from a page server; inquiring an adaptation format corresponding to the page master of the preset page according to the corresponding relation between the pre-stored page master and the adaptation format, and assembling each page fragment of the preset page according to the inquired adaptation format to obtain an assembled page; and feeding back the assembly page to the mobile equipment. The page master of the preset webpage fed back by the page server is converted into the adaptation format designed by using FreeMarker, the page fragments of the preset webpage are assembled according to the adaptation format, and a new assembled page is generated, so that the effect of avoiding the phenomenon that the display of the aggregation page created by the iframe is abnormal is achieved.
Description
Technical Field
The present invention relates to the field of web page creation, and in particular, to a page aggregation method and apparatus.
Background
The page aggregation refers to re-integrating the page layout of the original page to generate a new page. The pages of each function can be recombined to form a new page through page aggregation, and Search Engine Optimization (SEO) Optimization and multi-service-line pull-through operation of the site to which the pages belong are promoted.
Related page aggregation technologies generally use iframe elements of hypertext Markup Language (HTML) to create an inline frame, and the inline frame can aggregate contents of a plurality of other pages into one page, so as to achieve the purpose of page aggregation.
However, the iframe element has compatibility problems with a browser in the mobile device, for example, when the iframe element is incompatible with the browser, the problems that a scroll bar in an aggregated page created by ifrme cannot be displayed, the size of the aggregated page adaptive mobile phone screen is complicated, and the like can be caused.
Disclosure of Invention
In order to solve the problems of the related art, embodiments of the present invention provide a page aggregation method and apparatus. The technical scheme is as follows:
in a first aspect, a page aggregation method is provided, and is applied to a background server, where the method includes: receiving an acquisition request for acquiring a preset page sent by mobile equipment, and acquiring page resources of the preset page from a page server, wherein the page resources at least comprise a page master mask and page fragments of the preset page, and the page master mask is used for defining the positions of the page fragments in the preset page; inquiring an adaptation format corresponding to a page master of the preset page according to a corresponding relation between a prestored page master and the adaptation format, and assembling each page fragment of the preset page according to the inquired adaptation format to obtain an assembled page, wherein the adaptation format is a page format designed by utilizing Freemaker; and feeding back the assembly page to the mobile equipment.
According to the page aggregation method provided by the embodiment of the invention, the page master of the preset webpage fed back by the page server is converted into the adaptive format designed by using FreeMarker, and the page fragments of the preset webpage are assembled according to the adaptive format to generate a new assembled page; the effect of avoiding the phenomenon that the display of the aggregation page created by the iframe is abnormal is achieved.
With reference to the first aspect, in a first possible implementation manner of the first aspect, the assembling the page fragments of the predetermined page according to the queried predetermined adaptation format to obtain an assembled page includes: adding the page fragments of the preset page into a page rendering queue; extracting an idle rendering resource thread from a rendering resource thread pool, and rendering the page fragments in the page rendering queue by using the rendering resource thread; and assembling the successfully rendered page fragments according to the adaptive layout to obtain the assembled page. The rendering resource threads are called to render the page fragments in the page rendering queue, so that the number of the rendering resource threads for rendering the page fragments can be effectively controlled, and the phenomenon that the processing pressure of the processor is too large due to too many fragments of the page fragments is avoided.
With reference to the first aspect or the first possible implementation manner of the first aspect, in a second possible implementation manner, the assembling the page fragments of the predetermined page according to the queried predetermined adaptation format to obtain an assembled page includes: for each page fragment in the page resource, detecting whether fragment content corresponding to the page fragment is stored or not; when fragment content corresponding to the page fragment is stored, rendering the page fragment according to the fragment content; and assembling the successfully rendered page fragments according to the adaptive layout to obtain the assembled page.
With reference to the first aspect, the first possible implementation of the first aspect, or the second possible implementation of the first aspect, after the detecting whether fragment content corresponding to the page fragment is stored, the method further includes: when fragment content corresponding to the page fragment is not stored, acquiring fragment content corresponding to the page fragment according to a Uniform Resource Locator (URL) of the page fragment, and rendering the page fragment according to the fragment content; and binding and storing the fragment content and the page fragment. When the fragment content of a certain page fragment is acquired through the background server, the fragment content and the page fragment are bound and stored, and when the page resource acquired by the background server contains the page fragment, the page fragment can be rendered directly according to the stored fragment content of the page fragment, so that the repeated acquisition of the fragment content of the same page fragment is avoided, and the speed of rendering the page fragment is accelerated.
With reference to the first aspect and the first to third possible implementations of the first aspect, in a fourth possible implementation of the first aspect, the binding and storing the fragmented content and the page fragment includes: determining whether the fragmented content is staticizable content; and when the fragment content is staticizable content, binding and storing the fragment content and the page fragment.
With reference to the first aspect and the first to fourth possible implementations of the first aspect, in a fifth possible implementation of the first aspect, the assembling the successfully rendered page fragments according to the adapted layout to obtain the assembled page includes: assembling the successfully rendered page fragments according to the adaptive layout; and determining the position of the page fragment which fails in rendering in the adaptive version, and displaying the preset content at the position. And only assembling the page fragments which are successfully rendered, and uniformly displaying the preset content at the positions of the page fragments which are unsuccessfully rendered in the adaptive version, so that the page assembling speed is accelerated.
With reference to the first aspect and the first to fifth possible implementations of the first aspect, in a sixth possible implementation of the first aspect, the method further includes: after the assembly page is obtained, when the binding relationship between the assembly page corresponding to the preset page and the page resource of the preset page is not stored, the obtained assembly page and the obtained page resource of the preset page are bound and stored; and when the binding relationship between the assembly page corresponding to the preset page and the page resource of the preset page is stored, replacing the stored page resource of the preset page by using the acquired page resource of the preset page. The effectiveness of the binding relation stored in the background server is ensured by storing and updating the binding relation between the assembly page corresponding to the preset page and the page resource of the preset page in time.
With reference to the first aspect and the first to sixth possible implementations of the first aspect, in a seventh possible implementation of the first aspect, after the obtaining the page resource of the predetermined page from the page server, the method further includes: inquiring whether page resources of the preset page are stored or not; when the page resources of the preset page are stored, detecting whether the acquired page resources are consistent with the stored page resources; and when the acquired page resources are consistent with the stored page resources, feeding back the assembled page bound with the stored page resources to the mobile equipment. When the page resource of the preset page is obtained through the background server, if the obtained page resource is consistent with the stored page resource, the assembled page bound with the stored page resource is fed back to the mobile equipment, and the speed of feeding back the assembled page by the background server is improved.
In a second aspect, a server is provided, where the server includes a processor, a memory connected to the processor, and a network interface, and the processor is configured to implement the page aggregation method of the first aspect.
In a third aspect, a page aggregation apparatus is provided, where the page aggregation apparatus includes at least one unit, and the at least one unit is respectively configured to implement corresponding steps involved in the page aggregation method according to the first aspect.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic structural diagram of a page aggregation system according to an exemplary embodiment of the present invention;
FIG. 2 is a block diagram of a backend server provided by an exemplary embodiment of the present invention;
FIG. 3 is a flowchart of a page aggregation method provided by an exemplary embodiment of the present invention;
FIG. 4A is a flowchart of a page aggregation method provided by an exemplary embodiment of the invention;
FIG. 4B is a diagram illustrating a page aggregation method according to an exemplary embodiment of the invention;
fig. 4C is a schematic diagram of a method for assembling page fragments of the predetermined page according to the queried predetermined adaptation format to obtain an assembled page according to an exemplary embodiment of the present invention;
FIG. 4D is a diagram illustrating a method for rendering a page fragment in a page rendering queue by using a rendering resource thread according to an exemplary embodiment of the present invention;
fig. 4E is a flowchart of a method for assembling page fragments of the predetermined page according to the queried predetermined adaptation format to obtain an assembled page according to another exemplary embodiment of the present invention;
fig. 4F is a flowchart of a method for binding and storing fragmented content and page fragments according to an exemplary embodiment of the present invention;
fig. 4G is a flowchart of a method for assembling successfully rendered page fragments according to an adaptive layout to obtain an assembled page according to an exemplary embodiment of the present invention;
FIG. 4H is a schematic illustration of an assembly page provided by an exemplary embodiment of the present invention;
fig. 5A is a schematic structural diagram of a page aggregation apparatus in a backend server according to an embodiment of the present invention;
FIG. 5B is a flowchart of a page aggregation method provided by yet another embodiment of the invention;
fig. 6 is a block diagram of a page aggregation apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
"module" as referred to herein refers to a program or instructions stored in memory that is capable of performing certain functions; reference herein to "a unit" is to a logically partitioned functional structure, and the "unit" may be implemented by pure hardware or a combination of hardware and software.
Referring to fig. 1, a schematic structural diagram of a page aggregation system according to an exemplary embodiment of the present invention is shown. The page aggregation system includes: mobile device 10, background server 11 and page server 12.
The background server 11 may be connected to the mobile device 10 and the page server 12 through a Wireless network or a wired network, or may be connected through a router, where the Wireless network may be a Wireless-Fidelity (Wi-Fi) or a mobile data network, or a Wireless network such as bluetooth.
The mobile device 10 may be a mobile phone, a messaging device, a tablet device, etc., and the present embodiment is not particularly limited.
The background server 11 may be a server, a server cluster composed of several servers, or a cloud computing service center. Similarly, the page server 12 can be a server, a server cluster composed of several servers, or a cloud computing service center.
Referring to fig. 2, a schematic structural diagram of a background server according to an exemplary embodiment of the present invention is shown. The background server 11 includes: a processor 21, a network interface 22, a cache 23, a memory 24, and a bus 25.
The processor 21 includes one or more processing cores, and the processor 21 executes various functional applications and data processing by executing software programs and modules.
The network interface 22 is used for the load generator to communicate with the database system.
The memory 24 and the cache 23 are connected to the processor 21 via a bus 25, respectively.
Memory 24 may be used to store software programs and modules.
The memory 24 may store an application module 26 required for at least one function, and the application module 26 may be a receiving module 261, an executing module 262, a transmitting module 263, and the like.
The receiving module 261 is configured to receive, through the network interface 22, an obtaining request for obtaining a predetermined page sent by the mobile device, and obtain, from the page server, a page resource of the predetermined page, where the page resource includes at least a page master and page fragments of the predetermined page, and the page master is used to define positions of the page fragments in the predetermined page.
The execution module 262 is configured to query an adaptation format corresponding to a page master of a predetermined page according to a correspondence between a pre-stored page master and the adaptation format, and assemble each page fragment of the predetermined page according to the queried adaptation format to obtain an assembled page, where the adaptation format is a page format designed by using a fomac freemaker; adding the page fragments of the preset page into a page rendering queue; extracting an idle rendering resource thread from the rendering resource thread pool, and rendering the page fragments in the page rendering queue by using the rendering resource thread; assembling the successfully rendered page fragments according to the adaptive layout to obtain an assembled page; detecting whether fragment content corresponding to each page fragment in the page resource is stored or not; when fragment content corresponding to the page fragment is stored, rendering the page fragment according to the fragment content; assembling the successfully rendered page fragments according to the adaptive layout to obtain an assembled page; when the fragment content corresponding to the page fragment is not stored, acquiring the fragment content corresponding to the page fragment according to the Uniform Resource Locator (URL) of the page fragment, and rendering the page fragment according to the fragment content; binding and storing the fragment content and the page fragments; judging whether the fragment content is staticizable content or not; when the fragment content is staticizable content, binding and storing the fragment content and the page fragment; assembling the successfully rendered page fragments according to the adaptive layout; determining the position of the page fragment which fails to be rendered in the adaptive version, and displaying predetermined content at the position; after the assembly page is obtained, when the binding relationship between the assembly page corresponding to the preset page and the page resource of the preset page is not stored, the obtained assembly page and the obtained page resource of the preset page are bound and stored; when the binding relationship between the assembly page corresponding to the preset page and the page resource of the preset page is stored, replacing the stored page resource of the preset page by using the acquired page resource of the preset page; inquiring whether page resources of a preset page are stored or not; when the page resources of the preset page are stored, detecting whether the obtained page resources are consistent with the stored page resources; and when the acquired page resources are consistent with the stored page resources, feeding back the assembled page bound with the stored page resources to the mobile equipment.
The sending module 263 is used for feeding back the assembly page to the mobile device through the network interface 22.
The memory 24 may be implemented by any type or combination of volatile or non-volatile memory devices, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
Those skilled in the art will appreciate that the configuration of the backend server shown in fig. 1 does not constitute a limitation of the backend server and may include more or less components than those shown, or some components in combination, or a different arrangement of components.
Referring to fig. 3, a flowchart of a page aggregation method according to an exemplary embodiment of the present invention is shown. The present embodiment is exemplified by using the method in the page aggregation system shown in fig. 1, where the processor 21 of the background server 11 shown in fig. 2 executes the following steps, and the method includes the following steps:
step 301, receiving an obtaining request for obtaining a predetermined page sent by a mobile device, and obtaining a page resource of the predetermined page from a page server, where the page resource includes at least a page master and page fragments of the predetermined page, and the page master is used to define positions of the page fragments in the predetermined page.
Step 302, inquiring an adaptation format corresponding to the page master of the preset page according to a corresponding relation between a pre-stored page master and the adaptation format, and assembling each page fragment of the preset page according to the inquired adaptation format to obtain an assembled page, wherein the adaptation format is a page format designed by using FreeMarker.
Step 303, feeding back the assembly page to the mobile device.
In summary, in the page aggregation method provided in the embodiment of the present invention, the page master of the predetermined webpage fed back by the page server is converted into the adaptation format designed by using the FreeMarker, and the page fragments of the predetermined webpage are assembled according to the adaptation format to generate a new assembly page, because the FreeMarker has high universality and a strong template language, the problem that the display of the aggregation page created by the iframe is abnormal because the iframe element is incompatible with the browser is solved; the effect of avoiding the phenomenon that the display of the aggregation page created by the iframe is abnormal is achieved.
In practical application, the page aggregation technology generally uses an iframe element of HTML to create an inline frame, and aggregates contents of a plurality of other pages into one page, so as to achieve the purpose of page aggregation. In order to avoid the phenomenon that the aggregated page created by the iframe displays abnormally when the iframe element is incompatible with the browser in the mobile device, in this embodiment, the background server converts the page master of the predetermined webpage fed back by the page server into an adaptation format designed by using Freemarker, assembles the page fragments of the predetermined page according to the adaptation format, generates a new assembly page, and feeds back the new assembly page to the mobile device, so as to avoid the phenomenon that the aggregated page created by the iframe displays abnormally. The page polymerization method is described below with reference to fig. 4A, 4E, 4F, and 4G.
Referring to fig. 4A, a flowchart of a page aggregation method according to an exemplary embodiment of the present invention is shown. The present embodiment is exemplified by applying the method to the page aggregation system shown in fig. 1, and the method includes the following steps:
step 401, receiving an obtaining request for obtaining a predetermined page sent by a mobile device, and obtaining a page resource of the predetermined page from a page server.
The page resource at least comprises a page master and page fragments of the preset page. The preset page refers to an HTML page formed by assembling page fragments according to the page master. The page master refers to a finished webpage frame for defining the position of each page fragment in the preset page. The page fragment refers to a dynamic web page technical standard file (English: Java Server Pages, JSP), and in an HTML page, the JSP file contains the position information of the page fragment and each page fragment. Each page fragment is composed of a template file and a Java object, wherein the template file comprises styles, pictures, script files and the like, and the corresponding static file is automatically output through a template engine technology.
Step 402, inquiring whether page resources of a preset page are stored.
And the background server acquires the page resource of the preset page from the page server and stores the page resource of the preset page.
After the background server obtains the page resource of the predetermined page from the page server, it is queried whether the page resource of the predetermined page is stored, and when the background server does not store the page resource of the predetermined page, steps 403 to 405 are executed.
In a possible implementation manner, when the background server does not store the page resource of the predetermined page, steps 403 to 405 are performed.
Step 403, when the background server does not store the page resource of the predetermined page, querying an adaptation format corresponding to the page master of the predetermined page according to a correspondence between a pre-stored page master and the adaptation format, and assembling each page fragment of the predetermined page according to the queried adaptation format to obtain an assembled page.
The adaptation format is stored in the background server in advance by a webpage worker, and is a page format designed by using FreeMarker.
Fig. 4B is a schematic diagram of a page aggregation method according to an exemplary embodiment of the present invention, as shown in fig. 4B, when a background server 11 receives an acquisition request for acquiring a predetermined page 30 sent by a mobile device 10, the background server 11 acquires a page resource 40 of the predetermined page 30 from a page server 12, queries an adaptation format 42 corresponding to a page master 41 of the predetermined page 30 according to a correspondence between a pre-stored page master and the adaptation format, and assembles page fragments (a, B, C, and D) of the predetermined page 30 according to the queried adaptation format 41 to obtain an assembled page 50.
When the background server does not store the page resource of the predetermined page, it indicates that the background server may receive, for the first time, an acquisition request for acquiring the predetermined page sent by the mobile device. Since the background server does not store the binding relationship between the assembly page corresponding to the predetermined page and the page resource of the predetermined page, after the assembly page is obtained, step 404 may be executed.
And step 404, binding and storing the obtained assembly page and the obtained page resource of the preset page.
Still referring to fig. 4B, when the backend server 11 obtains the assembly page 50, the obtained assembly page 50 and the obtained page resource 40 of the predetermined page 30 are bound and stored.
Step 405, feeding back the assembly page to the mobile device.
In another possible implementation manner, when the background server stores the page resource of the predetermined page, steps 406 to 407 are performed.
Step 406, when the page resource of the predetermined page is stored, detecting whether the acquired page resource is consistent with the stored page resource.
As needed, a web page worker usually updates a page periodically, and a page resource of the updated web page may be changed, such as a page master change or a page fragment change. When the background server detects that the page resource of the predetermined page is stored, in order to ensure the validity of the stored page resource of the predetermined page, it is required to detect whether the acquired page resource of the predetermined page is consistent with the stored page resource of the predetermined page.
Step 407, when the acquired page resource is consistent with the stored page resource, feeding back the assembled page bound with the stored page resource to the mobile device.
When the acquired page resource of the preset page is consistent with the stored page resource of the preset page, it is indicated that the page resource of the preset page is not changed, and the page resource of the preset page stored by the background server is effective, so that the background server can feed back the assembled page bound with the stored page resource to the mobile device, and the speed of feeding back the assembled page to the mobile device by the background server is improved.
Step 408, when the acquired page resource is inconsistent with the stored page resource, inquiring an adaptation format corresponding to the page master of the preset page according to the corresponding relation between the pre-stored page master and the adaptation format, and assembling each page fragment of the preset page according to the inquired adaptation format to obtain an assembled page.
Optionally, when the background server detects that the acquired page resource is inconsistent with the stored page resource, it indicates that the background server has stored the binding relationship between the assembled page corresponding to the predetermined page and the page resource of the predetermined page. To ensure the validity of the page resources of the stored predefined page, step 409 is performed when the backend server gets the assembled page.
And step 409, replacing the stored page resource of the preset page with the acquired page resource of the preset page.
In summary, in the page aggregation method provided in the embodiment of the present invention, the page master of the predetermined webpage fed back by the page server is converted into the adaptation format designed by using the FreeMarker, and the page fragments of the predetermined webpage are assembled according to the adaptation format to generate a new assembly page, because the FreeMarker has high universality and a strong template language, the problem that the display of the aggregation page created by the iframe is abnormal because the iframe element is incompatible with the browser is solved; the effect of avoiding the phenomenon that the display of the aggregation page created by the iframe is abnormal is achieved.
In this embodiment, the validity of the binding relationship stored in the background server is ensured by storing and updating the binding relationship between the assembled page corresponding to the predetermined page and the page resource of the predetermined page in time.
In this embodiment, when the page resource of the predetermined page is acquired through the background server, if the acquired page resource is consistent with the stored page resource, the assembled page bound to the stored page resource is fed back to the mobile device, so that the speed of feeding back the assembled page by the background server is increased.
Under a possible implementation condition, the background server controls the number of rendering resource threads for rendering the page fragments by calling the rendering resource threads to render the page fragments in the page rendering queue, so that the excessive fragments of the page fragments are avoided to cause the overlarge processing pressure of the processor. Referring to fig. 4C, fig. 4C is a schematic diagram of a method for assembling page fragments of the predetermined page according to the queried predetermined adaptation format to obtain an assembled page according to an exemplary embodiment of the present invention.
Step 408a, adding the page fragments of the predetermined page to the page rendering queue.
And after the background server acquires the page fragments of the preset page, adding the page fragments to be rendered into a page rendering queue.
And step 408b, extracting an idle rendering resource thread from the rendering resource thread pool, and rendering the page fragments in the page rendering queue by using the rendering resource thread.
Optionally, one rendering resource thread renders a block of page fragments.
Fig. 4D is a schematic diagram of a method for rendering a page fragment in a page rendering queue by using a rendering resource thread according to an exemplary embodiment of the present invention, as shown in fig. 4D, when a user accesses a preset page by using the mobile terminal, the background server receives an acquisition request for acquiring the preset page sent by the preset page, the background server acquires the page resources of the preset page from the page server, adds the page fragments (page fragment A, page fragment B and page fragment C) of the preset page into a page rendering queue, extracting idle rendering resource threads (rendering resource thread 1 and rendering resource thread 2) from the rendering resource thread pool, calling the extracted idle rendering resource threads to render the page fragments in the page rendering queue, because the number of rendering resource threads is 2, the background server can render two page fragments at a time.
After the page fragments are rendered (the page fragments may be rendered successfully or unsuccessfully), the background server puts the rendering resource threads rendering the page fragments back into the rendering resource thread pool for use by other unrendered page fragments.
And 408c, assembling the successfully rendered page fragments according to the adaptive layout to obtain an assembled page.
The background server only assembles the page fragments which are successfully rendered, and uniformly displays the preset content at the positions of the page fragments which are not successfully rendered in the adaptive version, so that the page assembling speed can be increased.
In a possible implementation manner, please refer to fig. 4E, where fig. 4E is a flowchart of a method for assembling page fragments of the predetermined page according to the queried predetermined adaptation format, so as to obtain an assembled page according to another exemplary embodiment of the present invention.
Step 408d, for each page fragment in the page resource, detecting whether fragment content corresponding to the page fragment is stored.
When the background server acquires the page resource of the preset page, whether fragment content corresponding to the page fragment is stored is inquired.
Optionally, when the fragment content corresponding to the page fragment is not stored, step 408g to step 408h are implemented.
And step 408e, when the fragment content corresponding to the page fragment is not stored, acquiring the fragment content corresponding to the page fragment according to the URL of the page fragment, and rendering the page fragment according to the fragment content.
And when the fragment content corresponding to the page fragment is not stored, the background server acquires the fragment content corresponding to the page fragment from the page server according to the URL of the page fragment, and renders the page fragment according to the fragment content.
And step 408f, binding and storing the fragment content and the page fragment.
Fig. 4F is a flowchart of a method for binding and storing fragmented content and page fragments according to an exemplary embodiment of the present invention. As shown in fig. 4F, step 408F may be replaced by steps 408F1 through 408F 2.
Step 408f1, determine if the fragmented content is staticizable content.
Optionally, the staticizable content is content unrelated to the user account.
In step 408f2, when the fragmented content is staticizable content, the fragmented content is bound to the page fragment for storage.
Optionally, when the background server stores the fragment content corresponding to the page fragment, steps 408g to 408h are implemented.
And step 408g, when the fragment content corresponding to the page fragment is stored, rendering the page fragment according to the fragment content.
When the page resource acquired by the background server contains the page fragment with the stored fragment content, the background server can directly render the page fragment according to the stored fragment content of the page fragment, so that the repeated acquisition of the fragment content of the same page fragment is avoided, and the speed of rendering the page fragment is increased.
And 408h, assembling the successfully rendered page fragments according to the adaptive layout to obtain an assembled page.
It should be noted that step 408h is similar to step 408c, and the description of step 408h is not repeated here.
Fig. 4G is a flowchart of a method for assembling successfully rendered page fragments according to an adaptive layout to obtain an assembled page according to an exemplary embodiment of the present invention. As shown in fig. 4G, step 408h may be replaced by step 408h1 through step 408h 2.
And step 408h1, assembling the successfully rendered page fragments according to the adaptive layout.
Step 408h2, determining the position of the rendering-failed page fragment in the adapted version, and displaying the predetermined content at the position.
Fig. 4H is a schematic diagram of an assembled page according to an exemplary embodiment of the present invention, as shown in fig. 4H, after the background server fails to render the page fragment D, the background server determines a position 61 of the page fragment D in the adapted version 60 according to information in the page fragment D, and displays a predetermined content "content acquisition failure.
Referring to fig. 5A, a schematic structural diagram of a page aggregation apparatus in a backend server according to an embodiment of the present invention is shown. The page aggregation device includes: the system comprises a uniform page editing system, a page aggregation module, a functional portal and user uniform session management.
The unified page editing system acquires a page motherboard and page fragments of a preset page from an editing system database, and sends the acquired page motherboard and page fragments to a page aggregation module. When the page fragments and the page mother board are newly added/modified in the page editing system, the unified page editing system sends a change notice to the page aggregation module.
The page aggregation module realizes the management of the preset pages, the page fragments and the page mother board. One page aggregation module corresponds to one site in the unified page editing system.
The functional portal is used for realizing functions of rendering of page fragments of a preset page, customizing of a business functional data source and the like.
The user unified session management is used for implementing unified management of user sessions, so that the page aggregation module and each functional portal uniformly share user session information, where the user session information is information related to a user, such as: user name, user password, user profile, etc.
The page aggregation module comprises the following functions: page adaptation, distributed page rendering scheduling, page fragment rendering, and page fragment assembly.
The page adaptation function is used for realizing the adaptation filtering of the user request page, including the adaptation from the logic page to the actual page, the adaptation of the user access page authority and the recording of the user page access ticket.
The distributed page rendering scheduling function is used for realizing the concurrent execution of page rendering, and dynamically scheduling rendering resource threads to execute the page fragment rendering process according to the number of page fragments. When a user accesses a page, all page fragments in the page are constructed into a page rendering queue to request a rendering scheduling thread to apply for rendering, the scheduling thread extracts an idle rendering resource thread from a rendering resource thread pool according to the number of the fragments to be rendered, and the rendering process is executed on the fragments in the page rendering queue by using the rendering resource thread.
And the page fragment rendering function is used for realizing format adaptation of the page fragments, requesting the functional portal to finish page rendering, identifying the finished rendering of the page fragments in a page rendering queue, and storing the rendering results of the page fragments.
And the page fragment assembling function is used for assembling the page fragments after rendering of all the page fragments in the page rendering queue is finished after the rendering of the rendering resource thread is started in the rendering scheduling, and if fragment rendering fails, continuing throwing rendering abnormity (capturing abnormity and jumping to an error page by a male cat Apache Tomcat). And assembling and merging the page fragment rendering results according to the page rendering queue sequence, not assembling the page fragments with rendering failure (blanks may exist in the page), and returning the assembled page to the user.
Referring to fig. 5B, a flowchart of a page aggregation method according to still another embodiment of the present invention is shown, where the page aggregation method is exemplified by being applied to a page aggregation apparatus in a backend server shown in fig. 5A, and the method includes:
step 501, a page aggregation module receives an acquisition request for acquiring a predetermined page sent by a mobile device.
Step 502, the page aggregation module acquires the page resource of the predetermined page from the page server according to the acquisition request.
Step 503, the page aggregation module adds the page fragments of the predetermined page to the page rendering queue, extracts an idle rendering resource thread from the rendering resource thread pool, and renders the page fragments in the page rendering queue by using the rendering resource thread.
Step 504, the page aggregation module queries an adaptation format corresponding to the page master of the predetermined page according to a correspondence between the pre-stored page master and the adaptation format.
Step 505, for each page fragment in the page resource, the page aggregation module detects whether the static fragment cache stores the fragment content corresponding to the page fragment.
Step 506, when the fragment content corresponding to the page fragment is not stored, the page aggregation module obtains the fragment content corresponding to the page fragment from the functional portal according to the URL of the page fragment.
In step 507, when the fragment content fed back by the functional portal is staticizable content, the page aggregation module binds and stores the fragment content and the page fragment.
And step 508, rendering the page fragment by the page aggregation module according to the fragment content.
In step 509, after all the page fragments of the predetermined page are rendered, the page aggregation module assembles each successfully rendered page fragment of the predetermined page according to the inquired adaptive format to obtain an assembled page.
Step 510, the page convergence module records the page access ticket.
Optionally, the page access ticket is a click rate of each page fragment of the predetermined page.
And 511, feeding back the assembled page to the mobile terminal by the page aggregation module.
Referring to fig. 6, a block diagram of a page aggregation apparatus according to an embodiment of the present invention is shown. The page aggregation means may be implemented by software, hardware or a combination of both as all or part of the background server 11. The page aggregation apparatus may include: a receiving unit 601, an executing unit 602, and a transmitting unit 603.
A receiving unit 601, configured to implement the function of step 301.
An executing unit 602, configured to implement the function of step 302 described above.
A sending unit 603, configured to implement the function of step 303.
Reference may be made in connection with the above-described method embodiments.
In another alternative embodiment, the execution unit 602 is configured to implement the function of at least one of the steps 401.
It should be noted that the receiving unit 601 may be implemented by a processor of the load generator 110 executing a receiving module in a memory; the execution unit 602 may be implemented by a processor of the load generator 110 executing an execution module in a memory; the transmitting unit 603 may be implemented by a processor of the load generator 110 executing a transmitting module in a memory.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.
Claims (14)
1. The page aggregation method is applied to a background server, and comprises the following steps:
receiving an acquisition request for acquiring a preset page sent by mobile equipment, and acquiring page resources of the preset page from a page server, wherein the page resources at least comprise a page master mask and page fragments of the preset page, and the page master mask is used for defining the positions of the page fragments in the preset page;
adding each page fragment of the preset page into a page rendering queue;
extracting idle rendering resource threads from a rendering resource thread pool according to the number of the page fragments, and rendering the page fragments in the page rendering queue by using the rendering resource threads, wherein each rendering resource thread is used for rendering one page fragment;
inquiring an adaptive format corresponding to the page master of the preset page according to the corresponding relation between the pre-stored page master and the adaptive format;
assembling each successfully rendered page fragment of the preset page according to the inquired adaptation format to obtain an assembled page, wherein the adaptation format is a page format designed by utilizing FreMak FreeMarker;
and feeding back the assembly page to the mobile equipment.
2. The method of claim 1, wherein the rendering the page fragments in the page rendering queue using the rendering resource thread comprises:
for each page fragment in the page resource, detecting whether fragment content corresponding to the page fragment is stored or not;
and when fragment content corresponding to the page fragments is stored, rendering the page fragments in the page rendering queue by using the rendering resource thread according to the fragment content.
3. The method of claim 2, wherein after the detecting whether fragmented content corresponding to the page fragment is stored, the method further comprises:
when fragment content corresponding to the page fragment is not stored, acquiring fragment content corresponding to the page fragment according to a Uniform Resource Locator (URL) of the page fragment, and rendering the page fragment in the page rendering queue according to the fragment content by using the rendering resource thread;
and binding and storing the fragment content and the page fragment.
4. The method of claim 3, wherein the binding and storing the fragmented content and the page fragment comprises:
determining whether the fragmented content is staticizable content;
and when the fragment content is staticizable content, binding and storing the fragment content and the page fragment.
5. The method according to any one of claims 1 to 4, wherein the assembling of the successfully rendered page fragments of the predetermined page according to the queried adapted layout comprises:
assembling the successfully rendered page fragments according to the adaptive layout;
and determining the position of the page fragment which fails in rendering in the adaptive version, and displaying the preset content at the position.
6. The method according to any one of claims 1-4, further comprising:
after the assembly page is obtained, when the binding relationship between the assembly page corresponding to the preset page and the page resource of the preset page is not stored, the obtained assembly page and the obtained page resource of the preset page are bound and stored;
and when the binding relationship between the assembly page corresponding to the preset page and the page resource of the preset page is stored, replacing the stored page resource of the preset page by using the acquired page resource of the preset page.
7. The method according to any of claims 1-4, wherein after said obtaining page resources of said predetermined page from a page server, said method further comprises:
inquiring whether page resources of the preset page are stored or not;
when the page resources of the preset page are stored, detecting whether the acquired page resources are consistent with the stored page resources;
and when the acquired page resources are consistent with the stored page resources, feeding back the assembled page bound with the stored page resources to the mobile equipment.
8. A page aggregation device is applied to a background server, and the device comprises:
a receiving unit, configured to receive an acquisition request for acquiring a predetermined page sent by a mobile device, and acquire a page resource of the predetermined page from a page server, where the page resource includes at least a page master and page fragments of the predetermined page, and the page master is used to define positions of the page fragments in the predetermined page;
the execution unit is used for adding each page fragment of the preset page into a page rendering queue; extracting idle rendering resource threads from a rendering resource thread pool according to the number of the page fragments, and rendering the page fragments in the page rendering queue by using the rendering resource threads, wherein each rendering resource thread is used for rendering one page fragment;
the execution unit is further configured to query an adaptation format corresponding to the page master of the predetermined page according to a corresponding relationship between a pre-stored page master and the adaptation format, and assemble each successfully rendered page fragment of the predetermined page according to the queried adaptation format to obtain an assembled page, where the adaptation format is a page format designed by using a Forry Mark FreeMarker;
and the sending unit is used for feeding back the assembly page to the mobile equipment.
9. The apparatus of claim 8, wherein the execution unit is further configured to:
for each page fragment in the page resource, detecting whether fragment content corresponding to the page fragment is stored or not;
and when fragment content corresponding to the page fragments is stored, rendering the page fragments in the page rendering queue by using the rendering resource thread according to the fragment content.
10. The apparatus of claim 9, wherein the execution unit is further configured to:
after detecting whether fragment content corresponding to the page fragment is stored or not, when the fragment content corresponding to the page fragment is not stored, acquiring the fragment content corresponding to the page fragment according to a Uniform Resource Locator (URL) of the page fragment, and rendering the page fragment in the page rendering queue according to the fragment content by using the rendering resource thread;
and binding and storing the fragment content and the page fragment.
11. The apparatus of claim 10, wherein the execution unit is further configured to:
determining whether the fragmented content is staticizable content;
and when the fragment content is staticizable content, binding and storing the fragment content and the page fragment.
12. The apparatus according to any of claims 8-11, wherein the execution unit is further configured to:
assembling the successfully rendered page fragments according to the adaptive layout;
and determining the position of the page fragment which fails in rendering in the adaptive version, and displaying the preset content at the position.
13. The apparatus according to any of claims 8-11, wherein the execution unit is further configured to:
after the assembly page is obtained, when the binding relationship between the assembly page corresponding to the preset page and the page resource of the preset page is not stored, the obtained assembly page and the obtained page resource of the preset page are bound and stored;
and when the binding relationship between the assembly page corresponding to the preset page and the page resource of the preset page is stored, replacing the stored page resource of the preset page by using the acquired page resource of the preset page.
14. The apparatus according to any of claims 8-11, wherein the execution unit is further configured to:
after the page resource of the preset page is obtained from the page server, inquiring whether the page resource of the preset page is stored or not;
when the page resources of the preset page are stored, detecting whether the acquired page resources are consistent with the stored page resources;
and when the acquired page resources are consistent with the stored page resources, feeding back the assembled page bound with the stored page resources to the mobile equipment.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610489019.6A CN106126663B (en) | 2016-06-28 | 2016-06-28 | Page aggregation method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610489019.6A CN106126663B (en) | 2016-06-28 | 2016-06-28 | Page aggregation method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106126663A CN106126663A (en) | 2016-11-16 |
CN106126663B true CN106126663B (en) | 2019-12-24 |
Family
ID=57285139
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610489019.6A Active CN106126663B (en) | 2016-06-28 | 2016-06-28 | Page aggregation method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106126663B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108153798B (en) * | 2016-12-02 | 2022-02-18 | 阿里巴巴集团控股有限公司 | Page information processing method, device and system |
CN108021666A (en) * | 2017-12-04 | 2018-05-11 | 北京百度网讯科技有限公司 | Page adaptation method and apparatus |
CN110968989B (en) * | 2018-09-27 | 2023-03-31 | 北京国双科技有限公司 | Method and device for displaying error correction information on front-end page |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9712560B2 (en) * | 2007-11-05 | 2017-07-18 | Cabara Software Ltd. | Web page and web browser protection against malicious injections |
CN104021131B (en) * | 2013-03-01 | 2017-08-08 | ***通信集团浙江有限公司 | A kind of dissemination method, the apparatus and system of the various dimensions page |
CN103488732A (en) * | 2013-09-17 | 2014-01-01 | 北京思特奇信息技术股份有限公司 | Generation method and device of static pages |
CN103761317B (en) * | 2014-01-27 | 2017-08-29 | 北京京东尚科信息技术有限公司 | A kind of asynchronous rendering system of multithreading and method |
CN104951287B (en) * | 2014-03-26 | 2018-09-11 | 可牛网络技术(北京)有限公司 | A kind of method and device generating webpage |
-
2016
- 2016-06-28 CN CN201610489019.6A patent/CN106126663B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN106126663A (en) | 2016-11-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109582303B (en) | General component calling method, device, computer equipment and storage medium | |
CN110263275B (en) | Method and device for accessing webpage, mobile terminal and storage medium | |
US11184465B2 (en) | Network communication for establishing a QUIC connection | |
CN112073405A (en) | Webpage data loading method and device, computer equipment and storage medium | |
US10158691B2 (en) | Method and apparatus for providing network resources at intermediary server | |
CN106126663B (en) | Page aggregation method and device | |
CN108255708B (en) | Method, device, storage medium and equipment for accessing production file in test environment | |
US20150149888A1 (en) | Systems and methods for executing aspects of a document | |
US20140189049A1 (en) | Cross domain communication channel | |
EP3896940A1 (en) | Resource description file processing, and page resource obtaining method and device | |
US10291718B2 (en) | Method and apparatus for implementing communication from web page to client | |
CN114237651A (en) | Installation method and device of cloud native application, electronic equipment and medium | |
US20160004850A1 (en) | Secure download from internet marketplace | |
US20180285467A1 (en) | Web server | |
CN104123143A (en) | User control loading system and method | |
CN112818270B (en) | Data cross-domain transfer method and device and computer equipment | |
US20210365520A1 (en) | Webpage loading method, intermediate server and webpage loading system | |
CN112672187B (en) | Page generation method and device, computer equipment and readable storage medium | |
CN111800511B (en) | Synchronous login state processing method, system, equipment and readable storage medium | |
JP5535184B2 (en) | Browser execution script conversion system and browser execution script conversion program | |
CN104317819A (en) | Method and system for webpage cross-domain communication based on browsers | |
CN106648610B (en) | Method and device for remotely calling and responding functional interface | |
CN112565472B (en) | Static resource processing method and device | |
CN109101429B (en) | Method and device for debugging browser page of set top box | |
CN113391855A (en) | Information processing method and device and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right |
Effective date of registration: 20200211 Address after: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen Patentee after: HUAWEI TECHNOLOGIES Co.,Ltd. Address before: 210000 Ande Gate No. 94, Yuhuatai District, Jiangsu, Nanjing Patentee before: Huawei Technologies Co.,Ltd. |
|
TR01 | Transfer of patent right |