CN113467855A - Webpage request processing method and device, electronic equipment and storage medium - Google Patents

Webpage request processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113467855A
CN113467855A CN202110703353.8A CN202110703353A CN113467855A CN 113467855 A CN113467855 A CN 113467855A CN 202110703353 A CN202110703353 A CN 202110703353A CN 113467855 A CN113467855 A CN 113467855A
Authority
CN
China
Prior art keywords
parameter information
request
target
webpage
interface identifier
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
CN202110703353.8A
Other languages
Chinese (zh)
Other versions
CN113467855B (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 Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information 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 Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202110703353.8A priority Critical patent/CN113467855B/en
Publication of CN113467855A publication Critical patent/CN113467855A/en
Application granted granted Critical
Publication of CN113467855B publication Critical patent/CN113467855B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming
    • 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/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The disclosure relates to a webpage request processing method and device, electronic equipment and a storage medium. The method comprises the following steps: responding to a webpage request triggering instruction, and acquiring parameter information, a service type identifier and an interface identifier in the webpage request triggering instruction; acquiring a target configuration file matched with the service type identifier and the interface identifier, wherein the target configuration file comprises a target naming space and target parameter information, and the target naming space is obtained based on the field division of the service; under the condition that the parameter information is matched with the target parameter information, packaging the target name space, the interface identifier and the parameter information in a first request format to obtain a first webpage request; and converting the first webpage request into a second webpage request in a second request format to be sent to the server, and displaying response data of the server. According to the technical scheme provided by the disclosure, the interface can be conveniently searched and maintained, and strong verification of parameters in the webpage request can be realized.

Description

Webpage request processing method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of data processing technologies, and in particular, to a method and an apparatus for processing a web page request, an electronic device, and a storage medium.
Background
In the front-end domain web page request, there are many request modes, such as axios, fetch, etc. The request modes can realize the webpage request by calling different interfaces. In the related technology, a large number of interfaces of a webpage request are put into one file, so that the management and maintenance are not easy, and the requirement of the webpage request in a big data scene cannot be met; and the interface must be called before the required parameters can be known, so that the parameters cannot be checked before calling.
Disclosure of Invention
The disclosure provides a webpage request processing method, a webpage request processing device, electronic equipment and a storage medium, which are used for at least solving the problems of how to make an interface easy to maintain and manage and how to realize strong parameter verification in a webpage request in the related art. The technical scheme of the disclosure is as follows:
according to a first aspect of the embodiments of the present disclosure, a method for processing a web page request is provided, including:
responding to a webpage request triggering instruction, and acquiring parameter information, a service type identifier and an interface identifier in the webpage request triggering instruction;
acquiring a target configuration file matched with the service type identifier and the interface identifier, wherein the target configuration file is used for packaging a webpage request, the target configuration file comprises a target name space and target parameter information, the target name space is one of a plurality of name spaces, the plurality of name spaces correspond to a plurality of service types, and the plurality of service types are obtained based on domain division of services;
under the condition that the parameter information is matched with the target parameter information, packaging the target name space, the interface identifier and the parameter information in a first request format to obtain a first webpage request;
converting the first webpage request into a second webpage request in a second request format, wherein the second request format corresponds to a request mode of a server;
and sending the second webpage request to the server, and displaying response data of the second webpage request sent by the server.
In a possible implementation manner, the target configuration file further includes path information, and the step of encapsulating the target namespace, the interface identifier, and the parameter information in a first request format under the condition that the parameter information is matched with the target parameter information to obtain a first web page request includes:
and under the condition that the parameter information is matched with the target parameter information, packaging the target namespace, the interface identifier, the parameter information and the path information in the first request format to obtain the first webpage request.
In a possible implementation manner, the path information includes test path information and target path information, and the encapsulating the target namespace, the interface identifier, the parameter information, and the path information in the first request format when the parameter information is matched with the target parameter information to obtain the first webpage request step includes:
under the condition that the test path state is open, packaging the target name space, the interface identifier, the parameter information and the test path information in the first request format to obtain the first webpage request;
and under the condition that the test path state is closed, packaging the target namespace, the interface identifier, the parameter information and the target path information in the first request format to obtain the first webpage request.
In a possible implementation manner, before the step of encapsulating the target namespace, the interface identifier, and the parameter information in a first request format to obtain a first webpage request when the parameter information is matched with the target parameter information, the method further includes:
acquiring public parameter information corresponding to the target configuration file;
the step of encapsulating the target namespace, the interface identifier and the parameter information in the first request format under the condition that the parameter information is matched with the target parameter information to obtain a first webpage request comprises the following steps:
and under the condition that the parameter information is matched with the target parameter information, packaging the target namespace, the interface identifier, the parameter information and the public parameter information in the first request format to obtain the first webpage request.
In a possible implementation manner, after the step of obtaining the target configuration file matching with the service type identifier and the interface identifier, the method further includes:
under the condition that the parameter information is not matched with the target parameter information, displaying alarm information, and generating a third webpage request based on the target namespace, the interface identifier, the parameter information, the target parameter information and the public parameter information;
the step of converting the first web page request into a second web page request in a second request format includes:
and converting the third webpage request into a second webpage request in a second request format.
In a possible implementation manner, the step of generating a third webpage request based on the target namespace, the interface identifier, the parameter information, the target parameter information, and the common parameter information includes:
merging the parameter information, the target parameter information and the public parameter information to obtain request parameter information;
and packaging the target namespace, the interface identifier and the request parameter information in the first request format to obtain the third webpage request.
In a possible implementation manner, the step of presenting response data of the second webpage request sent by the server includes:
processing the response data according to a preset data processing function to obtain target response data;
and displaying the target response data.
According to a second aspect of the embodiments of the present disclosure, there is provided a web page request processing apparatus including:
the instruction response module is configured to execute a triggering instruction responding to a webpage request, and acquire parameter information, a service type identifier and an interface identifier in the webpage request triggering instruction;
a target configuration file obtaining module configured to perform obtaining of a target configuration file matched with the service type identifier and the interface identifier, where the target configuration file is used to encapsulate a web page request, the target configuration file includes a target namespace and target parameter information, the target namespace is one of multiple namespaces, the multiple namespaces correspond to multiple service types, and the multiple service types are obtained based on domain division of a service;
the first webpage request acquisition module is configured to perform packaging on the target namespace, the interface identifier and the parameter information in a first request format under the condition that the parameter information is matched with the target parameter information to obtain a first webpage request;
the webpage request conversion module is configured to execute a second webpage request which converts the first webpage request into a second request format, and the second request format corresponds to a request mode of a server;
and the sending and displaying module is configured to execute sending of the second webpage request to the server and displaying of response data of the second webpage request sent by the server.
In a possible implementation manner, the target configuration file further includes path information, and the first web page request obtaining module includes:
a first webpage request obtaining unit, configured to perform, when the parameter information matches the target parameter information, encapsulation of the target namespace, the interface identifier, the parameter information, and the path information in the first request format to obtain the first webpage request.
In a possible implementation manner, the path information includes test path information and target path information, and the first webpage request obtaining unit includes:
a first webpage request obtaining subunit, configured to perform, when a test path state is open, encapsulation on the target namespace, the interface identifier, the parameter information, and the test path information in the first request format to obtain the first webpage request;
and the second webpage request acquisition subunit packages the target namespace, the interface identifier, the parameter information and the target path information in the first request format under the condition that the test path state is closed to obtain the first webpage request.
In one possible implementation, the apparatus further includes:
a common parameter information acquisition module configured to perform acquisition of common parameter information corresponding to the target configuration file;
the first webpage request acquisition module comprises:
a first webpage request obtaining unit, configured to perform, when the parameter information matches the target parameter information, encapsulation of the target namespace, the interface identifier, the parameter information, and the public parameter information in the first request format to obtain the first webpage request.
In one possible implementation, the apparatus further includes:
a verification module configured to perform displaying alarm information if the parameter information does not match the target parameter information, and generate a third web page request based on the target namespace, the interface identifier, the parameter information, the target parameter information, and the common parameter information;
the webpage request conversion module comprises:
a web page request converting unit configured to execute a second web page request that converts the third web page request into a second request format.
In one possible implementation, the verification module includes:
the parameter merging unit is configured to execute merging processing on the parameter information, the target parameter information and the public parameter information to obtain request parameter information;
a third webpage request obtaining unit, configured to perform encapsulation on the target namespace, the interface identifier, and the request parameter information in the first request format to obtain the third webpage request.
In one possible implementation, the sending and presenting module includes:
the target response data acquisition unit is configured to execute processing on the response data according to a preset data processing function to obtain target response data;
and the presentation unit is configured to perform presentation of the target response data.
According to a third aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including: a processor; a memory for storing the processor-executable instructions; wherein the processor is configured to execute the instructions to implement the method of any of the first aspects above.
According to a fourth aspect of the embodiments of the present disclosure, there is provided a computer-readable storage medium, wherein instructions, when executed by a processor of an electronic device, enable the electronic device to perform the method of any one of the first aspect of the embodiments of the present disclosure.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product comprising computer instructions which, when executed by a processor, cause a computer to perform the method of any one of the first aspects of the embodiments of the present disclosure.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
by using the configuration file to declare the name space, the interface identification and the parameter information, different interfaces can correspond to different files, so that the searching, the management and the maintenance are convenient, and the requirements of big data scenes can be met; the target parameter information can be obtained directly according to the target configuration file without calling an interface, so that strong parameter verification can be realized, and the efficiency and the safety of the webpage request can be improved;
in addition, the interface is attributed under the name space, and the name space corresponds to the service type, so that the problem of redundant interfaces in the same service type is avoided, the number of the interfaces can be reduced, the cost for calling the interfaces can be reduced, the front-end code quantity can be reduced, and further the webpage request efficiency can be improved and the resource consumption can be reduced; on the basis, the second request format is encapsulated by the first request format, so that the code amount can be saved at the front end, the http (Hypertext Transfer Protocol) requests are compatible, and meanwhile, the processing process of the back end is not required to be changed, and the expandability and the applicability of the webpage request processing method are better.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
FIG. 1 is a schematic diagram illustrating an application environment in accordance with an exemplary embodiment.
FIG. 2 is a flowchart illustrating a method of web page request processing, according to an example embodiment.
Fig. 3 is a diagram illustrating a pre-provisioned service structured file in accordance with an exemplary embodiment.
Fig. 4 is a flowchart illustrating a method of presenting response data of a second web page request sent by a server according to an exemplary embodiment.
FIG. 5 is a flowchart illustrating a method of web page request processing, according to an example embodiment.
FIG. 6 is a flowchart illustrating a method of web page request processing, according to an example embodiment.
Fig. 7 is a block diagram illustrating a web page request processing apparatus according to an example embodiment.
FIG. 8 is a block diagram illustrating an electronic device for web page request processing in accordance with an exemplary embodiment.
FIG. 9 is a block diagram illustrating an electronic device for web page request processing in accordance with an exemplary embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
Referring to fig. 1, fig. 1 is a schematic diagram illustrating an application environment according to an exemplary embodiment, which may include a server 01 and a terminal 02, as shown in fig. 1.
In an alternative embodiment, the terminal 02 may be configured to perform the web page request process, and as an example, a web page request plug-in may be provided in the terminal 02 to implement the web page request process. Specifically, the terminal 02 may include, but is not limited to, a smart phone, a desktop computer, a tablet computer, a notebook computer, a smart speaker, a digital assistant, an Augmented Reality (AR)/Virtual Reality (VR) device, a smart wearable device, and other types of electronic devices. Optionally, the operating system running on the electronic device may include, but is not limited to, an android system, an IOS system, linux, windows, and the like.
In an alternative embodiment, the server 01 may be configured to respond to the web page request and return response data to the terminal 02. Specifically, the server 01 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a CDN (Content Delivery Network), a big data and artificial intelligence platform, and the like.
In addition, it should be noted that fig. 1 illustrates only one application environment of the image processing method provided by the present disclosure.
In the embodiment of the present specification, the server 01 and the terminal 02 may be directly or indirectly connected by a wired or wireless communication method, and the present application is not limited herein.
It should be noted that the following figures show a possible sequence of steps, and in fact do not limit the order that must be followed. Some steps may be performed in parallel without being dependent on each other. User information (including but not limited to user device information, user personal information, user behavior information, etc.) and data (including but not limited to data for presentation, training, etc.) to which the present disclosure relates are both information and data that are authorized by the user or sufficiently authorized by various parties.
FIG. 2 is a flowchart illustrating a method of web page request processing, according to an example embodiment. As shown in fig. 2, the following steps may be included.
In step S201, in response to the web page request trigger instruction, parameter information, a service type identifier, and an interface identifier in the web page request trigger instruction are obtained.
In practical application, the webpage request triggering instruction can be triggered by performing preset operation on an operation control in the webpage, for example, the operation control may include a search button, a query button, and the like; the preset operation may include clicking, hovering for a preset duration, and the like. In one example, a search button may be clicked, the terminal may use a keyword to be searched and the like as parameter information, and may obtain attribute information corresponding to the search button, where the attribute information may include a service type identifier and an interface identifier. Therefore, the webpage request triggering instruction can be generated based on the parameter information, the service type identifier and the interface identifier.
Further, in response to the web page request triggering instruction, parameter information, a service type identifier and an interface identifier in the web page request triggering instruction may be obtained.
In step S203, a target configuration file matching the service type identifier and the interface identifier is obtained.
In an embodiment of the present description, the target configuration file may be used to encapsulate the web page request. The target configuration file may include a target namespace, a target interface identifier, and target parameter information, where the target namespace may be one of multiple namespaces, the multiple namespaces may correspond to multiple service types, and the multiple service types are obtained based on domain division of services. The target interface identification may be one of the interface identifications.
In one example, the matching relationship between the service type identifier and the interface identifier and the target configuration file may be as shown in table 1 below:
TABLE 1
Service type identification Interface identification Target configuration file
BusinessType Y1 Interface identification A1 Target configuration file M1
…… …… ……
Service type YN Interface identification AN Target profile MN
The target configuration file matched with the service type identifier and the interface identifier can be obtained through the table 1. It should be noted that table 1 is only an example, and does not limit the present disclosure.
In one example, the target configuration file may be constructed in advance, and the matching relationship between the target configuration file and the service type identifier and the interface identifier shown in table 1 may be constructed. Based on the fact that one configuration file is taken as an example, the configuration file and the matching relationship between the configuration file and the service type identifier and the interface identifier can be constructed based on the following steps:
acquiring a preset service structured file, wherein the preset service structured file can comprise a plurality of service types;
constructing a plurality of corresponding namespaces based on a plurality of service types;
obtaining a plurality of interfaces associated with each namespace;
packaging one namespace, one interface associated with the namespace and parameter information corresponding to the interface into a configuration file; wherein the interface can be represented by an interface identification.
And constructing a matching relation of the service configuration file, the service type identifier and the interface identifier, wherein the service configuration file can be represented by the service configuration file identifier, such as the target configuration file M1 and the target configuration file MN.
In this embodiment of the present disclosure, the preset service structured file may be as shown in fig. 3, and may include a plurality of service types, for example, a user service user, an order service order, and goods, which is not limited in this disclosure. The plurality of service types may be obtained by performing domain division on the service, for example, the service may be obtained by performing domain division on the service based on domain-driven design DDD (domain-driven design), which is not limited in this disclosure, and may be divided according to actual requirements.
The multiple interfaces may be preset, and after the multiple namespaces are constructed, the multiple interfaces may be attributed to the associated namespaces. The plurality of interfaces associated with each namespace herein may refer to a plurality of interfaces that match the business type of the namespace, that is, the business information requested by the associated plurality of interfaces matches the business type of the namespace. Therefore, one namespace, one interface corresponding to the namespace and parameter information corresponding to the interface can be packaged into one configuration file. Further, a matching relationship between the configuration file and the service type identifier and the interface identifier may be constructed, for example, as shown in table 1.
In step S205, under the condition that the parameter information matches the target parameter information, the target namespace, the interface identifier, and the parameter information are encapsulated in the first request format to obtain the first web page request.
In this embodiment of the present description, the target namespace, the interface identifier, and the parameter information may be encapsulated in a first request format under the condition that the parameter information is matched with the target parameter information, so as to obtain the first web page request. As an example, the first request format may be: and the name space/interface identifier corresponds to the parameter information. The parameter information may include a parameter identifier and a corresponding parameter value. For example, the first web page request may be: and $ api [ 'user/userInfo' ] ({ c:6, d:4}), wherein a user can be a namespace, userInfo can be an interface identifier, c and d can be parameter identifiers, and 6 and 4 can be parameter values corresponding to the parameter identifiers.
In step S207, the first web page request is converted into a second web page request in a second request format, where the second request format corresponds to a request mode of the server.
In practical application, the first web page request in the first request format is generated by using the manner of the steps S201 to S205, so that the code amount can be reduced; on this basis, the first web page request may be converted into a second web page request in a second request format, for example, the second request format may be an axios request format or a fetch request format, which is not limited by this disclosure. In this way, compatibility with various http requests can be achieved without changing the background request-response process.
In step S209, the second web page request is sent to the server, and response data of the second web page request sent by the server is presented.
In practical application, the second webpage request may be sent to the server, and response data of the second webpage request sent by the server may be received, and the response data may be displayed.
By using the configuration file to declare the name space, the interface identification and the parameter information, different interfaces can correspond to different files, so that the searching, the management and the maintenance are convenient, and the requirements of big data scenes can be met; the target parameter information can be obtained directly according to the target configuration file without calling an interface, so that strong parameter verification can be realized, and the efficiency and the safety of the webpage request can be improved;
in addition, the interface is attributed under the name space, and the name space corresponds to the service type, so that the problem of redundant interfaces in the same service type is avoided, the number of the interfaces can be reduced, the cost for calling the interfaces can be reduced, the front-end code quantity can be reduced, and further the webpage request efficiency can be improved and the resource consumption can be reduced; on the basis, the second request format is encapsulated by the first request format, so that the front end can save code amount, is compatible with each http request, and does not need to change the back-end processing process, and the webpage request processing method has better expandability and applicability.
Fig. 4 is a flowchart illustrating a method of presenting response data of a second web page request sent by a server according to an exemplary embodiment. In one possible implementation, the step 209 may include:
in step S401, processing the response data according to a preset data processing function to obtain target response data;
in step S403, the target response data is presented.
In practical applications, under the condition that the target configuration file includes a preset data processing function, for example, a requestDataCallback function, as shown in table 2, the response data may be processed according to the preset data processing function to obtain target response data, and the target response data may be displayed.
Optionally, the first web page request may be generated according to the parameters shown in table 2, for example, the content in the apiConfig may be consistent with the content in the target configuration file; or the separator can be defined by self, and the separator can be defined as a default value "/" under the sep parameter; or commonParams may refer to common parameter information; the parameter static mode may refer to the strong check described above; mock may refer to the switching of a test path with a real path, for example, a default value of "false" may indicate that the test path is not turned on.
TABLE 2
Figure BDA0003131100490000101
By including the preset data processing function in the target configuration file, the response data can be flexibly processed, so that the response data can be flexibly displayed.
TABLE 3
Parameter(s) Description of the invention Default value
desc Description information “”
method Calling mode Must pass
name Name of the patent. Namespace lookup Must pass
params And (4) parameters. Parameters to be transferred by an interface {}
path Interface address Must pass
postQuery POST requests are supplemented with queries {}
requestExtraOption Request instance additional parameter configuration, such as axios instance {}
In one possible implementation, the target profile may also include path information, as shown in table 3. In this case, the step S205 may include: and under the condition that the parameter information is matched with the target parameter information, packaging the target name space, the interface identifier, the parameter information and the path information in a first request format to obtain a first webpage request. That is, the first web page request may contain the requested path information, so that an indication of the response data acquisition path may be implemented.
Table 3 is merely an example of interface corresponding parameters and does not limit the present disclosure. The calling mode may include a get calling mode and a post calling mode. The name may refer to an interface identifier and an interface name, which is used to identify the interface for easy invocation.
As an example, the path information may include test path information and target path information, and in a case that the parameter information matches the target parameter information, the target namespace, the interface identifier, the parameter information, and the path information are encapsulated in a first request format, and the obtaining a first web page request step may include the steps of:
under the condition that the test path state is open, packaging the target name space, the interface identifier, the parameter information and the test path information in a first request format to obtain the first webpage request;
and under the condition that the test path state is closed, packaging the target name space, the interface identifier, the parameter information and the target path information in a first request format to obtain the first webpage request.
In practical application, the path information may be set to include test path information and target path information (real path information), so that switching of the path is realized by testing whether the path mock is on. Optionally, the plugin may select a prefix of the path according to the test path state, for example, in a case that the test path state is on, the prefix may be selected as test, which is not limited in this disclosure.
By setting at least two kinds of path information and setting the test path state, the test path state can be dynamically adjusted to realize the switching of the path information.
FIG. 5 is a flowchart illustrating a method of web page request processing, according to an example embodiment. As shown in fig. 5, in a possible implementation manner, before step S205, the method may further include:
in step S501, public parameter information corresponding to a target configuration file is acquired;
accordingly, step S205 may include:
in step S503, under the condition that the parameter information matches the target parameter information, the target namespace, the interface identifier, the parameter information, and the public parameter information are encapsulated in the first request format to obtain the first web page request.
In this embodiment of the present specification, the common parameter information of different interfaces may be separately stored, that is, the common parameter information corresponding to different target configuration files may be separately stored, and the public parameter information may refer to common params in table 2. When the target configuration file has the corresponding public parameter information, the public parameter information corresponding to the target configuration file can be acquired, so that under the condition that the parameter information is matched with the target parameter information, the target name space, the interface identifier, the parameter information and the public parameter information are packaged in a first request format to obtain a first webpage request. For example, the parameter information and the public parameter information may be combined to obtain full parameter information, and the target namespace, the interface identifier, and the full parameter information are encapsulated in the first request format to obtain the first web page request.
By storing the common parameter information independently of the interfaces, the same common parameter information is prevented from being repeated in different interfaces, and storage resources can be saved.
FIG. 6 is a flowchart illustrating a method of web page request processing, according to an example embodiment. As shown in fig. 6, in a possible implementation manner, after step S203, the method may further include:
in step S601, in a case that the parameter information does not match the target parameter information, the warning information is displayed, and a third web page request is generated based on the target namespace, the interface identifier, the parameter information, the target parameter information, and the common parameter information.
Accordingly, S207 may include:
in step S603, the third web page request is converted into a second web page request in a second request format. The specific implementation manner of this step can be referred to as S207, which is not described herein again.
In this specification, the parameter information may include the number of parameters and parameter values, and the target parameter information may include the number of target parameters and target parameter values. The parameter information not matching the target parameter information may include: the number of parameters is not consistent with the number of target parameters, or the number of parameters is consistent with the number of target parameters but at least one parameter value is invalid. In this case, an alarm message may be displayed to prompt the user.
Optionally, the parameter information may include a parameter identification and a parameter value, and the target parameter information may include a target parameter identification and a target parameter value. The parameter information not matching the target parameter information may refer to the parameter identification not matching the target parameter identification, or the parameter value not matching the target parameter value.
In one possible implementation, step S601 may include the following steps: merging the parameter information, the target parameter information and the public parameter information to obtain request parameter information; and packaging the target name space, the interface identifier and the request parameter information in a first request format to obtain a third webpage request.
In one example, where the number of parameters is consistent with the number of target parameters, but there is at least one parameter value that is invalid, the corresponding target parameter value may be substituted to achieve the population of parameter values. Further, the populated parameter information may be merged with the common parameter information, thereby obtaining the requested parameter information.
In another example, in a case where the number of parameters does not coincide with the number of target parameters, first parameter information that does not coincide with the parameter information may be determined from the target parameter information, that is, the first parameter information may be parameter information missing from the parameter information; and taking the parameter information in the webpage request triggering instruction as second parameter information, so that the first parameter information, the second parameter information and the public parameter information can be combined to obtain the request parameter information.
The above are merely two examples and are not intended to limit the present disclosure. Through the steps, the integration of the actual incoming parameters (parameter information), the target parameter information and the public parameter information can be realized, so that the request can be continued, and the user experience is good.
The warning information is displayed under the condition that the parameter information is not matched with the target parameter information, and the third webpage request can be generated based on the target name space, the interface identifier, the parameter information, the target parameter information and the public parameter information. The method can not only carry out alarm prompt on the parameter information, but also continue the webpage request.
Fig. 7 is a block diagram illustrating a web page request processing apparatus according to an example embodiment. Referring to fig. 7, the apparatus may include:
the instruction response module 701 is configured to execute a trigger instruction in response to a web page request, and acquire parameter information, a service type identifier and an interface identifier in the web page request trigger instruction;
a target configuration file obtaining module 703 configured to perform obtaining a target configuration file matched with the service type identifier and the interface identifier, where the target configuration file may be used to package a web page request, the target configuration file may include a target namespace and target parameter information, the target namespace is one of multiple namespaces, the multiple namespaces correspond to multiple service types, and the multiple service types are obtained based on performing domain division on a service;
a first webpage request obtaining module 705, configured to perform, under a condition that the parameter information matches the target parameter information, encapsulating the target namespace, the interface identifier, and the parameter information in a first request format to obtain a first webpage request;
a web page request converting module 707 configured to execute a second web page request that converts the first web page request into a second request format, where the second request format corresponds to a request mode of the server;
the sending and displaying module 709 is configured to execute sending the second webpage request to the server, and displaying response data of the second webpage request sent by the server.
By using the configuration file to declare the name space, the interface identification and the parameter information, different interfaces can correspond to different files, so that the searching, the management and the maintenance are convenient, and the requirements of big data scenes can be met; the target parameter information can be obtained directly according to the target configuration file without calling an interface, so that strong parameter verification can be realized, and the efficiency and the safety of the webpage request can be improved;
in addition, the interface is attributed under the name space, and the name space corresponds to the service type, so that the problem of redundant interfaces in the same service type is avoided, the number of the interfaces can be reduced, the cost for calling the interfaces can be reduced, the front-end code quantity can be reduced, and further the webpage request efficiency can be improved and the resource consumption can be reduced; on the basis, the second request format is encapsulated by the first request format, so that the front end can save code amount, is compatible with each http request, and does not need to change the back-end processing process, and the webpage request processing method has better expandability and applicability.
In a possible implementation manner, the target configuration file may further include path information, and the first web page request obtaining module 705 may include:
and the first webpage request acquisition unit is configured to package the target name space, the interface identifier, the parameter information and the path information in a first request format under the condition that the parameter information is matched with the target parameter information to obtain a first webpage request.
In a possible implementation manner, the path information includes test path information and target path information, and the first webpage request obtaining unit may include:
the first webpage request acquisition subunit is configured to perform packaging on the target namespace, the interface identifier, the parameter information and the test path information in a first request format under the condition that the test path state is open to obtain a first webpage request;
and the second webpage request acquisition subunit packages the target name space, the interface identifier, the parameter information and the target path information in the first request format under the condition that the test path state is closed to obtain the first webpage request.
In one possible implementation, the apparatus may further include:
a public parameter information acquisition module configured to perform acquisition of public parameter information corresponding to a target configuration file;
the first webpage request acquisition module comprises:
and the first webpage request acquisition unit is configured to perform packaging on the target name space, the interface identifier, the parameter information and the public parameter information in a first request format under the condition that the parameter information is matched with the target parameter information to obtain a first webpage request.
In one possible implementation, the apparatus may further include:
the verification module is configured to display the alarm information under the condition that the parameter information is not matched with the target parameter information, and generate a third webpage request based on the target name space, the interface identifier, the parameter information, the target parameter information and the public parameter information;
the webpage request conversion module comprises:
a web page request converting unit configured to execute the second web page request converted from the third web page request into the second request format.
In one possible implementation, the checking module may include:
the parameter merging unit is configured to execute merging processing on the parameter information, the target parameter information and the public parameter information to obtain request parameter information;
and the third webpage request acquisition unit is configured to perform packaging on the target namespace, the interface identifier and the request parameter information in the first request format to obtain a third webpage request.
In one possible implementation, the sending and presenting module 709 may include:
the target response data acquisition unit is configured to execute processing on the response data according to a preset data processing function to obtain target response data;
and the presentation unit is configured to perform presentation of the target response data.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 8 is a block diagram illustrating an electronic device for web page request processing, which may be a terminal according to an exemplary embodiment, and an internal structure thereof may be as shown in fig. 8. The electronic device comprises a processor, a memory, a network interface, a display screen and an input device which are connected through a system bus. Wherein the processor of the electronic device is configured to provide computing and control capabilities. The memory of the electronic equipment comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the electronic device is used for connecting and communicating with an external terminal through a network. The computer program is executed by a processor to implement a method of web page request processing. The display screen of the electronic equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the electronic equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 8 is merely a block diagram of some of the structures associated with the disclosed aspects and does not constitute a limitation on the electronic devices to which the disclosed aspects apply, as a particular electronic device may include more or less components than those shown, or combine certain components, or have a different arrangement of components.
Fig. 9 is a block diagram illustrating an electronic device for web page request processing, which may be a server, according to an example embodiment, and an internal structure thereof may be as shown in fig. 9. The electronic device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the electronic device is configured to provide computing and control capabilities. The memory of the electronic equipment comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the electronic device is used for connecting and communicating with an external terminal through a network. The computer program is executed by a processor to implement a method of web page request processing.
Those skilled in the art will appreciate that the architecture shown in fig. 9 is merely a block diagram of some of the structures associated with the disclosed aspects and does not constitute a limitation on the electronic devices to which the disclosed aspects apply, as a particular electronic device may include more or less components than those shown, or combine certain components, or have a different arrangement of components.
In an exemplary embodiment, there is also provided an electronic device including: a processor; a memory for storing the processor-executable instructions; wherein the processor is configured to execute the instructions to implement the web page request processing method as in the embodiments of the present disclosure.
In an exemplary embodiment, there is also provided a computer-readable storage medium, in which instructions, when executed by a processor of an electronic device, enable the electronic device to perform a web page request processing method in an embodiment of the present disclosure. The computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In an exemplary embodiment, a computer program product containing instructions is also provided, which when run on a computer, causes the computer to perform the method of web page request processing in the embodiments of the present disclosure.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. A web page request processing method is characterized by comprising the following steps:
responding to a webpage request triggering instruction, and acquiring parameter information, a service type identifier and an interface identifier in the webpage request triggering instruction;
acquiring a target configuration file matched with the service type identifier and the interface identifier, wherein the target configuration file is used for packaging a webpage request, the target configuration file comprises a target name space and target parameter information, the target name space is one of a plurality of name spaces, the plurality of name spaces correspond to a plurality of service types, and the plurality of service types are obtained based on domain division of services;
under the condition that the parameter information is matched with the target parameter information, packaging the target name space, the interface identifier and the parameter information in a first request format to obtain a first webpage request;
converting the first webpage request into a second webpage request in a second request format, wherein the second request format corresponds to a request mode of a server;
and sending the second webpage request to the server, and displaying response data of the second webpage request sent by the server.
2. The method according to claim 1, wherein the target configuration file further includes path information, and the step of encapsulating the target namespace, the interface identifier, and the parameter information in a first request format when the parameter information matches the target parameter information to obtain a first web page request includes:
and under the condition that the parameter information is matched with the target parameter information, packaging the target namespace, the interface identifier, the parameter information and the path information in the first request format to obtain the first webpage request.
3. The method according to claim 2, wherein the path information includes test path information and target path information, and the encapsulating the target namespace, the interface identifier, the parameter information, and the path information in the first request format if the parameter information matches the target parameter information to obtain the first web page request step includes:
under the condition that the test path state is open, packaging the target name space, the interface identifier, the parameter information and the test path information in the first request format to obtain the first webpage request;
and under the condition that the test path state is closed, packaging the target namespace, the interface identifier, the parameter information and the target path information in the first request format to obtain the first webpage request.
4. The method according to claim 1, wherein when the parameter information matches the target parameter information, the method further comprises, before the step of encapsulating the target namespace, the interface identifier, and the parameter information in a first request format to obtain a first web page request:
acquiring public parameter information corresponding to the target configuration file;
the step of encapsulating the target namespace, the interface identifier and the parameter information in a first request format under the condition that the parameter information is matched with the target parameter information to obtain a first webpage request comprises the following steps:
and under the condition that the parameter information is matched with the target parameter information, packaging the target namespace, the interface identifier, the parameter information and the public parameter information in the first request format to obtain the first webpage request.
5. The method of claim 4, wherein after the step of obtaining the target profile matching the service type identifier and the interface identifier, the method further comprises:
under the condition that the parameter information is not matched with the target parameter information, displaying alarm information, and generating a third webpage request based on the target namespace, the interface identifier, the parameter information, the target parameter information and the public parameter information;
the step of converting the first web page request into a second web page request in a second request format includes:
and converting the third webpage request into a second webpage request in a second request format.
6. The method of claim 5, wherein the step of generating a third webpage request based on the target namespace, the interface identifier, the parameter information, the target parameter information, and the common parameter information comprises:
merging the parameter information, the target parameter information and the public parameter information to obtain request parameter information;
and packaging the target namespace, the interface identifier and the request parameter information in the first request format to obtain the third webpage request.
7. A web page request processing apparatus, comprising:
the instruction response module is configured to execute a triggering instruction responding to a webpage request, and acquire parameter information, a service type identifier and an interface identifier in the webpage request triggering instruction;
a target configuration file obtaining module configured to perform obtaining of a target configuration file matched with the service type identifier and the interface identifier, where the target configuration file is used to encapsulate a web page request, the target configuration file includes a target namespace and target parameter information, the target namespace is one of multiple namespaces, the multiple namespaces correspond to multiple service types, and the multiple service types are obtained based on domain division of a service;
the first webpage request acquisition module is configured to perform packaging on the target namespace, the interface identifier and the parameter information in a first request format under the condition that the parameter information is matched with the target parameter information to obtain a first webpage request;
the webpage request conversion module is configured to execute a second webpage request which converts the first webpage request into a second request format, and the second request format corresponds to a request mode of a server;
and the sending and displaying module is configured to execute sending of the second webpage request to the server and displaying of response data of the second webpage request sent by the server.
8. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the web page request processing method of any one of claims 1 to 6.
9. A computer-readable storage medium, wherein instructions in the computer-readable storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the web page request processing method of any one of claims 1 to 6.
10. A computer program product comprising computer instructions, characterized in that the computer instructions, when executed by a processor, implement the web page request processing method of any of claims 1 to 6.
CN202110703353.8A 2021-06-24 2021-06-24 Webpage request processing method and device, electronic equipment and storage medium Active CN113467855B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110703353.8A CN113467855B (en) 2021-06-24 2021-06-24 Webpage request processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110703353.8A CN113467855B (en) 2021-06-24 2021-06-24 Webpage request processing method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113467855A true CN113467855A (en) 2021-10-01
CN113467855B CN113467855B (en) 2024-03-19

Family

ID=77872600

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110703353.8A Active CN113467855B (en) 2021-06-24 2021-06-24 Webpage request processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113467855B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114238694A (en) * 2021-11-09 2022-03-25 中国科学院信息工程研究所 Data processing method and device based on Linux, electronic equipment and storage medium
CN115185717A (en) * 2022-09-14 2022-10-14 北京达佳互联信息技术有限公司 Interface calling method and device, electronic equipment and storage medium
CN117389659A (en) * 2023-09-06 2024-01-12 苏州数设科技有限公司 Method library management method and device for industrial software

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106293688A (en) * 2015-06-26 2017-01-04 阿里巴巴集团控股有限公司 The processing method of a kind of web-page requests, device and system
CN110413423A (en) * 2019-07-23 2019-11-05 腾讯科技(深圳)有限公司 Data processing method, relevant apparatus, equipment and storage medium
CN111240763A (en) * 2020-01-13 2020-06-05 广州虎牙科技有限公司 Configuration updating method, device, equipment and storage medium
WO2020181839A1 (en) * 2019-03-13 2020-09-17 深圳壹账通智能科技有限公司 Page data testing method, apparatus, computer device, and storage medium
CN112445851A (en) * 2019-09-02 2021-03-05 北京神州泰岳软件股份有限公司 Plug-in ORM framework implementation method and device, electronic equipment and storage medium
CN112689003A (en) * 2020-12-18 2021-04-20 平安普惠企业管理有限公司 Service request forwarding method, device, equipment and storage medium
US20210133388A1 (en) * 2019-10-31 2021-05-06 Baidu Online Network Technology (Beijing) Co., Ltd. Webpage rendering method, device, electronic apparatus and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106293688A (en) * 2015-06-26 2017-01-04 阿里巴巴集团控股有限公司 The processing method of a kind of web-page requests, device and system
WO2020181839A1 (en) * 2019-03-13 2020-09-17 深圳壹账通智能科技有限公司 Page data testing method, apparatus, computer device, and storage medium
CN110413423A (en) * 2019-07-23 2019-11-05 腾讯科技(深圳)有限公司 Data processing method, relevant apparatus, equipment and storage medium
CN112445851A (en) * 2019-09-02 2021-03-05 北京神州泰岳软件股份有限公司 Plug-in ORM framework implementation method and device, electronic equipment and storage medium
US20210133388A1 (en) * 2019-10-31 2021-05-06 Baidu Online Network Technology (Beijing) Co., Ltd. Webpage rendering method, device, electronic apparatus and storage medium
CN111240763A (en) * 2020-01-13 2020-06-05 广州虎牙科技有限公司 Configuration updating method, device, equipment and storage medium
CN112689003A (en) * 2020-12-18 2021-04-20 平安普惠企业管理有限公司 Service request forwarding method, device, equipment and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114238694A (en) * 2021-11-09 2022-03-25 中国科学院信息工程研究所 Data processing method and device based on Linux, electronic equipment and storage medium
CN115185717A (en) * 2022-09-14 2022-10-14 北京达佳互联信息技术有限公司 Interface calling method and device, electronic equipment and storage medium
CN117389659A (en) * 2023-09-06 2024-01-12 苏州数设科技有限公司 Method library management method and device for industrial software

Also Published As

Publication number Publication date
CN113467855B (en) 2024-03-19

Similar Documents

Publication Publication Date Title
CN108829727B (en) Data storage method and device, computer equipment and storage medium
CN113467855B (en) Webpage request processing method and device, electronic equipment and storage medium
CN109474578B (en) Message checking method, device, computer equipment and storage medium
CN110620812A (en) Interactive information pushing method and device, computer equipment and storage medium
EP4075299A1 (en) Method and apparatus for recommending multimedia resource
CN114924815B (en) Page rendering method and device, electronic equipment and storage medium
CN113051458A (en) Data processing method and device, electronic equipment and storage medium
CN113238756B (en) Live broadcast service processing method and device, electronic equipment and storage medium
CN113329232B (en) Resource distribution method and device, electronic equipment and storage medium
CN115811481B (en) Interactive service testing method and device, computer equipment and storage medium
CN113630612B (en) Data processing and data displaying method and device, electronic equipment and medium
CN113469735B (en) Resource processing method and device, electronic equipment and storage medium
CN116723002A (en) Intelligent encryption method for power report based on situation awareness
CN112417508B (en) Data desensitization method, data storage system, storage medium and server
CN115361589A (en) Page display method and device, electronic equipment and storage medium
CN115017538A (en) Data processing method and device, electronic equipment and storage medium
CN114124766A (en) Test method and device based on simulation data
CN110737662B (en) Data analysis method, device, server and computer storage medium
CN114254278A (en) User account merging method and device, computer equipment and storage medium
CN113420236A (en) List data display method and device, electronic equipment and storage medium
CN114896489B (en) Object recommendation information generation and display method and device, electronic equipment and medium
CN113204477B (en) Application testing method and device, electronic equipment and storage medium
CN112835866B (en) Database implementation method and device, electronic equipment and storage medium
CN114745443A (en) Service calling method, service calling device, computer equipment, storage medium and program product
CN115065636B (en) Data distribution method, device, electronic equipment and storage medium

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