CN104168250A - CGI frame-based service flow control method and apparatus - Google Patents

CGI frame-based service flow control method and apparatus Download PDF

Info

Publication number
CN104168250A
CN104168250A CN201310180911.2A CN201310180911A CN104168250A CN 104168250 A CN104168250 A CN 104168250A CN 201310180911 A CN201310180911 A CN 201310180911A CN 104168250 A CN104168250 A CN 104168250A
Authority
CN
China
Prior art keywords
flow
chain
data
processing unit
definition
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
CN201310180911.2A
Other languages
Chinese (zh)
Other versions
CN104168250B (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201310180911.2A priority Critical patent/CN104168250B/en
Publication of CN104168250A publication Critical patent/CN104168250A/en
Application granted granted Critical
Publication of CN104168250B publication Critical patent/CN104168250B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention relates to a common gateway interface (CGI) frame-based service flow control method. The method comprises the following steps: obtaining an access request and extracting service data in the access request; obtaining a service flow execution chain; successively extracting a processing unit object of the service flow execution chain and invoking an interface function to carry out processing on the service data so as to obtain result data; and according to the result data, generating corresponding data and returning the data. In addition, the invention also provides a CGI frame-based service flow control apparatus. With the method and apparatus, expansibility is improved.

Description

Operation flow control method and device based on CGI framework
Technical field
The present invention relates to Internet technical field, particularly relate to a kind of operation flow control method and device based on CGI framework.
Background technology
CGI(Common Gateway Interface, CGI(Common gateway interface)) be the interface standard between external application (cgi script) and Web server, be the rules of transmission of information between cgi script and Web server.CGI standard allows Web server to carry out external program, and their output is sent to Web browser, and CGI becomes one group of Web simple static hypermedia document into a complete new interactive media.
Traditional cgi script, when the execution of operation flow is controlled, is realized the control to operation flow by what call successively CGI framework for increasing, the built-in function deleting, revise and check conventionally.
Yet, inventor finds after deliberation, in conventional art, at least there is following problem: when writing the code of operation flow, different developers (for example re-defines some reusable business logic codes, the treatment state code returning according to the API of cgi script carries out the business logic codes of abnormality processing), make the reusability of code lower, thereby cause autgmentability not high.
Summary of the invention
Based on this, be necessary to provide a kind of operation flow control method based on CGI framework that can improve autgmentability.
An operation flow control method based on CGI framework, comprising:
Obtain access request, extract the business datum in described access request;
Obtain operation flow and carry out chain;
Extract successively described operation flow and carry out the processing unit object on chain, by calling its interface function, described business datum is processed and obtained result data;
According to described result data, generate response data and return.
In addition, be also necessary to provide a kind of operation flow control device based on CGI framework that can improve autgmentability.
An operation flow control device based on CGI framework, comprising:
Acquisition request module, for obtaining access request, extracts the business datum in described access request;
Carry out chain acquisition module, for obtaining operation flow, carry out chain;
Chain type processing module, carries out the processing unit object on chain for extracting successively described operation flow, by calling its interface function, described business datum is processed and is obtained result data;
Respond module, for generating response data and return according to described result data.
Above-mentioned operation flow control method and device based on CGI framework, operation flow code in CGI framework is split and is packaged into the processing unit object of the subprocess of corresponding a plurality of operation flows, and according to the interface function that the order that the operation flow corresponding with practical business flow process carried out chain is called processing unit object successively, realize the logic of operation flow, different developers is being realized in the code process of the operation flow logic that need to write separately, can be directly by carrying out to operation flow, in chain, add or register corresponding processing unit object, the durability of code is improved, thereby when the operation flow demand in the face of new, improved autgmentability.
Accompanying drawing explanation
Fig. 1 is the flow chart of the operation flow control method based on CGI framework in an embodiment;
Fig. 2 be in an embodiment in the operation flow control method based on CGI framework chain type call the process schematic diagram of processing unit object;
Fig. 3 is the running schematic diagram of the program frame of the described operation flow control method based on CGI framework of operation in an application scenarios;
Fig. 4 is the structural representation of the operation flow control device based on CGI framework in an embodiment;
Fig. 5 is the structural representation of the operation flow control device based on CGI framework in another embodiment.
Embodiment
In one embodiment, as shown in Figure 1, a kind of operation flow control method based on CGI framework, the method computer program based on CGI framework that places one's entire reliance upon, this computer program can run on the server apparatus based on Feng Luoyiman system.The method comprises the following steps:
Step S102, obtains access request, extracts the business datum in access request.
CGI framework is the interface standard between cgi script and web server.Web server (for example Apache) is for the treatment of receiving web access requests (html request), and (be url according to the resource address that web access requests extracts the Internet resources of storing in corresponding web server, Uniform Resource Locator, URL(uniform resource locator)), then according to resource address, return to Internet resources.If web access requests, to there being the operation that need to the database of web server rear end be increased, deletes, be revised or check, needs web server to process by CGI framework conventionally.Therefore web server can be transmitted to the access request receiving the computer program (being also external application) based on CGI framework, and this program receives after the access request of web server forwarding, can extract the business datum comprising in access request.
For example, if access request is that in POST(HTTP request, method-type is POST) request, wherein including the form data that needs are preserved, the business datum of extracting is this form data.If access request is inquiry request, the business datum of extracting is the keyword comprising in access request (can be that POST can be also GET).
Step S104, obtains operation flow and carries out chain.
Operation flow is carried out the sequence that chain is the processing unit object that is spliced according to registration order.
In one embodiment, the step of generation operation flow execution chain can be specially:
Obtain processing unit object definition, generate processing unit object; Obtain operation flow and carry out chain definition; According to operation flow, carry out chain definition and process unit object generation operation flow execution chain by splicing.
Processing unit object can be the object (for example, the Object in c++ or python) in program language, can be also structure (for example, Struct in c language).Processing unit object definition can be class file or function header file.
That is to say, developer can be divided into a plurality of subprocess according to the execution of operation flow by operation flow in advance, and the service logic definable of carrying out in each subprocess is in corresponding processing unit object definition.The processing unit object generating according to processing unit object definition has had the function of processing the subprocess of corresponding service flow process.
Operation flow is carried out chain definition and has been defined the type of processing unit object and calling sequentially of processing unit object that operation flow execution chain comprises.After generating processing unit object, can carry out chain definition according to operation flow processing unit object is added in operation flow execution chain according to its definition.
Step S106, extracts successively operation flow and carries out the processing unit object on chain, by calling its interface function, business datum is processed and is obtained result data.
In one embodiment, processing unit object can have unified interface function (realize same interface or inherit from same abstract class).Use unified interface function can when moving, dynamically load and call by technology such as dynamic load or reflections processing unit object.Thereby improve further autgmentability.
As shown in Figure 2, the processing unit object of carrying out on chain due to operation flow has execution sequence, therefore, can first take out operation flow and carry out first processing unit object arranged in order on chain, using the business datum of being extracted by access request as parameter, pass to the interface function of this processing unit object.After interface function is finished, obtain return value, this return value is intermediate data.Then intermediate data is passed to this processing unit object and carry out on chain according to the next processing unit object of cis-position in operation flow, and by that analogy until all processing unit objects that operation flow is carried out on chain are all called, finally obtain result data.
It should be noted that, business datum and intermediate data can be with global variable buffer memorys, transmission enters operation flow and carries out the intermediate data that the parameter of the interface function of the processing unit object on chain can be not only adjacent last processing unit object generation, also can comprise business datum or the intermediate data in buffer memory, stored.Result data can not only comprise the return value of the interface function that is positioned at last the processing unit object on operation flow execution chain, can also comprise the intermediate data that on operation flow execution chain, other processing unit objects generate.
In one embodiment, the interface function by calling processing unit object is processed to business datum the step that obtains result data and is also comprised:
Obtain the definition of intermediate data interface class; The intermediate data that definition generates interface function according to intermediate data interface class is packaged into intermediate data object, and transmits intermediate data object between processing unit object.
The definition of intermediate data interface class can be class file or header file.Intermediate data interface class definition can be the set with one group of abstract class or the interface of certain inheritance.In the process of encapsulation intermediate data, intermediate data interface class definition is carried out chain with operation flow and is had corresponding relation, specific intermediate data interface class definition specific operation flow carry out the data of transmitting between processing unit object in chain.
The definition of intermediate data interface class limits the data format of transfering of intermediate data.In conventional art, developer is when the design of logical expression of carrying out operation flow, the form of intermediate data is conventionally by developer's autonomous Design, therefore, cause the form of intermediate data to vary with each individual, when a plurality of developers develop jointly, finally need to spend the more time form of intermediate data is integrated.And by the definition of intermediate data interface class, intermediate data is encapsulated, can make developer when design operation flow, directly adopt the intermediate data interface class definition with versatility defining to limit the form of intermediate data, data transmission between the code that the developer who makes to develop jointly writes has obtained standard, not needing the later stage to spend the more time integrates, therefore, improved development efficiency.
For example, in the execution of operation flow, can comprise that the subprocess of database manipulation (increase, delete, revise or inquiry) and the conditional code of returning according to database manipulation generate the subprocess of state information.In conventional art, for different developers, its state information generating according to conditional code may vary with each individual.And in the present embodiment, the state information corresponding due to conditional code defined and carried out limiting and standard by intermediate data interface class, therefore, the state information generating in the code that the developer of a plurality of joint developments writes is identical, also just do not need the later stage integrating, thereby improved development efficiency.
Step S108, generates response data and returns according to result data.
Response data finally will return to web server, and is returned by http response by web server, and is illustrated in the data in webpage.
In one embodiment, also can judge whether throw exception of interface function, if so, output recording exceptional.
Further, judge that whether interface function also can comprise after the step of throw exception:
If so, extremely whether judgement need to end, and if so, ends the execution that operation flow is carried out chain.
That is to say the calling in the container in CGI framework of processing unit object.When calling successively the interface function of processing unit object, can detect its whether throw exception, if obtaining abnormal information, throw exception outputs in control desk or journal file.
In the present embodiment, can obtain abnormal corresponding processing unit object, judge whether this processing unit object is critical process, if, end extraction process unit object, and call the operation of its interface function, if not, skip this processing unit object, continue to extract operation flow and carry out on chain according to the next processing unit object of cis-position.
Operation flow is carried out the processing unit object that chain definition not only comprises that operation flow execution chain comprises, and also comprises whether each processing unit object is critical process.For example, for processing unit object corresponding to the subprocess of database manipulation, it can be defined as critical process conventionally, unsuccessfully ends calling of follow-up processing unit object if carry out, and preferably, also can carry out rollback to data.And for processing unit object corresponding to the subprocess of log processing, it can be defined as non-key process conventionally, log recording failure does not affect operation flow and carries out.Whether developer can be that critical process is defined in the definition of operation flow execution chain by configuration file by processing unit object in advance.
In one embodiment, at extraction process unit object successively, call in the process of its corresponding interface function, also can judge whether processing unit object is asynchronous object, if so, its corresponding interface function of asynchronous call, otherwise its corresponding interface function of synchronization call.That is to say, as shown in Figure 2, if operation flow is carried out a plurality of processing unit objects of cis-position on chain, be asynchronous object, interface function that can the plurality of processing unit object of multithreading asynchronous call, i.e. the plurality of interface function executed in parallel.If processing unit object is not asynchronous object, be synchronization object, in the mode of blocking, after obtaining return value, calls again the interface function that calls this processing unit object the interface function that operation flow is carried out the next processing unit object of cis-position on chain.Can carry out whether configuration process unit object in chain definition is asynchronous object in operation flow.
In an application scenarios, as shown in Figure 3, the operation of the method is based on program frame, and this program frame comprises the object of frame, module and task three types.The object of module type is all realized unified interface, has the interface function of same names.The object of task type is all inherited from unified abstract class.The object that frame object extracts business datum and generates task type for receiving access request, then obtain operation flow and carry out chain, and extraction process unit object call its interface function in order, module object, by the object of task type being read and write get parms and being encapsulated the intermediate data of generation, that is to say that the object by task type transmits intermediate data between module object.All module objects store final result data after being all called in the object of task type.Can generate response data according to the object of the task type obtaining after calling.
It should be noted that, the developer who develops jointly can write according to function separately the object of module type corresponding to sub-process in operation flow, preferably, program language can adopt c or c++(performance high), also can adopt the scripts such as python (easily debugging), after the object of module type is write, can be registered in the object of frame type i.e. configuration service flow performing chain definition.
In one embodiment, as shown in Figure 4, a kind of operation flow control device based on CGI framework, comprising:
Acquisition request module 102, for obtaining access request, extracts the business datum in described access request;
Carry out chain acquisition module 104, for obtaining operation flow, carry out chain;
Chain type processing module 106, carries out the processing unit object on chain for extracting successively described operation flow, by calling its interface function, described business datum is processed and is obtained result data;
Respond module 108, for generating response data and return according to described result data.
In one embodiment, chain type processing module is also for obtaining the definition of intermediate data interface class, and the intermediate data that definition generates interface function according to intermediate data interface class is packaged into intermediate data object, and transmits intermediate data object between processing unit object.
In one embodiment, as shown in Figure 5, the operation flow control device based on CGI framework also comprises carries out chain generation module 110, for obtaining processing unit object definition, generates processing unit object; Obtain operation flow and carry out chain definition; According to described operation flow, carry out chain definition and carry out chain by the described processing unit object generation of splicing operation flow.
In one embodiment, as shown in Figure 5, the operation flow control device based on CGI framework also comprises abnormality processing module 112, for judging whether throw exception of interface function, and if so, output recording exceptional.
In one embodiment, extremely whether abnormality processing module 112 also need to end, if so, end the execution that operation flow is carried out chain for judging.
Above-mentioned operation flow control method and device based on CGI framework, operation flow code in CGI framework is split and is packaged into the processing unit object of the subprocess of corresponding a plurality of operation flows, and according to the interface function that the order that the operation flow corresponding with practical business flow process carried out chain is called processing unit object successively, realize the logic of operation flow, different developers is being realized in the code process of the operation flow logic that need to write separately, can be directly by carrying out to operation flow, in chain, add or register corresponding processing unit object, the durability of code is improved, thereby when the operation flow demand in the face of new, improved autgmentability.
One of ordinary skill in the art will appreciate that all or part of flow process realizing in above-described embodiment method, to come the hardware that instruction is relevant to complete by computer program, described program can be stored in a computer read/write memory medium, this program, when carrying out, can comprise as the flow process of the embodiment of above-mentioned each side method.Wherein, described storage medium can be magnetic disc, CD, read-only store-memory body (Read-Only Memory, ROM) or random store-memory body (Random Access Memory, RAM) etc.
The above embodiment has only expressed several execution mode of the present invention, and it describes comparatively concrete and detailed, but can not therefore be interpreted as the restriction to the scope of the claims of the present invention.It should be pointed out that for the person of ordinary skill of the art, without departing from the inventive concept of the premise, can also make some distortion and improvement, these all belong to protection scope of the present invention.Therefore, the protection range of patent of the present invention should be as the criterion with claims.

Claims (10)

1. the operation flow control method based on CGI framework, comprising:
Obtain access request, extract the business datum in described access request;
Obtain operation flow and carry out chain;
Extract successively described operation flow and carry out the processing unit object on chain, by calling its interface function, described business datum is processed and obtained result data;
According to described result data, generate response data and return.
2. the operation flow control method based on CGI framework according to claim 1, is characterized in that, the described interface function by calling processing unit object is processed to described business datum the step that obtains result data and also comprised:
Obtain the definition of intermediate data interface class;
The intermediate data described interface function being generated according to described intermediate data interface class definition is packaged into intermediate data object, and transmits described intermediate data object between described processing unit object.
3. the operation flow control method based on CGI framework according to claim 1, is characterized in that, described method also comprises:
Obtain processing unit object definition, generate processing unit object;
Obtain operation flow and carry out chain definition;
According to described operation flow, carry out chain definition and carry out chain by the described processing unit object generation of splicing operation flow.
4. the operation flow control method based on CGI framework according to claim 1, is characterized in that, described method also comprises:
Judge whether throw exception of described interface function, if so, export and record described abnormal.
5. the operation flow control method based on CGI framework according to claim 4, is characterized in that, describedly judges that whether described interface function also comprises after the step of throw exception:
If so, judge the described termination that extremely whether to need, if so, end the execution that described operation flow is carried out chain.
6. the operation flow control device based on CGI framework, is characterized in that, comprising:
Acquisition request module, for obtaining access request, extracts the business datum in described access request;
Carry out chain acquisition module, for obtaining operation flow, carry out chain;
Chain type processing module, carries out the processing unit object on chain for extracting successively described operation flow, by calling its interface function, described business datum is processed and is obtained result data;
Respond module, for generating response data and return according to described result data.
7. the operation flow control device based on CGI framework according to claim 6, it is characterized in that, described chain type processing module is also for obtaining the definition of intermediate data interface class, the intermediate data described interface function being generated according to described intermediate data interface class definition is packaged into intermediate data object, and transmits described intermediate data object between described processing unit object.
8. the operation flow control device based on CGI framework according to claim 6, is characterized in that, described device also comprises carries out chain generation module, for obtaining processing unit object definition, generates processing unit object; Obtain operation flow and carry out chain definition; According to described operation flow, carry out chain definition and carry out chain by the described processing unit object generation of splicing operation flow.
9. the operation flow control device based on CGI framework according to claim 6, is characterized in that, described device also comprises abnormality processing module, for judging whether throw exception of described interface function, if so, exports and record described abnormal.
10. the operation flow control device based on CGI framework according to claim 9, is characterized in that, described abnormality processing module also, for judging the described termination that extremely whether to need, is if so, ended the execution that described operation flow is carried out chain.
CN201310180911.2A 2013-05-15 2013-05-15 Business Process Control method and device based on CGI frames Active CN104168250B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310180911.2A CN104168250B (en) 2013-05-15 2013-05-15 Business Process Control method and device based on CGI frames

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310180911.2A CN104168250B (en) 2013-05-15 2013-05-15 Business Process Control method and device based on CGI frames

Publications (2)

Publication Number Publication Date
CN104168250A true CN104168250A (en) 2014-11-26
CN104168250B CN104168250B (en) 2018-06-15

Family

ID=51911877

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310180911.2A Active CN104168250B (en) 2013-05-15 2013-05-15 Business Process Control method and device based on CGI frames

Country Status (1)

Country Link
CN (1) CN104168250B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016095373A1 (en) * 2014-12-16 2016-06-23 中兴通讯股份有限公司 Service processing method and device
CN107659544A (en) * 2016-08-26 2018-02-02 平安科技(深圳)有限公司 Using merging deployment system and method
CN107800552A (en) * 2016-09-02 2018-03-13 杭州海康威视数字技术股份有限公司 A kind of data interactive method and device
CN108628729A (en) * 2017-03-15 2018-10-09 北京嘀嘀无限科技发展有限公司 A kind of method for testing software and software test client

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1858736A (en) * 2006-01-16 2006-11-08 华为技术有限公司 Method for realizing intelligent interlinking
US7882501B1 (en) * 1999-08-13 2011-02-01 Oracle America, Inc. System and method for enabling dynamic modifed class reloading in an application server environment
CN102393817A (en) * 2011-06-28 2012-03-28 浪潮集团山东通用软件有限公司 Method for dynamically creating object example by configuration in run time
CN102799424A (en) * 2012-06-12 2012-11-28 上海雷腾软件有限公司 Interface architecture of agile efficient layering server side
CN102902537A (en) * 2012-09-19 2013-01-30 厦门亿联网络技术股份有限公司 Embedded WEB model view controller (MVC) development framework based on Fast common gateway interface (CGI) and hypertext markup language (HTML) template

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7882501B1 (en) * 1999-08-13 2011-02-01 Oracle America, Inc. System and method for enabling dynamic modifed class reloading in an application server environment
CN1858736A (en) * 2006-01-16 2006-11-08 华为技术有限公司 Method for realizing intelligent interlinking
CN102393817A (en) * 2011-06-28 2012-03-28 浪潮集团山东通用软件有限公司 Method for dynamically creating object example by configuration in run time
CN102799424A (en) * 2012-06-12 2012-11-28 上海雷腾软件有限公司 Interface architecture of agile efficient layering server side
CN102902537A (en) * 2012-09-19 2013-01-30 厦门亿联网络技术股份有限公司 Embedded WEB model view controller (MVC) development framework based on Fast common gateway interface (CGI) and hypertext markup language (HTML) template

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016095373A1 (en) * 2014-12-16 2016-06-23 中兴通讯股份有限公司 Service processing method and device
CN105760973A (en) * 2014-12-16 2016-07-13 中兴通讯股份有限公司 Business processing method and device
CN107659544A (en) * 2016-08-26 2018-02-02 平安科技(深圳)有限公司 Using merging deployment system and method
CN107800552A (en) * 2016-09-02 2018-03-13 杭州海康威视数字技术股份有限公司 A kind of data interactive method and device
CN107800552B (en) * 2016-09-02 2020-11-27 杭州海康威视数字技术股份有限公司 Data interaction method and device
CN108628729A (en) * 2017-03-15 2018-10-09 北京嘀嘀无限科技发展有限公司 A kind of method for testing software and software test client

Also Published As

Publication number Publication date
CN104168250B (en) 2018-06-15

Similar Documents

Publication Publication Date Title
US10642913B2 (en) Intent and bot based query guidance
US8301645B1 (en) Aggregated web analytics request systems and methods
CN101697139B (en) Method, device and registry for remote procedure call
CN105243159A (en) Visual script editor-based distributed web crawler system
US20090100321A1 (en) Universal contextual actions menu across windows applications
CN104168250A (en) CGI frame-based service flow control method and apparatus
CN106649120A (en) Data acquisition method, and data analysis method and system
CN101819551B (en) Method and system for recording service interaction data of enterprise message system
CN108415832A (en) Automatic interface testing method, device, equipment and storage medium
US20190075086A1 (en) Secure message handling of an application across deployment locations
CN105573733A (en) Communication method for browser and web front end and web front end and system
KR20120122959A (en) Method and Device for Collecting Web Contents and Computer-readable Recording Medium for the same
CN108156022A (en) A kind of service calling method, device and electronic equipment
CN107526676B (en) Cross-system test method and device
CN107133174A (en) Test case code automatically generating device and method
EP3425877A1 (en) Service implementation method, apparatus and system based on fix protocol
CN104423932B (en) The method that Binary Element is called in Javascript
CN104899016A (en) Call stack relationship obtaining method and call stack relationship obtaining device
CN104407979B (en) script detection method and device
CN106371987A (en) Test method and device
US8607201B2 (en) Augmenting visualization of a call stack
US20110246967A1 (en) Methods and systems for automation framework extensibility
CN109739913A (en) A kind of hot spot data method for caching and processing and equipment based on configurableization
CN103455476B (en) The processing method of the network information and the method for building up of abstract syntax tree and device thereof
CN104731606B (en) The system and method for Enterprise information integration management is realized based on identification crawl technology

Legal Events

Date Code Title Description
PB01 Publication
C06 Publication
SE01 Entry into force of request for substantive examination
EXSB Decision made by sipo to initiate substantive examination
GR01 Patent grant
GR01 Patent grant