CN102004639A - Embedded script generation module and method for generating embedded script - Google Patents

Embedded script generation module and method for generating embedded script Download PDF

Info

Publication number
CN102004639A
CN102004639A CN201010295235XA CN201010295235A CN102004639A CN 102004639 A CN102004639 A CN 102004639A CN 201010295235X A CN201010295235X A CN 201010295235XA CN 201010295235 A CN201010295235 A CN 201010295235A CN 102004639 A CN102004639 A CN 102004639A
Authority
CN
China
Prior art keywords
script
module
embedded
server
request message
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.)
Pending
Application number
CN201010295235XA
Other languages
Chinese (zh)
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.)
Shenzhen Gongjin Electronics Co Ltd
Original Assignee
Shenzhen Gongjin Electronics 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 Shenzhen Gongjin Electronics Co Ltd filed Critical Shenzhen Gongjin Electronics Co Ltd
Priority to CN201010295235XA priority Critical patent/CN102004639A/en
Publication of CN102004639A publication Critical patent/CN102004639A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention discloses an embedded script generation module and a method for generating an embedded script. The method comprises the following steps of: writing a server script command statement according to pre-defined syntax, storing in a server, and allocating the embedded script generation module at the server; and when receiving a hypertext transfer protocol (HTTP) request message of a client at the server, performing the following operations by the embedded script generation module: firstly, analyzing the HTTP request message; secondly, interacting with a corresponding background functional module in the server according to an analysis result, performing corresponding service processing and returning a processing result by the background functional module, or analyzing the script command statement in a resource file requested by the client according to the analysis result and outputting a target file; and then, generating a HTTP response message by the server and returning to the client, wherein the HTTP response message carries the processing result and/or a target file. The method has the advantages that: occupied space is small, allocation can be easily realized, operation speed is high, the functional application is easy to expand and the like.

Description

The method that embedded script generation module and embedded script generate
Technical field
The present invention relates to WWW (World Wide Web is called for short WWW) areas of information technology, relate in particular to method and embedded script generation module that a kind of embedded script that is applied to the web service end generates.
Background technology
From Britain Di Mubainasili (Tim Berners-Lee) in 1989 exploitation after first WEB server and the WEB browser 2 years in the world, WWW in the world formally was born.Because WWW constantly advances for many years, therefore many outstanding server script language have been emerged in large numbers, (the Active Server Page of the Active Server Pages under the Window platform for example, abbreviate ASP as), multi-platform supertext pre-service language (Hypertext Preprocessor abbreviates PHP as), they all provide strong functions realization, the information management of safety and general background data base processing etc.
Exhausted most service end script has all possessed some identical characteristics in realization:
1, the execution of script depends on the running environment of service end.All have a script resolver in the running environment of service end, this script resolver carries out correct syntax parsing to script sentence, and carries out corresponding data manipulation according to the implication of grammer, and final script sentence can be converted into required result.For example the PHP language is exactly to operate under the environment of having disposed the Apache application program, and Apache carries out script to the PHP script sentence and resolves, but does not comprise the database that PHP need connect.
2, script is that mode with text is embedded into HTML (Hypertext Markup Language) (in (HyperText Mark-upLanguage is called for short HTML).Usually the source code of script is comprised by paired delimiter (claiming identifier again), for example PHP use "<? ", "?〉" as delimiter, it separates the script of client and service end.
3, the control statement of script substantially all is similar to the control statement of C language, for example: if statement, switch statement, do-while, for statement etc.
4, script is all on the request-response model based on HTML (Hypertext Markup Language) (HyperText Transfer Protocol, be called for short HTTP), and follows World Wide Web Consortium WEB 2.0 standards of (World Wide Web Consortium is called for short W3C).
In addition, angle from the resource use, these scripts also all possess following characteristics: grammer complexity, function are various, and the running environment that they relied on needs complicated deployment, the resource that takies service end is also many, so they are applicable to concurrent many etc. the WEB environment of hardware resource (comprising internal memory, disk space etc.) abundance, service application more complicated, the resource request of service end.
For specific WEB applied environment, when for example the WEB service end was on the embedded device, the server script language of main flow just seemed awkward.In general, the limited storage space of embedded device is difficult to satisfy the deployment of these main flow script running environment; In addition, the resource-constrained of embedded device needs ground save memory resource effectively.
Summary of the invention
One object of the present invention is to provide the method for a kind of embedded script generation module and the generation of embedded script, be applicable to specific WEB applied environment (being positioned on the embedded device) as the WEB service end, reduce taking up room of script command, effectively save memory source.
The embodiment of the invention is achieved in that
A kind of embedded script generation module is deployed in service end in the mode of non-resident process, and as an increase income subprocess of module of HTTPD, this module comprises: http protocol parsing module, data interaction module and script parsing module, wherein,
Described http protocol parsing module is used to resolve the received HTTP request message of described service end, for data interaction module and script parsing module provide the processing foundation;
Described data interaction module is used for carrying out data interaction according to the content and the described service end corresponding background functional module of described HTTP request message, carries out corresponding service by described background function module and handles and return result;
Described script parsing module is used for institute's requested resource file being resolved the export target file according to the content of described HTTP request message.
The method that a kind of embedded script generates, this method may further comprise the steps:
Write the server script command statement and be stored in service end according to predefined grammer, dispose above-mentioned embedded script generation module in service end simultaneously;
When service end received the HTTP request message of client, described embedded script generation module was carried out following operation: resolve described HTTP request message earlier; Carry out alternately according to corresponding background functional module in the content of described HTTP request message and the service end then, carry out corresponding service by this background function module and handle and return result, perhaps the script command statement in the client institute requested resource file is resolved and the export target file according to the content of described HTTP request message;
After described embedded script generation module operation was finished, described service end generated the http response message and is back to client, and carries described result and/or file destination in this http response message.
Wherein, described server script command statement is made up of beginning identifier, command word, command parameter, end identifier.
Wherein, described beginning identifier is "<? ", described end identifier is "?〉", described command word comprises get, mget, objget, setvar, setvaronce, if, include, echo, error.
Wherein, the server script language in the described embedded script generation module resolving resource file and the process of export target file may further comprise the steps:
Beginning identifier by searching coupling and end identifier are determined the script command statement in the described resource file;
For the non-script command statement in the described resource file, with its former state output; For the script command statement in the described resource file, carry out exporting after the respective handling according to wherein command word and command parameter.
The embodiment of the invention compared with prior art, beneficial effect is:
The WEB that the present invention is applied as embedded device uses customized server script command language, and adopt special-purpose embedded script generation module to carry out script and resolve, need not complex grammar operation, have take up room little, be easy to dispose, travelling speed is fast, function is used advantages such as being easy to expansion.
Description of drawings
The functional structure chart of the embedded script generation module that Fig. 1 provides for the embodiment of the invention;
The method flow diagram that the embedded script that Fig. 2 provides for the embodiment of the invention generates;
The processing flow chart of the script parsing module that Fig. 3 provides for the embodiment of the invention.
Embodiment
The present invention is based on the request-response model of HTTP(Hypertext Transport Protocol), and relies on increase income module and message-oriented middleware of HTTPD and realize the function that service end is required.Here said " request " refers to the HTTP message that sends from client, and " response " refers to from service end and return HTTP message to the Request Processing of client.
Core concept of the present invention is: be written as the WEB application quantity body customization server script command statement of embedded device and be stored in service end according to predefined fairly simple syntax rule; When service end receives the HTTP request message, carry out mutual resource file and export target file according to this message and background function module to carry out corresponding service processing or analysis request, then result and/or file destination are returned to client.
In order to make purpose of the present invention, technical scheme and advantage clearer,, the present invention is further elaborated below in conjunction with drawings and Examples.Should be appreciated that specific embodiment described herein only in order to explanation the present invention, and be not used in qualification the present invention.
In the present embodiment, the structure of embedded script generation module comprises as shown in Figure 1: http protocol parsing module, data interaction module and script parsing module, wherein,
The http protocol parsing module is used to resolve the received HTTP request message of described service end, for data interaction module and script parsing module provide the processing foundation;
The data interaction module is used for carrying out data interaction according to the parsing content and the service end corresponding background functional module of HTTP request message, carries out corresponding service by this background function module and handles and return result;
The script parsing module is used for according to the parsing content of HTTP request message client institute of institute requested resource file being resolved the export target file.
In the present embodiment, the method that embedded script generates may further comprise the steps as shown in Figure 1:
Before handling, must write the server script command statement and be stored in service end according to predefined grammer, dispose above-mentioned embedded script generation module in service end simultaneously; This syntax rule has defined embedded script command statement and has been made up of beginning identifier, command word, parameter, end identifier, wherein begin the start-stop that identifier and end identifier are used to define order, in the present embodiment, adopt "<? " "?〉" be identifier and end identifier to start with respectively; Also can nested another command statement in the command statement, for example<? command word ...<? command word ...? ...?; Command word is the part of most critical in the order, in order to operation and the employed method of determining to carry out, the number of parameters of different command words is different, even identical command word is under different condition judgment, number of parameters also can be different, in the present embodiment, command word comprises get, mget, objget, setvar, setvaronce, if, include, echo, error.
201, in service end, its HTTPD module of increasing income is carried out activity as a resident process, and the HTTP/HTTPS port is monitored;
202, increase income module when listening to the HTTP request that sends from client as HTTPD, the HTTP request message is decomposed one by one and pass to embedded script generation module as environmental variance decomposing the result who comes out; The HTTP request message is made up of request row, request head, null and four parts of request msg.
203, the http protocol parsing module of embedded script generation module is resolved the HTTP request message, determines the type of HTTP request and gets parms according to the type according to environmental variance; When request type was the GET mode, required parameter was all directly obtained from environmental variance; When request type was the POST mode, a parameters needed part was obtained from environmental variance, and another part obtains from the standard input;
Above-mentioned GET mode and POST mode are two kinds of the most frequently used request types; When client will read document from server, use the GET mode usually, require server that the resource of URL location is placed on the data division loopback of response message to client; When client provides information can use the POST mode more for a long time to server, the POST mode is encapsulated in required parameter in the HTTP request msg, can transferring large number of data.
204, according to the parameter of obtaining, the data interaction module of embedded script generation module is passed through message-oriented middleware, carry out data interaction with corresponding background function module, carry out corresponding service processing by this background function module, and obtain the result of success/failure of returning from message-oriented middleware; Perhaps, according to the parameter of obtaining, the script parsing module of embedded script generation module is resolved and the export target file client institute requested resource file.
205, the HTTPD of the service end module of increasing income generates HTTP request response message and above-mentioned result and/or file destination is packaged in wherein, and client is given in loopback afterwards.
In the above-mentioned steps 204, before resource file is resolved, need earlier resource file to be resolved to be put into buffer zone, because the limited storage space system of buffer zone, when the size of resource file to be resolved surpasses buffer zone big or small, this resource file can be divided into a plurality of parts and handle; When resolving, find out the embedded script command statement in the resource file to be resolved earlier, resolve back output for the embedded script command statement in the resource file, for then former state output of the non-embedded script command statement in the resource file; As shown in Figure 3, this process may further comprise the steps:
301, the script parsing module reads resource file to be resolved from buffer zone, because resource file belongs to source file, so wherein may comprise a large amount of embedded script commands;
302, from the original position of resource file to be resolved, one by one the beginning identifier in the chracter search resource file "<? " Judge whether to search the beginning identifier "<? ", if search, then execution in step 303; If not search, then execution in step 306;
303, from the beginning identifier that searched "<? " the position begin the end identifier in the search text content "?〉"; Judge whether to search end identifier "?〉", if search, then execution in step 304; If do not search, then execution in step 307;
304, from search nearest beginning identifier "<? " the position begin, search beginning identifier between an end identifier that searches "?〉" "<? ", if search, then execution in step 305; If do not search, then execution in step 308;
305, from searching the position of nearest end identifier "?〉", the end identifier in the search text content "? ", if search, then return execution in step 304, if do not search, then execution in step 307;
306, call output function all resource file former state output;
307, call output function first begin identifier "<? " content of text former state output before, and read untreated resource file again and fill up buffer zone, and be back to 302;
308, call analytical function and resolve beginning and end identifier matching complete and the longest script command statement that is found, and content is resolved in output.If resolve successfully, then read the resource file content that has been untreated again and fill up buffer zone, enter the text resolution of next round; If resolve failure, then output error message.
In the above-mentioned steps 308, the parsing of script command statement is comprised following step:
Step 1, command word and parameter in the whole script command statement are separated, be stored in the structure.For example, for the script command statement<? echo $var:test?, echo wherein is a command word, the meaning of expression is the value of query interface; Var:test represents a undefined or defined variable for the parameter of order echo.
Step 2, according to the command word of being obtained in the step 1, enter corresponding command word and handle in the function;
Step 3, enter after corresponding command word handles function,, carry out following operation according to the parameter of being obtained in the step 1:
1) whether judges in the parameter nested sub-script command; If be nested with sub-script command, then former state is exported whole sub-script command statement;
2) judge whether there is variable in the parameter,, then variable is replaced if there is variable; If there is not variable, then skip processing;
Wherein, variable has two kinds: first kind is the User Defined variable, and second kind is the variable that system generates automatically.For the User Defined variable, generally can directly replace processing, for example, for custom variable var:test, script command<? echo$var:test? in, can directly replace with 1 (value of supposing variable var:test here is 1); For the automatic variable that generates of system, because being system, this variable generates automatically, so this variable is represented that with adding two numerals wherein first digit is expressed as the nested number of plies, which variable second digit is expressed as, and for example expression is when the 2nd variable of anterior layer.
After step 4, script command were replaced and finish, this script returned with the form of whole text, because this text may also include script command, needed to be continued to resolve.
The above only is preferred embodiment of the present invention, not in order to restriction the present invention, all any modifications of being done within the spirit and principles in the present invention, is equal to and replaces and improvement etc., all should be included within protection scope of the present invention.

Claims (5)

1. an embedded script generation module is deployed in service end, it is characterized in that, this module comprises: http protocol parsing module, data interaction module and script parsing module, wherein,
Described http protocol parsing module is used to resolve the received HTTP request message of described service end, for data interaction module and script parsing module provide the processing foundation;
Described data interaction module is used for carrying out data interaction according to the content and the described service end corresponding background functional module of described HTTP request message, carries out corresponding service by described background function module and handles and return result;
Described script parsing module is used for institute's requested resource file being resolved the export target file according to the content of described HTTP request message.
2. method that embedded script generates is characterized in that this method may further comprise the steps:
Write the server script command statement and be stored in service end according to predefined grammer, dispose embedded script generation module as claimed in claim 1 in service end simultaneously;
When service end received the HTTP request message of client, described embedded script generation module was carried out following operation: resolve described HTTP request message earlier; Carry out alternately according to corresponding background functional module in the content of described HTTP request message and the service end then, carry out corresponding service by this background function module and handle and return result, perhaps the script command statement in the client institute requested resource file is resolved and the export target file according to the content of described HTTP request message;
After described embedded script generation module operation was finished, described service end generated the http response message and is back to client, and carries described result and/or file destination in this http response message.
3. the method that embedded script as claimed in claim 2 generates is characterized in that, described server script command statement is made up of beginning identifier, command word, command parameter, end identifier.
4. the method that embedded script as claimed in claim 3 generates, it is characterized in that, described beginning identifier is "<? " described end identifier is "?〉", and described command word comprises get, mget, objget, setvar, setvaronce, if, include, echo, error.
5. the method that embedded script as claimed in claim 3 generates is characterized in that the server script language in the described embedded script generation module resolving resource file and the process of export target file may further comprise the steps:
Beginning identifier by searching coupling and end identifier are determined the script command statement in the described resource file;
For the non-script command statement in the described resource file, with its former state output; For the script command statement in the described resource file, carry out exporting after the respective handling according to wherein command word and command parameter.
CN201010295235XA 2010-09-28 2010-09-28 Embedded script generation module and method for generating embedded script Pending CN102004639A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201010295235XA CN102004639A (en) 2010-09-28 2010-09-28 Embedded script generation module and method for generating embedded script

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201010295235XA CN102004639A (en) 2010-09-28 2010-09-28 Embedded script generation module and method for generating embedded script

Publications (1)

Publication Number Publication Date
CN102004639A true CN102004639A (en) 2011-04-06

Family

ID=43812021

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201010295235XA Pending CN102004639A (en) 2010-09-28 2010-09-28 Embedded script generation module and method for generating embedded script

Country Status (1)

Country Link
CN (1) CN102004639A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102843406A (en) * 2011-06-24 2012-12-26 深圳深讯和科技有限公司 Method and system of data interaction
CN103023765A (en) * 2012-12-04 2013-04-03 杭州迪普科技有限公司 Message processing method and message processing device based on scripting language
CN104104680A (en) * 2014-07-14 2014-10-15 中国电子科技集团公司第四十一研究所 Method for carrying out Rapid IO protocol decoding by means of formalization description language
CN104573520A (en) * 2013-10-09 2015-04-29 腾讯科技(深圳)有限公司 Method and device for detecting permanent type cross site scripting vulnerability
CN104834588A (en) * 2014-02-11 2015-08-12 腾讯科技(深圳)有限公司 Permanent residence cross site script vulnerability detection method and apparatus
CN102880454B (en) * 2012-06-15 2016-03-09 深圳市旭东数字医学影像技术有限公司 The method of the web displaying of three-dimensional medical model and system thereof
CN105516319A (en) * 2015-12-15 2016-04-20 华为技术有限公司 Method and device for managing HTTP messages

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050182828A1 (en) * 1999-04-21 2005-08-18 Interactual Technologies, Inc. Platform specific execution
CN1993694A (en) * 2004-07-30 2007-07-04 西门子公司 Method programme and system for the dynamic template-based generation of internet pages
CN101436148A (en) * 2007-11-14 2009-05-20 华为技术有限公司 Integrated client end and method for performing interaction of desktop application and network WEB application

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050182828A1 (en) * 1999-04-21 2005-08-18 Interactual Technologies, Inc. Platform specific execution
CN1993694A (en) * 2004-07-30 2007-07-04 西门子公司 Method programme and system for the dynamic template-based generation of internet pages
CN101436148A (en) * 2007-11-14 2009-05-20 华为技术有限公司 Integrated client end and method for performing interaction of desktop application and network WEB application

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
覃国蓉: "《基于B/S架构的软件项目实训》", 30 September 2004, article "应用服务器端相关组件", pages: 12-19 *

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102843406A (en) * 2011-06-24 2012-12-26 深圳深讯和科技有限公司 Method and system of data interaction
CN102843406B (en) * 2011-06-24 2015-04-22 深圳深讯和科技有限公司 Method and system of data interaction
CN102880454B (en) * 2012-06-15 2016-03-09 深圳市旭东数字医学影像技术有限公司 The method of the web displaying of three-dimensional medical model and system thereof
CN103023765A (en) * 2012-12-04 2013-04-03 杭州迪普科技有限公司 Message processing method and message processing device based on scripting language
CN103023765B (en) * 2012-12-04 2015-09-09 杭州迪普科技有限公司 A kind of message processing method based on script and device
CN104573520A (en) * 2013-10-09 2015-04-29 腾讯科技(深圳)有限公司 Method and device for detecting permanent type cross site scripting vulnerability
CN104573520B (en) * 2013-10-09 2019-02-01 腾讯科技(深圳)有限公司 The method and apparatus for detecting resident formula cross site scripting loophole
CN104834588A (en) * 2014-02-11 2015-08-12 腾讯科技(深圳)有限公司 Permanent residence cross site script vulnerability detection method and apparatus
CN104834588B (en) * 2014-02-11 2019-06-25 腾讯科技(深圳)有限公司 The method and apparatus for detecting resident formula cross site scripting loophole
CN104104680A (en) * 2014-07-14 2014-10-15 中国电子科技集团公司第四十一研究所 Method for carrying out Rapid IO protocol decoding by means of formalization description language
CN105516319A (en) * 2015-12-15 2016-04-20 华为技术有限公司 Method and device for managing HTTP messages
CN105516319B (en) * 2015-12-15 2019-02-19 华为技术有限公司 The method and apparatus for managing HTTP message

Similar Documents

Publication Publication Date Title
CN102004639A (en) Embedded script generation module and method for generating embedded script
CN100524295C (en) An arrangement and a method relating to access to internet content
US7383255B2 (en) Common query runtime system and application programming interface
US7941417B2 (en) Processing structured electronic document streams using look-ahead automata
CN101329665A (en) Method for analyzing marking language document and analyzer
CN112882974B (en) JSON data conversion method and device, computer equipment and storage medium
CN103164193B (en) A kind of rendering intent of template and device
CN112738216B (en) Equipment adaptation method, device, equipment and computer readable storage medium
CN104063401A (en) Webpage style address merging method and device
CN111654542B (en) Proxy server, execution server, reception device, and task execution method
US20030158894A1 (en) Multiterminal publishing system and corresponding method for using same
CN112328219A (en) Service access processing method, device and system and computer equipment
KR100379572B1 (en) A real-time mobile markup language translating system and a method automatically
CN111324619A (en) Object updating method, device, equipment and storage medium in micro service system
CN105989010B (en) Web page data generation method, Web server and Web application system
CN111611011B (en) JSON syntax extension method and analysis method and device supporting Blob data types
CN101039320A (en) Method and apparatus for providing an interface between a client application and a web service
CN115905310A (en) Data query method, data storage method, corresponding equipment, system and medium
CN102354318B (en) Device and method for reducing ad hoc query languages in database system
CN115186214A (en) Page configuration method and device, computer equipment and computer readable storage medium
CN114003583A (en) Method, device, medium and equipment for constructing target format data request body
Hoeller et al. Efficient XML data and query integration in the wireless sensor network engineering process
CN104965909A (en) Dynamic web content request handling method
CN116756184B (en) Database instance processing method, device, equipment, storage medium and program product
CN102821116B (en) A kind of online service provides method, device and information system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C53 Correction of patent of invention or patent application
CB02 Change of applicant information

Address after: 518057 Nanshan medical equipment Industrial Park, No. 1019 Nanhai Road, Shenzhen, Guangdong, Nanshan District B411-413

Applicant after: Shenzhen Gongjin Electronics Co., Ltd.

Address before: 518057 Nanshan medical equipment Industrial Park, No. 1019 Nanhai Road, Shenzhen, Guangdong, Nanshan District B411-413

Applicant before: Shenzhen Gongjin Electronics Co., Ltd.

C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20110406