CN112398736B - Method and system for realizing dynamic selection of service route according to service parameters - Google Patents

Method and system for realizing dynamic selection of service route according to service parameters Download PDF

Info

Publication number
CN112398736B
CN112398736B CN202011124727.2A CN202011124727A CN112398736B CN 112398736 B CN112398736 B CN 112398736B CN 202011124727 A CN202011124727 A CN 202011124727A CN 112398736 B CN112398736 B CN 112398736B
Authority
CN
China
Prior art keywords
service
request
dynamic
parameters
static resource
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011124727.2A
Other languages
Chinese (zh)
Other versions
CN112398736A (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.)
Nanjing Xinwang Internetwork Technology Co ltd
Original Assignee
Nanjing Xinwang Internetwork 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 Nanjing Xinwang Internetwork Technology Co ltd filed Critical Nanjing Xinwang Internetwork Technology Co ltd
Priority to CN202011124727.2A priority Critical patent/CN112398736B/en
Publication of CN112398736A publication Critical patent/CN112398736A/en
Application granted granted Critical
Publication of CN112398736B publication Critical patent/CN112398736B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/30Routing of multiclass traffic
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing

Abstract

The invention discloses a method and a system for realizing dynamic selection of service routes according to service parameters, wherein the method comprises static resource dynamic routes and dynamic service routes, and the method comprises the following steps: static resource dynamic routing, namely judging whether a specific url request is a static resource of an address A or a static resource of an address B according to a field in the url access request, and dynamically routing the front end to the specific static resource without changing codes; and the routing of the dynamic service is routed to different services according to one service field in the request url, or one field in the request form, or one field in the request json, and the requesting end does not need to replace the request url. The method and the system meet the requirement that a large client needs to independently release and deploy own services in a public cloud deployment e-commerce platform, but wants to utilize the original cloud environment, the access mode is unchanged, and the client deploys own control.

Description

Method and system for realizing dynamic selection of service route according to service parameters
Technical Field
The invention relates to the technical field of electronic commerce, in particular to a method and a system for realizing dynamic selection of service routes according to business parameters.
Background
Electronic commerce is replacing the original off-line shopping mode, more and more consumers purchase on e-commerce websites and applications, and electronic commerce applications gradually replace off-line shopping.
In the process of building electronic commerce, there is a situation that a tenant exists, and such customers need to use your basic service and hardware facilities, but they want to expand and personalize their own services and manage the storage of data by themselves. However, as a service operator, when a tenant personalizes its service, the tenant does not change the access mode of the customer, so as to achieve a uniform architecture.
For example, in a public cloud deployed e-commerce platform, a part of large customers need to independently publish and deploy their own services, but want to use the original cloud environment, and the access mode is not changed, and the deployment is controlled by themselves. The prior art does not have a solution to achieve the above-described functionality.
Disclosure of Invention
In view of the above-mentioned defects in the prior art, the technical problem to be solved by the present invention is to provide a method and a system for implementing dynamic selection of service routes according to service parameters, so as to solve the deficiencies in the prior art.
In order to achieve the above object, the present invention provides a method for implementing dynamic selection of service route according to service parameters, including static resource dynamic route and dynamic service route, wherein:
static resource dynamic routing, namely judging whether a specific url request is a static resource of an address A or a static resource of an address B according to a field in the url access request, and dynamically routing the front end to the specific static resource without changing codes;
and the routing of the dynamic service is routed to different services according to one service field in the request url, or one field in the request form, or one field in the request json, and the requesting end does not need to replace the request url.
Further, the dynamic routing of the static resource comprises the following steps:
step 101, defining a url rule, and adding related service parameters into a path in the url;
step 102, acquiring the service parameters in a service system through a service gateway;
step 103, after the service parameters are obtained, the address of the static service is inquired in the service system according to the service parameters;
step 104, the gateway assembles the new url address and then redirects to the specific static resource.
Further, the routing of the dynamic service comprises the following steps:
step 201, defining rules of business parameters;
step 202, acquiring different parameters of the service according to the request method and the content type of the service request;
step 203, obtaining the service address in the service system according to the service parameters and then repackaging the request parameters;
and step 204, dynamically routing to the specified service in different request modes according to the service address and the request parameter prepared in the step 203.
A system for realizing dynamic selection of service route according to service parameters comprises a static resource dynamic routing unit and a dynamic service routing unit, wherein:
the static resource dynamic routing unit judges whether the url specific request is the static resource of the address A or the static resource of the address B according to a field in the url access request, and the front end can dynamically route to the specific static resource without changing codes;
and the routing unit of the dynamic service routes to different services according to one service field in the url of the analysis request, or one field in the request form, or one field in the json of the request, and the request end does not need to replace the url of the request.
Further, the static resource dynamic routing unit includes:
the static resource service parameter rule definition module is used for defining a url rule and adding related service parameters into a path in the url;
a static resource service parameter obtaining module, configured to obtain the service parameter in a service system through a serving gateway;
the static service address acquisition module is used for inquiring a static service address in a service system according to the service parameter after acquiring the service parameter;
and the static resource redirection module is used for redirecting to the specific static resource after the gateway assembles the new url address.
Further, the routing unit of the dynamic service includes:
the dynamic service business parameter rule definition module is used for defining the rules of the business parameters;
a dynamic service parameter obtaining module, configured to obtain different parameters of a service according to a request method and a content type of a service request;
the request parameter encapsulation module is used for encapsulating the request parameters again after acquiring the service address in the service system according to the service parameters;
and the service dynamic routing module is used for dynamically routing to the specified service in different request modes according to the prepared service address and the request parameter.
The invention has the beneficial effects that:
the method and the system meet the requirement that a large client needs to independently release and deploy own services in a public cloud deployment e-commerce platform, but wants to utilize the original cloud environment, the access mode is unchanged, and the client deploys own control.
The conception, the specific structure and the technical effects of the present invention will be further described with reference to the accompanying drawings to fully understand the objects, the features and the effects of the present invention.
Drawings
FIG. 1 is a flow chart of a method of static resource routing of the present invention;
FIG. 2 is a flow chart of a method of dynamic service routing in accordance with the present invention;
FIG. 3 is a system diagram of static resource routing according to the present invention;
FIG. 4 is a system diagram of dynamic service routing in accordance with the present invention.
Detailed Description
As shown in fig. 1 and 2, the present invention provides a method for implementing dynamic selection of service route according to service parameters, including static resource dynamic route and dynamic service route, wherein:
static resource dynamic routing, namely judging whether a specific url request is a static resource of an address A or a static resource of an address B according to a field in the url access request, and dynamically routing the front end to the specific static resource without changing codes;
and the routing of the dynamic service is routed to different services according to a service field in the url of the analysis request, or a field in a request form, or a field in json of the request, and the request end does not need to replace the url of the request.
Fig. 1 is a flowchart illustrating static resource routing, and as shown in fig. 1, the static routing implementation method includes the following steps:
step 101, a url rule is defined. Since one label must be needed to identify the current service and static resources cannot obtain other labels in the header and the body of the message except in the url, only the relevant service parameters can be added to the path in the url.
Step 102, obtaining the parameter in the previous step in the service system through the serving gateway
Step 103, after the service parameters are obtained in the previous step, the address of the static service is inquired in the service system according to the relevant service parameters.
Step 104, the gateway assembles a new url address and then redirects to the specific static resource.
Fig. 2 is a flow chart illustrating dynamic service routing, and as shown in fig. 2, the dynamic service routing is implemented in the following steps:
in step 201, rules of the business parameters are defined. Since we need a service differentiation identifier to differentiate the current service, the service identification is used to obtain the relevant configuration information.
Step 202, different parameters of the service are obtained according to the request method and the content type of the service request. The most used http request methods are get and post2, and the 2 request methods have different parameter acquisition modes:
the Get parameter is obtained in a simple manner, and only the following contents in the url need to be taken out; separating the character strings to obtain a parameter list, then searching the values of the parameters in the parameter list by taking the service parameters in the step 201 as keys, and if the values are not found, informing the client that the service parameters are missing and the routing cannot be completed.
The Post parameter acquisition mode is divided into application/x-www-form-url and application/json2 types according to the content-Type of the request mode.
Firstly, acquiring application/x-www-form-url-opcode service parameters, wherein a client side is in a form submission mode, a main body in an http packet is a character string separated by characters and symbols in the same mode as the parameter storage mode in the last step get mode, a parameter list is still obtained according to the separation characters and the character string, then, the service parameters in the step 201 are used as keys, values of the parameters in the parameter list are searched, and if the values are not found, the client side is informed that the service parameters are missing, and routing cannot be completed.
And then acquiring application/json service parameters, wherein the client side is a json file directly submitted, a json character string is stored in a main body in an http packet, and the json character string is required to be used for searching the service parameters. Firstly, decoding a json character string, mapping the json character string to a hash table by using a json analysis tool, directly using the service parameter in the step 201 as a key to search the value of the parameter in the parameter list because the hash table is stored in a key/value structure, and if the value is not found, informing a client that the service parameter is missing and the routing cannot be completed.
Step 203, according to the service parameters, the address is obtained in the service system and then the parameters are packaged. After the address to be routed is obtained in the service system, the url parameter needs to be prepared. There are also two ways, get and post 2.
The Get mode is to take out the parameters in the original request, where the service parameters are removed as needed, and then spliced into a separated character string, which is attached to the back of the new url obtained in step 202 to generate a new request url.
The Post mode is also 2 modes as in step 202. and removing service parameters of the application/x-www-form-url type http packet according to needs, and splicing the http packet into a character string separated by & for. application/json type
The Http packet, also removes the service parameters as needed, and then converts the hash table in step 202 into json string. Since the post submitted parameters are submitted in the form of a stream, after the column step 202, the data in the stream has disappeared, so we need here the parameters of the post encapsulation request to be put into the http packet.
And step 204, dynamically routing to the specified service through different request modes according to the request address and the request parameter prepared in the step 203.
As shown in fig. 3 and 4, the present invention further provides a system for implementing dynamic selection of service route according to service parameters, including a static resource dynamic routing unit and a dynamic service routing unit, wherein:
the static resource dynamic routing unit judges whether the url specific request is the static resource of the address A or the static resource of the address B according to a field in the url access request, and the front end can dynamically route to the specific static resource without changing codes;
and the routing unit of the dynamic service routes to different services according to one service field in the request url, or one field in the request form, or one field in the request json, and the request end does not need to replace the request url.
As shown in fig. 3, the static resource dynamic routing unit includes:
the static resource service parameter rule definition module is used for defining a url rule and adding related service parameters into a path in the url;
the static resource service parameter acquisition module is used for acquiring service parameters in a service system through a service gateway;
the static service address acquisition module is used for inquiring the address of the static service in the service system according to the service parameters after the service parameters are acquired;
and the static resource redirection module is used for redirecting to the specific static resource after the gateway assembles the new url address.
As shown in fig. 4, the routing unit of the dynamic service includes:
the dynamic service parameter rule definition module is used for defining the rules of the service parameters;
a dynamic service parameter obtaining module, configured to obtain different parameters of a service according to a request method and a content type of a service request;
the request parameter encapsulation module is used for encapsulating the request parameters again after acquiring the service address in the service system according to the service parameters;
and the service dynamic routing module is used for dynamically routing to the specified service in different request modes according to the prepared service address and the request parameter.
The foregoing detailed description of the preferred embodiments of the invention has been presented. It should be understood that numerous modifications and variations could be devised by those skilled in the art in light of the present teachings without departing from the inventive concepts. Therefore, the technical solutions available to those skilled in the art through logic analysis, reasoning and limited experiments based on the prior art according to the concept of the present invention should be within the scope of protection defined by the claims.

Claims (4)

1. A method for implementing dynamic selection of service route according to service parameters is characterized by comprising static resource dynamic route and dynamic service route, wherein:
static resource dynamic routing, namely judging whether a specific url request is a static resource of an address A or a static resource of an address B according to a field in the url access request, and dynamically routing the front end to the specific static resource without changing codes;
routing of the dynamic service, wherein different services are routed according to a service field in the request url, a field in the request form or a field in the request json, and the request end does not need to replace the request url;
the static resource dynamic routing comprises the following steps:
step 101, defining a url rule, and adding related service parameters into a path in the url;
step 102, acquiring the service parameters in a service system through a service gateway;
step 103, after the service parameters are obtained, the address of the static service is inquired in the service system according to the service parameters;
step 104, the gateway assembles a new url address and then redirects to a specific static resource;
the routing of the dynamic service comprises the steps of:
step 201, defining rules of business parameters;
step 202, acquiring different parameters of the service according to the request method and the content type of the service request;
step 203, obtaining the service address in the service system according to the service parameters and then repackaging the request parameters;
and step 204, dynamically routing to the specified service in different request modes according to the service address and the request parameter prepared in the step 203.
2. A system for implementing dynamic selection of service route according to service parameters, comprising a static resource dynamic routing unit and a dynamic service routing unit, wherein:
the static resource dynamic routing unit judges whether the url specific request is the static resource of the address A or the static resource of the address B according to a field in the url access request, and the front end can dynamically route to the specific static resource without changing codes;
and the routing unit of the dynamic service routes to different services according to one service field in the request url, or one field in the request form, or one field in the request json, and the request end does not need to replace the request url.
3. The system of claim 2, wherein the static resource dynamic routing unit comprises:
the static resource service parameter rule definition module is used for defining a url rule and adding related service parameters into a path in the url;
a static resource service parameter obtaining module, configured to obtain the service parameter in a service system through a serving gateway;
the static service address acquisition module is used for inquiring a static service address in a service system according to the service parameter after acquiring the service parameter;
and the static resource redirection module is used for redirecting to specific static resources after the gateway assembles the new url address.
4. A system for implementing dynamic selection of service routes based on traffic parameters, according to claim 2, wherein the dynamically served routing unit comprises:
the dynamic service business parameter rule definition module is used for defining the rules of the business parameters;
a dynamic service parameter obtaining module, configured to obtain different parameters of a service according to a request method and a content type of a service request;
the request parameter encapsulation module is used for encapsulating the request parameters again after acquiring the service address in the service system according to the service parameters;
and the service dynamic routing module is used for dynamically routing to the specified service in different request modes according to the prepared service address and the request parameter.
CN202011124727.2A 2020-10-20 2020-10-20 Method and system for realizing dynamic selection of service route according to service parameters Active CN112398736B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011124727.2A CN112398736B (en) 2020-10-20 2020-10-20 Method and system for realizing dynamic selection of service route according to service parameters

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011124727.2A CN112398736B (en) 2020-10-20 2020-10-20 Method and system for realizing dynamic selection of service route according to service parameters

Publications (2)

Publication Number Publication Date
CN112398736A CN112398736A (en) 2021-02-23
CN112398736B true CN112398736B (en) 2023-02-21

Family

ID=74596023

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011124727.2A Active CN112398736B (en) 2020-10-20 2020-10-20 Method and system for realizing dynamic selection of service route according to service parameters

Country Status (1)

Country Link
CN (1) CN112398736B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101662464A (en) * 2008-08-26 2010-03-03 阿里巴巴集团控股有限公司 System for realizing HTTP request service and method thereof
CN101789012A (en) * 2010-02-03 2010-07-28 南京联创科技集团股份有限公司 J2EE (Java 2 Platform Enterprise Edition) based solution for staticizing WEB dynamic page
CN103188295A (en) * 2011-12-28 2013-07-03 上海格尔软件股份有限公司 WEB single sign-on method completely transparent to user and application
CN104168262A (en) * 2014-07-02 2014-11-26 百度在线网络技术(北京)有限公司 Method and server for logging in third party site
CN106878243A (en) * 2016-06-06 2017-06-20 阿里巴巴集团控股有限公司 Method for processing business and device
CN107566550A (en) * 2017-10-13 2018-01-09 北京中教在线科技有限公司 A kind of website URL dynamic creation methods
CN111638922A (en) * 2020-06-04 2020-09-08 北京字节跳动网络技术有限公司 Page resource loading method and device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7761900B2 (en) * 2006-08-02 2010-07-20 Clarendon Foundation, Inc. Distribution of content and advertisement
US8725891B2 (en) * 2010-07-01 2014-05-13 Red Hat, Inc. Aggregation across cloud providers
CN105871782B (en) * 2015-01-21 2019-08-16 中国移动通信集团广东有限公司 Network service processing method, device, business router and platform authentication system
CN109815432A (en) * 2018-12-26 2019-05-28 北京博鳌纵横网络科技有限公司 A kind of method of the method and page static of whole station static

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101662464A (en) * 2008-08-26 2010-03-03 阿里巴巴集团控股有限公司 System for realizing HTTP request service and method thereof
CN101789012A (en) * 2010-02-03 2010-07-28 南京联创科技集团股份有限公司 J2EE (Java 2 Platform Enterprise Edition) based solution for staticizing WEB dynamic page
CN103188295A (en) * 2011-12-28 2013-07-03 上海格尔软件股份有限公司 WEB single sign-on method completely transparent to user and application
CN104168262A (en) * 2014-07-02 2014-11-26 百度在线网络技术(北京)有限公司 Method and server for logging in third party site
CN106878243A (en) * 2016-06-06 2017-06-20 阿里巴巴集团控股有限公司 Method for processing business and device
CN107566550A (en) * 2017-10-13 2018-01-09 北京中教在线科技有限公司 A kind of website URL dynamic creation methods
CN111638922A (en) * 2020-06-04 2020-09-08 北京字节跳动网络技术有限公司 Page resource loading method and device

Also Published As

Publication number Publication date
CN112398736A (en) 2021-02-23

Similar Documents

Publication Publication Date Title
CN108521858B (en) Device identifier dependent handling of operations for packet-based data communication
US6820121B1 (en) Methods systems and computer program products for processing an event based on policy rules using hashing
JP4367650B2 (en) Method, content-based router, content-based network
US20130132518A1 (en) Method and apparatus for adaptive application message payload content transformation in a network infrastructure element
CN108234318B (en) Method and device for selecting message forwarding tunnel
CN109189381B (en) Method and device for creating service flow component
CN111277481B (en) Method, device, equipment and storage medium for establishing VPN tunnel
CN111708619B (en) Distributed transaction processing method and system based on message queue and database
CN113076153B (en) Interface calling method and device
CN105376292A (en) Explicit strategy feedback in name-based forwarding
Kherani et al. Development of mec system for indigenous 5g test-bed
CN112398736B (en) Method and system for realizing dynamic selection of service route according to service parameters
WO2020125651A1 (en) Label attribute identification method, apparatus and device, and storage medium
CN111865905B (en) Ukey-based communication method, device and storage medium
ES2318216T3 (en) ANALYSIS OF OPERATIONS RELATED TO NETWORK SERVICES.
CN106453204B (en) Method and device for processing data message
CN101577660B (en) Method and device for acquiring label forwarding list item and forwarding message
US8019767B2 (en) Correlation-based visualization of service-oriented architecture protocol (SOAP) messages
CN108259350B (en) Message transmission method and device and machine-readable storage medium
CN110022344B (en) Communication method, non-transitory computer-readable storage medium, storage access system
CN107707473B (en) Message forwarding method and device
CN111416762B (en) Method, device, system and storage medium for establishing network tunnel
CN112187822A (en) Safety monitoring method and device in tunnel transmission
WO2018022310A1 (en) System and method for ephemeral entries in a forwarding information base in a content centric network
JP2017147601A (en) Communication device and communication method

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