Summary of the invention
In view of this, the embodiment of the present invention provide the deployment of web services based on multi-tenant technology a kind of, call method and
Device, multiple operation systems can be deployed in the form of tenant in the same web service platform with realize business service every
From, in this way, local calling can be converted by cross-domain remote procedure call, so that the expense of network communication, interaction etc. is saved,
Improve response efficiency.
To achieve the above object, according to an aspect of an embodiment of the present invention, it provides a kind of based on multi-tenant technology
The dispositions method of web services.
A kind of dispositions method of the web services based on multi-tenant technology, by a no less than operation system with the shape of tenant
Formula is deployed to web service platform, which comprises obtains tenant's registration request of operation system, tenant's registration request
Configuration file and executable class file including the operation system;The configuration file is parsed, and is privately owned side therein
Method generates authorization check rule, and the load executable class file;Port is distributed for the operation system and is sent out
Cloth is web services.
Optionally, if the private method has dependence method, the authorization check rule is added to the dependence
In the note of method.
Optionally, after the tenant's registration request for obtaining operation system, further includes: by the executable of the operation system
The needs stated in class file are marked using the method for association's journey processing, and by the executable class file of the operation system
Class file after being updated to label.
Optionally, loading the executable class file includes: to parse to the executable class file, by into
The pause and wake-up for intervening code to realize general thread are woven into the method for line flag.
Optionally, after the tenant's registration request for obtaining operation system, further includes: pass through the executable class file
It is saved in database or disk after serializing and compression processing.
Optionally, if being saved in database, the compression processing includes: by the executable class file after serializing
Byte processing is carried out to be converted to bytecode;The bytecode is encoded based on Base64 coding mode;By each word
After the front two of corresponding 8 binary codes of section code is cut away, the binary code of all bytecodes is spliced;It is obtained to after splicing
To binary code be split according to every 8 for one section, and will turn after the every section of binary code decimal system obtained after segmentation
Byte is changed to carry out compression processing.
Optionally, if being saved in disk, the compression processing includes: that establish a longitudinal axis be the seat that 54 horizontal axis are 20
Parameter, and horizontal, axis of ordinates crosspoint indicates a Chinese character symbol with each unit;By the executable class after serializing
File carries out byte processing to be converted to bytecode, and is based on Base64 coding mode to the bytecode and encodes;Root
According to the corresponding relationship of preset coding and the coordinate value in reference axis, the corresponding horizontal, ordinate value of the coding is obtained, and will be right
The Chinese character symbol of the crosspoint of the longitudinal axis and horizontal axis answered is as compressed file.
According to another aspect of an embodiment of the present invention, a kind of deployment dress of web services based on multi-tenant technology is provided
It sets.
A kind of deployment device of the web services based on multi-tenant technology, by a no less than operation system with the shape of tenant
Formula is deployed to web service platform, and described device includes: request module, for obtaining tenant's registration request of operation system,
Tenant's registration request includes the configuration file and executable class file of the operation system;Loading module is parsed, is used for
The configuration file is parsed, and generates authorization check rule, and the load executable class text for private method therein
Part;Release module is serviced, for distributing port for the operation system and being issued as web services.
Optionally, if the private method has dependence method, the authorization check rule is added to the dependence
In the note of method.
Optionally, further include mark module, be used for: after the tenant's registration request for obtaining operation system, by the industry
The needs stated in the executable class file of business system are marked using the method for association's journey processing, and by the operation system
Executable class file be updated to label after class file.
Optionally, the parsing loading module is also used to: being parsed, will have been marked to the executable class file
The pause and wake-up for intervening code to realize general thread are woven into the method for note.
Optionally, further include file preserving module, be used for: after the tenant's registration request for obtaining operation system, by institute
Executable class file is stated to be saved in after serializing and compression processing in database or disk.
Optionally, if being saved in database, the compression processing includes: by the executable class file after serializing
Byte processing is carried out to be converted to bytecode;The bytecode is encoded based on Base64 coding mode;By each word
After the front two of corresponding 8 binary codes of section code is cut away, the binary code of all bytecodes is spliced;It is obtained to after splicing
To binary code be split according to every 8 for one section, and will turn after the every section of binary code decimal system obtained after segmentation
Byte is changed to carry out compression processing.
Optionally, if being saved in disk, the compression processing includes: that establish a longitudinal axis be the seat that 54 horizontal axis are 20
Parameter, and horizontal, axis of ordinates crosspoint indicates a Chinese character symbol with each unit;By the executable class after serializing
File carries out byte processing to be converted to bytecode, and is based on Base64 coding mode to the bytecode and encodes;Root
According to the corresponding relationship of preset coding and the coordinate value in reference axis, the corresponding horizontal, ordinate value of the coding is obtained, and will be right
The Chinese character symbol of the crosspoint of the longitudinal axis and horizontal axis answered is as compressed file.
Another aspect according to an embodiment of the present invention provides a kind of called side of web services based on multi-tenant technology
Method.
A kind of call method of the web services based on multi-tenant technology, the web services are according to such as embodiment of the present invention institute
The dispositions method of the web services based on multi-tenant technology provided is disposed, and the call method includes: to obtain user to initiate
Web services call request request type;When the request type is privately owned request, permission school is carried out to the user
It tests;When authorization check passes through, the web services call request is responded.
Optionally, carrying out authorization check to the user includes: to obtain the corresponding private method of the privately owned request;According to
The authorization check rule of the private method carries out authorization check to the user.
Optionally, carrying out authorization check to the user includes: to obtain the corresponding private method of the privately owned request;If institute
Private method is stated with dependence method, then obtains the authorization check rule from the note of the dependence method;According to described
Authorization check rule carries out authorization check to the user.
Another aspect according to an embodiment of the present invention provides a kind of calling dress of web services based on multi-tenant technology
It sets.
A kind of calling device of the web services based on multi-tenant technology, the web services are according to such as embodiment of the present invention institute
The dispositions method of the web services based on multi-tenant technology provided is disposed, and the calling device includes: that type obtains mould
Block, for obtaining the request type of Client-initiated web services call request;Authorization check module, for working as the request class
When type is privately owned request, authorization check is carried out to the user;Ask respond module, for responding when authorization check passes through
The web services call request.
Optionally, the authorization check module is also used to: obtaining the corresponding private method of the privately owned request;According to described
The authorization check rule of private method carries out authorization check to the user.
Optionally, the authorization check module is also used to: obtaining the corresponding private method of the privately owned request;If the private
There is method that there is dependence method, then obtains the authorization check rule from the note of the dependence method;According to the permission
Verification rule carries out authorization check to the user.
Another aspect according to an embodiment of the present invention, provides a kind of electronic equipment.
A kind of electronic equipment, comprising: one or more processors;Storage device, for storing one or more programs, when
One or more of programs are executed by one or more of processors, so that one or more of processors realize this hair
The deployment of web services based on multi-tenant technology provided by bright embodiment, call method.
It is according to an embodiment of the present invention in another aspect, providing a kind of computer-readable medium.
A kind of computer-readable medium is stored thereon with computer program, realizes this when described program is executed by processor
The deployment of web services based on multi-tenant technology provided by inventive embodiments, call method.
One embodiment in foregoing invention has the following advantages that or the utility model has the advantages that is infused by the tenant for obtaining operation system
Volume request, and parsing is carried out to the configuration file of operation system and thinks that private method generates authorization check rule, and load industry
After the executable class file of business system, port is distributed for operation system and is issued as web services, is realized based on multi-tenant
Multiple operation systems are deployed in by the dispositions method of the web services of technology, the technical know-how based on multi-tenant in the form of tenant
To realize that business service is isolated in the same web service platform, in this way, local can be converted by cross-domain remote procedure call
It calls, to save the expense of network communication, interaction etc., improves response efficiency.In addition, the present invention can also use the side of association's journey
Formula carries out business processing, assists for journey relative thread, and switching mode is more flexible, and can save the creation of thread, maintenance
Expense improves the handling capacity under distributed high concurrent;At the same time it can also which the executable class file of operation system is saved in
It in the corresponding database of the working space of web service platform or disk, and is not to be loaded directly into JVM, only when the industry
When business system is called, the dynamically load and execution of class file just will do it, and i.e. release resource after the completion of business processing,
The dynamically load and unloading of class are realized, to improve the effective rate of utilization of JVM.
Further effect possessed by above-mentioned non-usual optional way adds hereinafter in conjunction with specific embodiment
With explanation.
Specific embodiment
Below in conjunction with attached drawing, an exemplary embodiment of the present invention will be described, including the various of the embodiment of the present invention
Details should think them only exemplary to help understanding.Therefore, those of ordinary skill in the art should recognize
It arrives, it can be with various changes and modifications are made to the embodiments described herein, without departing from scope and spirit of the present invention.Together
Sample, for clarity and conciseness, descriptions of well-known functions and structures are omitted from the following description.
Existing multi-tenant system is mostly empty by the data of the srvice instance to support multi-tenant technology and configuration progress
Intend subregion to realize data and configuration isolation, but can not accomplish service isolation, so can have net when there is cross-domain access
The problem of network expense.In order to solve this technical problem, the present invention provides a kind of dispositions methods of web services, are rented based on more
Multiple operation systems are deployed in the same web service platform to realize business service by family technical know-how in the form of tenant
Isolation, in this way, local calling can be converted by cross-domain remote procedure call, to save opening for network communication, interaction etc.
Pin improves response efficiency.
The present invention by embedded web server as web service platform, and using the operation system example of outside as tenant
It is registered to web service platform, to realize the multi-tenant system of business service isolation.Specifically, operation system is being received
After exemplary tenant's registration request, a tenant identification is distributed for the tenant first;Later business can be obtained according to tenant identification
The corresponding configuration information of system, to parse service alias that the tenant externally provides, (or the domain name of the tenant, other tenant can
To access the tenant by the service alias), it is private services interface (only allow the tenant oneself call method), public
Service interface (method that all tenants can share), call external system service alias (i.e. current tenant needs to access
Other systems service alias), service interface (not distinguishing publicly-owned and privately owned), data source burst information etc.;Then, according to rent
The executable class file that family mark obtains operation system is simultaneously loaded into JVM, and when specific implementation need to be loaded based on the class of Java
Mechanism, due to the executable resource packet of tenant be in the load of java class loader less than place, therefore need voluntarily to load, add
The resource file of the tenant can also be woven into during load and (section is connected to other Application Types or object
On, and an object being notified is created, and such behavior is called weaving) it identifies, i.e., add in the byte code files after compiling
Add the tenant identification tenantId for not influencing program operation, stamp is carried out to tenant to realize;Finally, operation system example is sent out
Cloth is web services and is different from other web services with port.Wherein, when the configuration information to operation system parses,
It can also be private services interface configuration lock, so that the tenant for holding the lock could access the privately owned side of the operation system example
Method.
With reference to the accompanying drawing and specific embodiment introduces the dispositions methods of web services of the invention.
Fig. 1 is that the key step of the dispositions method of the web services according to an embodiment of the present invention based on multi-tenant technology is shown
It is intended to., as shown in Figure 1, a no less than operation system is deployed to web service platform in the form of tenant in order to realize, this
The dispositions method of the web services based on multi-tenant technology of inventive embodiments mainly includes the following steps, namely S101 to step
S103。
Step S101: obtaining tenant's registration request of operation system, and tenant's registration request includes the configuration text of operation system
Part and executable class file;
Step S102: parsing configuration file, and authorization check rule is generated for private method therein, and load can be held
Capable class file;
Step S103: port is distributed for operation system and is issued as web services.
Wherein, the resource files such as the executable class file of tenant can be carried out by data isolation by step S102, and
Carry out intervening the injection of code dynamically during being loaded to realize the pause and wake-up of general thread.By being privately owned
Method generates authorization check rule, to realize the private services interface of the only specified accessible operation system of user, from
And realize service isolation.After generating authorization check rule for private method, private method and authorization check rule can be protected
It is stored to the tenant registration center of web platform, in case subsequent user can be into when accessing the operation system by the web service platform
Row authorization check.
According to one embodiment of present invention, if private method has dependence method, authorization check rule is added to
In the note of dependence method.Wherein, dependence method refers to the method that the private method needs to rely on when being executed.If privately owned side
Method has dependence method, then when the private method is called to be executed, which needs to be performed, at this time can be according to this
The authorization check rule saved in the note of dependence method carries out authorization check to user.Wherein, authorization check rule is according to need
It wants flexibly to set, such as can be and generate token secret key pair and carry out authorization check using token secret key pair, be also possible to give birth to
Authorization check, etc. is carried out at check code and using check code.
According to one embodiment of present invention, after the tenant's registration request for obtaining operation system, can also include:
The needs stated in the executable class file of operation system are marked using the method for association's journey processing, and will
The executable class file of operation system is updated to the class file after label.
Also, the executable class file of load includes:
Executable class file is parsed, intervenes code for being woven into the method being marked to realize general line
The pause and wake-up of journey.
By the technical solution of the embodiment, that is, it the mode of association's journey can be used to carry out business processing, assist journey (coroutine)
As subroutine and a kind of program assembly.Subroutine is a part of code of some main program, which executes specific
Task and relatively independent with other codes in main program, for opposite subroutine, association Cheng Gengwei generally and flexibly, but in reality
It tramples middle extensive like that using no subroutine.It assists journey with thread in contrast, multiple threads are relatively independent, there is the upper and lower of oneself
Text, but switching is controlled by system;And multiple association's journeys are also relatively independent, there is the context of oneself, but its switching is controlled by oneself
System is controlled by currently assisting journey to be switched to other association's journeys by currently assisting journey.Therefore, it assists for journey relative thread, switching mode
It is more flexible, and the creation of thread, maintenance costs can be saved, improve the handling capacity under distributed high concurrent.
The present invention is based on the lightweights of JVM to assist Cheng Jinhang business processing, built-in Classloader according to the present invention and JVM generation
Device is managed when carrying out System build to class file, identification and record class or method with association's journey mark, and association's journey mark will be contained
A user-defined file is recorded in the class of knowledge or the position of method --- in " association's journey file ", pass through matching standard in load
Java bytecode file (.class) and association's journey file are woven into class and method containing association's journey mark intervenes code to realize
The pause (yield method) and wake-up (notify method) of general thread.The present invention assists the yield method of journey to realize will not be
EMS memory occupation is generated on JVM will not hang up thread, so as to save the creation and maintenance costs of thread.
In distributed deployment environment, association's journey tupe of the invention is acted by the yield to association's journey by business system
System control thread suspends and continues to execute, and the processing of distributed transaction not will cause the hang-up and resistance of thread under concurrent environment
Plug.
According to another embodiment of the invention, after the tenant's registration request for obtaining operation system, can also include:
Executable class file is saved in database or disk after serializing and compression processing.
According to this embodiment, configuration of the web service platform in the tenant's registration request and operation system for obtaining operation system
After file and executable class file, the executable class file of operation system can also be saved in web service platform
It in the corresponding database of working space or disk, and is not to be loaded directly into JVM, only when the operation system is called
When, it just will do it the dynamically load and execution of class file, and i.e. release resource after the completion of business processing, realize the dynamic of class
State load and unloading, to improve the effective rate of utilization of JVM.
According to another embodiment, the present invention can by it is aforementioned include assist journey file executable class file pass through sequence
It is saved in disk or database after change and compression processing, only can just be moved according to association's journey file when calling and assisting Cheng Fangfa
State load and the weaving for intervening code.Association Cheng Fangfa is not needed such as, which will not produce extra stack frame on JVM.As the web
When service is called, Classloader can read association's journey file from compressed data, so that obtaining includes the method for assisting journey mark
With the method row and parameter name and request type for needing yield (thread pause).Classloader is according to parameter name and asks
It seeks type load destination service class and is woven into intervention code, the side of throw exception can be passed through when program goes to yield method
Formula, which terminates, to be executed, and the stack top of destination service class is saved in using the implementing result stopped when executing as median, waits next time
When initiating the calling to the web services, directly from the position that last time is suspended load median as variate-value and push operation stack.
In large-scale business integration environment, the present invention passes through the serializing and unserializing to executable class file
Will assist journey file that disk is written, which will not be lost the memory of JVM.
The serializing of object and byte (byte) change carry out documentation again when by operation, can be easily by class file
It stores on the storage mediums such as disk, database.According to definition of the different media to size of data, the different present invention provide two
Kind dynamic compression mode.A byte is occupied in windows or Linux system Chinese and English letter, number, English DBC case,
Varchar type Chinese is consistent with English occupancy in the relevant databases such as mysql.
In one embodiment of the invention, if being saved in database, compression processing includes:
Executable class file after serializing is subjected to byte processing to be converted to bytecode;
Bytecode is encoded based on Base64 coding mode;
After the front two of corresponding 8 binary codes of each bytecode is cut away, by the binary system of all bytecodes
Code splicing;
To the binary code obtained after splicing according to every 8 be one section of every section two that is split, and will be obtained after segmentation
Byte is converted to after the ary codes decimal system to carry out compression processing.
Wherein, Base64 is one of the coding mode that transmission 8Bit (position) bytecode is most commonly used on network,
Base64 is exactly a kind of method for indicating binary data based on 64 printable characters.
In the magnetic disk media of server, by the Base64 coded treatment to byte data, it can generate by capital letter
Female (A-Z), lowercase (a-z), digital (0-9), English DBC case (+/) sequence that totally 64 symbol arrangements combinations generate
Change file, initially set up the corresponding relationship of 0-63 and 64 symbol, binarization then is carried out to 0-63, later by the two of 8
Ary codes cut away front two and next treated binary code splices, and every 8 one section of segmentation are then carried out, to segmentation
Treated the binary code decimal system simultaneously obtains the output of its byte value to realize that compression processing, decompression process are opposite.
In another embodiment of the present invention, if being saved in disk, compression processing includes:
Establishing a longitudinal axis is the reference axis that 54 horizontal axis are 20, and horizontal, axis of ordinates the crosspoint table with each unit
Show a Chinese character symbol;
Executable class file after serializing is subjected to byte processing to be converted to bytecode, and bytecode is based on
Base64 coding mode is encoded;
According to the corresponding relationship of preset coding and the coordinate value in reference axis, the corresponding horizontal, ordinate value of coding is obtained,
And using the Chinese character symbol of the crosspoint of the corresponding longitudinal axis and horizontal axis as compressed file.
Wherein, it 54 refers to sharing 54 by capitalization (A-Z), lowercase (a-z) and English DBC case (+/)
Symbol, 20 refer to the number of possible duplicate symbol.Specifically, it for the storage of class file in relevant database, can build
A vertical longitudinal axis is the reference axis that 54 longitudinal axis horizontal axis are 20, each unit transverse and longitudinal axis crosspoint replaces position with a Chinese character symbol
It sets, the bytecode after byte is subjected to Base64 processing, connected letter is abbreviated, such as sssss is denoted as initial value
Add the form s5 of number, s5 (wherein, the i.e. corresponding ordinate of orthogonal axes of first character s, second character are then found in reference axis
5 i.e. corresponding horizontal axis coordinates) it corresponding Chinese character symbol and exports to realize that compression processing, decompression process are opposite.
Fig. 2 is the system architecture diagram of the embodiment of the present invention.As shown in Fig. 2, web service platform system of the invention is mainly wrapped
Include 3 part of monitoring management platform, web server and database.Wherein, monitoring management platform is used for web services of the invention
Plateform system is monitored and manages, and user submits tenant's registration request of operation system, Yi Jiye by monitoring management platform
Executable resource file (such as: * .jar, * .zip, * .war, * .tar) and configuration information of business system etc.;Web server
It is to provide the container for being deployed in the running environment of each operation system of web service platform, wherein solid line indicates public method and number
According to access, dotted line indicate private method and data use;Database is used to store the application data of each operation system.
Fig. 3 is the deployment flow diagram of the web services of the embodiment of the present invention.As shown in figure 3, logical with an operation system
It crosses for web service platform progress tenant's registration, the deployment process of web services mainly comprises the following steps that
Step S301: user uploads the engineering compressed package of operation system by monitoring management platform, wherein engineering compressed package
The interior configuration file including operation system and executable class file etc.;
The middle control of step S302:web service platform dials device and judges present node state and distribute to different processing
Device, wherein if " _ f_=0 ", the i.e. operation system are to upload engineering compressed package for the first time, then transmit corresponding engineering compressed package
To numbering device;
Step S303: numbering device parses the configuration file in engineering compressed package, external to obtain the operation system
The service alias of offer, private services interface, common services interface, service alias, the service interface for calling external system, data
The information such as source fragment id;Also, the needs stated in the executable class file in engineering compressed package are used into association's journey processing
Method is renamed to realize and add association's journey mark, and the format of renaming is, for example: original name _ coroutine_ assists Cheng Fangfa
Name, and the position for being added to the method for association's journey mark is recorded;Finally, by treated, file is moved to web services
The working space of platform, and be saved in the corresponding disk of working space or database;
The middle control of step S304:web service platform dials device after numbering device completion processing, judges present node again
State simultaneously distributes to different processors, at this point, " _ f_=1 ", indicates that file has been transferred to the working space of web service platform,
Then the task of present node is distributed into initializer;
Step S305: initializer is used to the operation system for the working space for uploading to web service platform being deployed to JVM
In, specifically, customized Classloader is called by the proxy server of JVM to load executable class file, and parse wherein
File containing association's journey mark is to generate association's journey file;Configuration file is parsed, generates token secret key pair for private method, and should
Private method and code key are pushed to registration center;Then search for whether the private method has dependence method in registration center, if any,
Then code key is saved in the annotation file of the dependence method;
The middle control of step S306:web service platform dials device after initializer completion processing, and prosthomere is worked as in judgement again
Dotted state returns to monitoring management platform file and uploads successfully at this point, " _ f_=2 ", indicates that file has been loaded, has been parsed;
Step S307: user, which triggers, to be executed;
The middle control of step S308:web service platform dials device and assigns the task to separator;
Step S309: separator obtains an available port from the port pool of registration center, and by the operation system
It is issued as web services.
Other operation systems are identical as above-mentioned process by the process that web service platform carries out tenant's registration.In this way, i.e.
Multiple operation systems can be registered to unified web service platform in the form of tenant, to realize service isolation.
Fig. 4 is that the main modular of the deployment device of the web services according to an embodiment of the present invention based on multi-tenant technology is shown
It is intended to.As shown in figure 4, a no less than operation system is deployed to web service platform, this hair in the form of tenant in order to realize
The deployment device 400 of the web services based on multi-tenant technology of bright embodiment mainly adds including request module 401, parsing
Carry module 402 and service release module 403.
Request module 401 is used to obtain tenant's registration request of operation system, and tenant's registration request includes institute
State the configuration file and executable class file of operation system;
Parsing loading module 402 generates authorization check rule for parsing the configuration file, and for private method therein
Then, and the load executable class file;
Service release module 403 is used to distribute port for the operation system and is issued as web services.
According to one embodiment of present invention, if the private method has dependence method, the authorization check is advised
Then it is added in the note of the dependence method.
According to another embodiment of the invention, the deployment device 400 of the web services based on multi-tenant technology can also wrap
Mark module (not shown) is included, is used for:
After the tenant's registration request for obtaining operation system, it will be stated in the executable class file of the operation system
Needs be marked using the method for association's journey processing, and after the executable class file of the operation system is updated to label
Class file.
According to an embodiment of the invention, parsing loading module 402 can be also used for:
The executable class file is parsed, it is logical to realize intervention code will to be woven into the method being marked
With the pause and wake-up of thread.
According to another embodiment of the invention, the deployment device 400 of the web services based on multi-tenant technology can also wrap
File preserving module (not shown) is included, is used for:
After the tenant's registration request for obtaining operation system, by the executable class file by serializing and compression
It is saved in after processing in database or disk.
According to one embodiment of present invention, if being saved in database, compression processing includes:
The executable class file after serializing is subjected to byte processing to be converted to bytecode;
The bytecode is encoded based on Base64 coding mode;
After the front two of corresponding 8 binary codes of each bytecode is cut away, by the binary system of all bytecodes
Code splicing;
To the binary code obtained after splicing according to every 8 be one section of every section two that is split, and will be obtained after segmentation
Byte is converted to after the ary codes decimal system to carry out compression processing.
According to another embodiment of the invention, if being saved in disk, compression processing includes:
Establishing a longitudinal axis is the reference axis that 54 horizontal axis are 20, and horizontal, axis of ordinates the crosspoint table with each unit
Show a Chinese character symbol;
The executable class file after serializing is subjected to byte processing to be converted to bytecode, and to the word
Section code is based on Base64 coding mode and is encoded;
According to the corresponding relationship of the coordinate value in preset coding and reference axis, corresponding horizontal, the vertical seat of the coding is obtained
Scale value, and using the Chinese character symbol of the crosspoint of the corresponding longitudinal axis and horizontal axis as compressed file.
According to another aspect of the present invention, the call method and device of a kind of web services are additionally provided.Wherein, which takes
Business is disposed according to the method in previous embodiment.The call method of the web services mainly includes the following steps:
Obtain the request type of Client-initiated web services call request;
When the request type is privately owned request, authorization check is carried out to the user;
When authorization check passes through, the web services call request is responded.
According to one embodiment of present invention, carrying out authorization check to the user includes:
Obtain the corresponding private method of the privately owned request;
Authorization check is carried out to the user according to the authorization check rule of the private method.
According to another embodiment of the invention, carrying out authorization check to the user includes:
Obtain the corresponding private method of the privately owned request;
If the private method has dependence method, the authorization check rule are obtained from the note of the dependence method
Then;
Authorization check is carried out to the user according to the authorization check rule.
Fig. 5 is the call flow schematic diagram of the web services of the embodiment of the present invention.As shown in figure 5, one embodiment of the invention
The call flows of web services mainly comprise the following steps that
Step S501: user initiates the call request of web services to web service platform, is not necessarily in call request at this time
Distinguish web services equipment, it is only necessary to add the corresponding port numbers port of web services, call request is, for example: http: //
xxxx:port/x/x;
Step S502: after request reaches target web service, the IOC of web service platform (Inversion of Control,
Control reversion) controller carry out business processing before authorization check, due to web services have publicly-owned method and private method,
Therefore authorization check need to be carried out to user;
Step S503:IOC controller judges request type, when request type is privately owned request, is weighed by encryption equipment
Limit verification;
Step S504: encryption equipment obtained first from registration center target web service the corresponding code key of private method or
Person's code key corresponding with the code key key of dependence method of the private method;Then, whether the composition of encryption equipment verification key is to close
Whether whether (such as: whether meeting create-rule, and be what this web service platform was issued, etc.) of method and code key close
Method;If it is, verification passes through, IOC controller is sent to by code key or by verification successful information;
Code key is sent target web service by step S505:IOC controller;
Step S506: target web service requests to rely on service (relying on the corresponding service of method) progress business according to code key
Processing;
Step S507: service is relied on after receiving the request of target web service, will pass through execution by IOC control system
Above-mentioned step S502-S504 carries out authorization check again, and after verification passes through, by IOC controller by code key be sent to according to
Rely service;
Step S508: service return response result is relied on to target web service;
Step S509: target web service return response result.
According to an embodiment of the invention, the calling device of the web services based on multi-tenant technology specifically includes that
Type acquisition module, for obtaining the request type of Client-initiated web services call request;
Authorization check module, for carrying out authorization check to the user when the request type is privately owned request;
Ask respond module, for when authorization check passes through, responding the web services call request.
Wherein, authorization check module can be also used for:
Obtain the corresponding private method of the privately owned request;
Authorization check is carried out to the user according to the authorization check rule of the private method.
In addition, authorization check module can be also used for:
Obtain the corresponding private method of the privately owned request;
If the private method has dependence method, the authorization check rule are obtained from the note of the dependence method
Then;
Authorization check is carried out to the user according to the authorization check rule.
Technical solution according to an embodiment of the present invention, by obtaining tenant's registration request of operation system, and to business system
The configuration file of system carries out parsing and thinks that private method generates authorization check rule, and the executable class of load operation system
After file, port is distributed for operation system and is issued as web services, realizes the portion of the web services based on multi-tenant technology
Multiple operation systems are deployed in the same web service platform by arranging method, the technical know-how based on multi-tenant in the form of tenant
On with realize business service be isolated, in this way, local calling can be converted by cross-domain remote procedure call, to save network
The expense of communication, interaction etc., improves response efficiency.In addition, the present invention can also use the mode of association's journey to carry out business processing, assist
For journey relative thread, switching mode is more flexible, and can save the creation of thread, maintenance costs, improves distributed high
And the handling capacity given;At the same time it can also which the executable class file of operation system to be saved in the work sky of web service platform
Between in corresponding database or disk, and be not to be loaded directly into JVM, only when the operation system is called, just meeting
The dynamically load and execution of class file are carried out, and i.e. release resource after the completion of business processing, realizes the dynamically load of class
And unloading, to improve the effective rate of utilization of JVM.
Fig. 6 shows the deployment that can apply the web services based on multi-tenant technology of the embodiment of the present invention, call method
Or the exemplary system architecture 600 of the deployment of the web services based on multi-tenant technology, calling device.
As shown in fig. 6, system architecture 600 may include terminal device 601,602,603, network 604 and server 605.
Network 604 between terminal device 601,602,603 and server 605 to provide the medium of communication link.Network 604 can be with
Including various connection types, such as wired, wireless communication link or fiber optic cables etc..
User can be used terminal device 601,602,603 and be interacted by network 604 with server 605, to receive or send out
Send message etc..Various telecommunication customer end applications, such as the application of shopping class, net can be installed on terminal device 601,602,603
(merely illustrative) such as the application of page browsing device, searching class application, instant messaging tools, mailbox client, social platform softwares.
Terminal device 601,602,603 can be the various electronic equipments with display screen and supported web page browsing, packet
Include but be not limited to smart phone, tablet computer, pocket computer on knee and desktop computer etc..
Server 605 can be to provide the server of various services, such as utilize terminal device 601,602,603 to user
The shopping class website browsed provides the back-stage management server (merely illustrative) supported.Back-stage management server can be to reception
To the data such as information query request analyze etc. processing, and by processing result (such as target push information, product letter
Breath -- merely illustrative) feed back to terminal device.
It should be noted that the deployment of the web services based on multi-tenant technology provided by the embodiment of the present invention, called side
Method is generally executed by server 605, and correspondingly, the deployment of the web services based on multi-tenant technology, calling device are generally positioned at
In server 605.
It should be understood that the number of terminal device, network and server in Fig. 6 is only schematical.According to realization need
It wants, can have any number of terminal device, network and server.
Below with reference to Fig. 7, it illustrates the calculating of the terminal device or server that are suitable for being used to realize the embodiment of the present invention
The structural schematic diagram of machine system 700.Terminal device or server shown in Fig. 7 are only an example, should not be to of the invention real
The function and use scope for applying example bring any restrictions.
As shown in fig. 7, computer system 700 includes central processing unit (CPU) 701, it can be read-only according to being stored in
Program in memory (ROM) 702 or be loaded into the program in random access storage device (RAM) 703 from storage section 708 and
Execute various movements appropriate and processing.In RAM 703, also it is stored with system 700 and operates required various programs and data.
CPU 701, ROM 702 and RAM 703 are connected with each other by bus 704.Input/output (I/O) interface 705 is also connected to always
Line 704.
I/O interface 705 is connected to lower component: the importation 706 including keyboard, mouse etc.;It is penetrated including such as cathode
The output par, c 707 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 708 including hard disk etc.;
And the communications portion 709 of the network interface card including LAN card, modem etc..Communications portion 709 via such as because
The network of spy's net executes communication process.Driver 710 is also connected to I/O interface 705 as needed.Detachable media 711, such as
Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 710, in order to read from thereon
Computer program be mounted into storage section 708 as needed.
Particularly, disclosed embodiment, the process described above with reference to flow chart may be implemented as counting according to the present invention
Calculation machine software program.For example, embodiment disclosed by the invention includes a kind of computer program product comprising be carried on computer
Computer program on readable medium, the computer program include the program code for method shown in execution flow chart.?
In such embodiment, which can be downloaded and installed from network by communications portion 709, and/or from can
Medium 711 is dismantled to be mounted.When the computer program is executed by central processing unit (CPU) 701, system of the invention is executed
The above-mentioned function of middle restriction.
It should be noted that computer-readable medium shown in the present invention can be computer-readable signal media or meter
Calculation machine readable storage medium storing program for executing either the two any combination.Computer readable storage medium for example can be --- but not
Be limited to --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor system, device or device, or any above combination.Meter
The more specific example of calculation machine readable storage medium storing program for executing can include but is not limited to: have the electrical connection, just of one or more conducting wires
Taking formula computer disk, hard disk, random access storage device (RAM), read-only memory (ROM), erasable type may be programmed read-only storage
Device (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device,
Or above-mentioned any appropriate combination.In the present invention, computer readable storage medium can be it is any include or storage journey
The tangible medium of sequence, the program can be commanded execution system, device or device use or in connection.And at this
In invention, computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal,
Wherein carry computer-readable program code.The data-signal of this propagation can take various forms, including but unlimited
In electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be that computer can
Any computer-readable medium other than storage medium is read, which can send, propagates or transmit and be used for
By the use of instruction execution system, device or device or program in connection.Include on computer-readable medium
Program code can transmit with any suitable medium, including but not limited to: wireless, electric wire, optical cable, RF etc. are above-mentioned
Any appropriate combination.
Flow chart and block diagram in attached drawing are illustrated according to the system of various embodiments of the invention, method and computer journey
The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation
A part of one module, program segment or code of table, a part of above-mentioned module, program segment or code include one or more
Executable instruction for implementing the specified logical function.It should also be noted that in some implementations as replacements, institute in box
The function of mark can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are practical
On can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it wants
It is noted that the combination of each box in block diagram or flow chart and the box in block diagram or flow chart, can use and execute rule
The dedicated hardware based systems of fixed functions or operations is realized, or can use the group of specialized hardware and computer instruction
It closes to realize.
Being described in the embodiment of the present invention involved unit or module can be realized by way of software, can also be with
It is realized by way of hardware.Described unit or module also can be set in the processor, for example, can be described as:
A kind of processor includes request module, parsing loading module and service release module.Wherein, the name of these units or module
Claim not constituting the restriction to the unit or module itself under certain conditions, for example, request module can also be described
For " for obtaining the module of tenant's registration request of operation system ".
As on the other hand, the present invention also provides a kind of computer-readable medium, which be can be
Included in equipment described in above-described embodiment;It is also possible to individualism, and without in the supplying equipment.Above-mentioned calculating
Machine readable medium carries one or more program, when said one or multiple programs are executed by the equipment, makes
Obtaining the equipment includes: the tenant's registration request for obtaining operation system, and tenant's registration request includes matching for the operation system
Set file and executable class file;The configuration file is parsed, and generates authorization check rule for private method therein, with
And the load executable class file;Port is distributed for the operation system and is issued as web services.
Technical solution according to an embodiment of the present invention, by obtaining tenant's registration request of operation system, and to business system
The configuration file of system carries out parsing and thinks that private method generates authorization check rule, and the executable class of load operation system
After file, port is distributed for operation system and is issued as web services, realizes the portion of the web services based on multi-tenant technology
Multiple operation systems are deployed in the same web service platform by arranging method, the technical know-how based on multi-tenant in the form of tenant
On with realize business service be isolated, in this way, local calling can be converted by cross-domain remote procedure call, to save network
The expense of communication, interaction etc., improves response efficiency.In addition, the present invention can also use the mode of association's journey to carry out business processing, assist
For journey relative thread, switching mode is more flexible, and can save the creation of thread, maintenance costs, improves distributed high
And the handling capacity given;At the same time it can also which the executable class file of operation system to be saved in the work sky of web service platform
Between in corresponding database or disk, and be not to be loaded directly into JVM, only when the operation system is called, just meeting
The dynamically load and execution of class file are carried out, and i.e. release resource after the completion of business processing, realizes the dynamically load of class
And unloading, to improve the effective rate of utilization of JVM.
Above-mentioned specific embodiment, does not constitute a limitation on the scope of protection of the present invention.Those skilled in the art should be bright
It is white, design requirement and other factors are depended on, various modifications, combination, sub-portfolio and substitution can occur.It is any
Made modifications, equivalent substitutions and improvements etc. within the spirit and principles in the present invention, should be included in the scope of the present invention
Within.