CN102480464B - With service calling system and the method that contextual information is injected in web session decoupling - Google Patents

With service calling system and the method that contextual information is injected in web session decoupling Download PDF

Info

Publication number
CN102480464B
CN102480464B CN201010556912.9A CN201010556912A CN102480464B CN 102480464 B CN102480464 B CN 102480464B CN 201010556912 A CN201010556912 A CN 201010556912A CN 102480464 B CN102480464 B CN 102480464B
Authority
CN
China
Prior art keywords
service
user
information
context information
token
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201010556912.9A
Other languages
Chinese (zh)
Other versions
CN102480464A (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.)
Shanghai Baosight Software Co Ltd
Original Assignee
Shanghai Baosight Software 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 Shanghai Baosight Software Co Ltd filed Critical Shanghai Baosight Software Co Ltd
Priority to CN201010556912.9A priority Critical patent/CN102480464B/en
Publication of CN102480464A publication Critical patent/CN102480464A/en
Application granted granted Critical
Publication of CN102480464B publication Critical patent/CN102480464B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a kind of service calling system and method being automatically injected user context information with web session decoupling.This system includes: service call client, service dispatch top control module, one group of invoked service.The method includes: user initiates web request and calls background service;Obtain user configured context synchronizing information item;Web session information will need the item of information data syn-chronization synchronized in user context information token;By user context information token inject background service for;Service call, service code uses and safeguards the relevant information in user context information token;Monitor whether to occur the amendment of user context information token;By in the item of information data syn-chronization in the user context information token that amendment occurs to web session;Web request calls return.Present invention ensure that the full decoupled of backstage core code and web layer, it is ensured that core business logic reusability under different technologies route.

Description

With service calling system and the method that contextual information is injected in web session decoupling
Technical field
The present invention relates to a kind of service calling system injecting user context information in web session and method, Particularly relate to a kind of service calling system and side being automatically injected user context information with web session decoupling Method.
Background technology
Along with computer technology, network technology, the development of information technology, management information system based on web is met the tendency And give birth to.Web technology means of today are more and more ripe, perfect, based on B/S (Browser/Server, clear Look at device/server) the information system method of mode development is more and more universal, and this also will become now or even future Main flow in a very long time.
Web session (session), is the one for hold mode between client and web server Mechanism.Information technology based on web, is to rely on http protocol.Nothing due to http protocol itself State, the complicated applications deep to some is brought puzzlement, is therefore occurred in that web conversation mechanism is for solving This defect.Web session storage needs to keep the information of its state in whole user's access process, such as, log in The out of Memory that information or user need when browsing weblication.
The core business logic (service) on backstage, is often also required to access and use the user's phase in current sessions Pass information.The most general way is, directly web session information is passed to background service, and this causes Consequence is, backstage core business logic (service) code often couples excessive with web layer.And real industry The tension that business Logical processing unit once couples with web session, then cannot under different technology paths effectively Multiplexing, causes the very big wasting of resources, brings adverse influence also to follow-up support maintenance.
Summary of the invention
The technical problem to be solved in the present invention is to provide a kind of decoupling with web session and is automatically injected user's context The service calling system of information and method.Present invention can ensure that core business logic (service) is in different skills Under the realization mechanism of art route, reusable.
For solving above-mentioned technical problem, the present invention is automatically injected user context information with web session decoupling Service calling system, including:
Service call client, for initiating to call the request of background service, sets up session even with server Connect, and the most also include user related information;Wherein, user related information includes (but not only limiting In): subscriber identity information, affiliated organization, affiliated role, client ip address.
Service dispatch top control module, is deployed in server end, for intercepting and capturing the request that client sends, according to User related information in the session that request is set up, generates user context information token, and by user Context information token injects in the service of client call, after completing service call, checks user's context Whether the user data in information token is modified, and is set up according to the user data update request being modified User related information in session;
One group of invoked service, uses the user data in user context information token for when needed, And the user data in user context information token can be modified.Wherein, invoked service is logical Cross what one group of service code completed.This group service code gets number of users from user context information token Corresponding Business Processing is carried out after according to.
Described user context information token, is completed by processing code;This user context information token There is provided the Processing Interface of contextual information for external call, grasp in order to the reading and write carrying out contextual information Make, after there is write operation, the item of information being modified is marked.
Described service dispatch top control module, the user related information in the session set up according to request is raw Become user context information token, and according to the user data being modified in user context information token User related information in more newly requested set up session, by service dispatch top control module from user The configuration of synchronizing information item is read what required user profile item to be processed completed.Wherein, synchronizing information configuration Item is that permission is user-defined.
Described service dispatch top control module, is the user context information token write service operation that will generate The current thread space (Threadlocal) at place so that user context information token can be entered by service Row operation.
It addition, the present invention also provides for a kind of service being automatically injected user context information with web session decoupling The implementation method of calling system, including step:
Step one, the user of service call client initiate web request and call background service;
Step 2, service dispatch top control module obtain user configured context synchronizing information item, without Definition information items, then skip step 3;
Step 3, service dispatch top control module will need the item of information data syn-chronization synchronized in web session information To user context information token;
Step 4, service dispatch top control module by user context information token inject background service for;
Step 5, service call, service code uses and safeguards the number of users in user context information token According to;
Step 6, service dispatch top control module monitor whether the number of users in user context information token According to amendment, if it is not, then skip step 7, step 8;
Step 7, service dispatch top control module obtain user configured context synchronizing information item, without Definition information items, then skip step 8;
Step 8, service dispatch top control module need in the user context information token revised to synchronize by occurring Item of information data syn-chronization in web session information;
Step 9, web request call return.
Utilize the present invention can be automatically injected user context information, while ensureing conversation mechanism effectiveness, Guarantee the full decoupled of backstage core code (service) and web layer, thus ensure core business logic (service) Reusability (reusing) under the realization mechanism of different technologies route, it is to avoid cause the very big wasting of resources, It is simultaneously also beneficial to follow-up support maintenance.
Accompanying drawing explanation
The present invention is further detailed explanation with detailed description of the invention below in conjunction with the accompanying drawings:
Fig. 1 is the modular structure schematic diagram of present system;
Fig. 2 is that the one of the present invention is with reference to flowchart;
Fig. 3 is the configuration page schematic diagram of user configured context synchronizing information item;
Fig. 4 is that the background service of the present invention obtains user context information effect schematic diagram.
Detailed description of the invention
The present invention decouples the service calling system being automatically injected user context information, its mould with web session Block structure schematic diagram, as shown in Figure 1.This service calling system includes: service call client, and service is adjusted Degree top control module, one group of invoked service.
Service call client, for initiating to call the request of background service, sets up session even with server Connect, and the most also include user related information;Wherein, this user related information includes: Yong Hushen Part information, affiliated organization, affiliated role, client ip address.
Service dispatch top control module, is deployed in server end, intercepts and captures the request that client sends, according to request User related information in the session set up, generates user context information token, and by user's context Information token injects in the service (background service) of client call;After completing service call, check and use Whether the user data in the contextual information token of family is modified, according to the user data update request being modified User related information in the session set up.
When the user related information in the session set up according to request generates user context information token, And in the session set up according to the user data update request being modified in user context information token User related information time, service dispatch top control module can read required from the synchronizing information item of user configures User profile item to be processed completes aforesaid operations and (generates user context information token and more newly requested built The vertical user related information in session).Wherein, synchronizing information configuration item is that permission is user-defined.
One group of invoked service, uses the user data in user context information token for when needed, And the user data in user context information token can be modified.Wherein, invoked service is logical Cross what one group of service code completed.This group service code gets number of users from user context information token Corresponding Business Processing is carried out after according to.
Wherein, above-mentioned user context information token, completed by processing code.This user's context is believed Breath token provide the Processing Interface of contextual information for external call, in order to carry out contextual information reading and Write operation, is marked the item of information being modified after there is write operation.
For the above-mentioned service calling system being automatically injected user context information with web session decoupling, in fact Existing method, as in figure 2 it is shown, the concrete step that includes:
Step one, the user of service call client initiate web request and call background service;
Step 2, service dispatch top control module obtain user configured context synchronizing information item, without Definition information items, then skip step 3;Wherein, the configuration page of user configured context synchronizing information item Schematic diagram is as shown in Figure 3.Example from Fig. 3 understands, and user specifies needs web session and user Role belonging to the current user identities (loginname) that carries out in contextual information token synchronizing, user (userPost) item of information such as;
Step 3, service dispatch top control module will need the item of information data syn-chronization synchronized in web session information To user context information token;In this step, service dispatch top control module is joined according to user in step 2 The synchronizing information item put, obtains the value of item of information from web session, structuring user's contextual information token, These items of information and its value are put in this user context information token;
Step 4, service dispatch top control module by user context information token inject background service for, The current thread space at the user context information token write service operation place that will generate (Threadlocal) so that user context information token can be operated by service;Body in this step Show and be automatically injected user context information;
Step 5, service call, service code uses and safeguards the number of users in user context information token According to;In this step, by service call step, it is possible to achieve completely stable, only with what web session decoupled Vertical core business logic;
Step 6, service dispatch top control module monitor whether the number of users in user context information token According to amendment, if it is not, then skip step 7, step 8;
Step 7, service dispatch top control module obtain user configured context synchronizing information item, without Definition information items, then skip step 8;
Step 8, service dispatch top control module need in the user context information token revised to synchronize by occurring Item of information data syn-chronization in web session information;
Step 9, web request call return.
The exemplary process code snippet example of above-mentioned user context information token is as follows: first upper and lower from user Literary composition information token obtains the data item revised;Then according to user configured context synchronizing information item, Judge that this data item is the need of being synchronized in web session;If it is required, this item of information content is write web In session.
/**
* according to the user related information in the user data update session being modified.
*
*@param request the request
*/
public static void service2Web(HttpServletRequest request){
if(logger.isDebugEnabled()){
Logger.debug (" service2Web (HttpServletRequest)-getData="+getData ());
}
// obtain web session
HttpSession session=request.getSession ();
// from user context information token, obtain the data item revised
Map outSession=(Map) getOutSession ();
if(outSession!=null)
For (Iterator it=outSession.keySet () .iterator ();it.hasNext();){
String key=(String) it.next ();
If (needSync (key)) // judge that this data item is the need of being synchronized in web session
Object value=outSession.get (key);
Session.setAttribute (key, value);The write web session of // item of information content
}
}
}
Map outRequest=(Map) getOutRequest ();
if(outRequest!=null)
For (Iterator it=outRequest.keySet () .iterator ();it.hasNext();){
String key=(String) it.next ();
if(needSync(key)){
Object value=outRequest.get (key);
Request.setAttribute (key, value);
}
}
}
}
The typical application scenarios of a present invention is presented herein below: user initiates service invocation request, is intended to the page is believed Breath is safeguarded;In the session information that service call client is set up, specify the letters such as current user identities Breath;The service code offer service that the scheduling of service dispatch top control module is actual;Before this, service dispatch is total Control module structure user context information token, and according to the synchronizing information item configured by current user identities etc. This token, in user context information token, is injected background service thread space by synchronizing information simultaneously;After Platform service code carries out corresponding attended operation, obtains user's context from the thread space run simultaneously Information token, and from token, obtain current user identities information to record Operation Log.Typically service generation Code is as follows:
public EiInfo insert(EiInfo inInfo){
TEDFA00 tedfa00=new TEDFA00 ();
PlatMessageLogger.logMessage (EPResource.EP_1000, new String []
" page info ", " increasing newly " });
Int i=0;
For (i=0;I < inInfo.getBlock (DATA_BLOCK_ID) .getRowCount ();i++){
tedfa00.fromMap(inInfo.getBlock(DATA_BLOCK_ID).getRow(i));
// from user context information token (rather than session), obtain current user identities information
String userId=String.valueOf (UserSession.getLoginName ());
Tedfa00.rec_creator=userId;
Dao.update (" tedfa00.insert ", tedfa00);
}
InInfo.setMsgByKey (EPResource.EP_1000, new String []
String.valueOf (i), " increasing newly " });
return query(inInfo);
}
According to above-mentioned steps, can complete the decoupling of background service and web session and user context information from Dynamic injection.As shown in Figure 4, background service code, in the case of full decoupled with web layer, gets Current subscriber identity information (admin), and complete the record of Operation Log.Present invention ensure that backstage core Heart code (service) is full decoupled with web layer, thus ensures that core business logic (service) is in different skills Reusability under the realization mechanism of art route, it is to avoid cause the very big wasting of resources, is simultaneously also beneficial to follow-up Support maintenance.Therefore, the present invention is of many uses, as can be applicable to Baogang Stocks Trading Co.'s integral system, Baosteel Group's uniform accounting's system, Baosteel steel trade stock platform, precious letter scientific and technical innovation management system, Hongqiao General letter In breath tens large and medium-sized projects such as management system, Expo traffic information management system.

Claims (9)

1. it is automatically injected a service calling system for user context information, its feature with web session decoupling It is: including:
Service call client, for initiating to call the request of background service, sets up session even with server Connect, and the most also comprise user related information;
Service dispatch top control module, is deployed in server end, for intercepting and capturing the request that client sends, according to User related information in the session that request is set up, generates user context information token, and by user Context information token injects in the service of client call, after completing service call, checks user's context Whether the user data in information token is modified, and is set up according to the user data update request being modified User related information in session;
One group of invoked service, uses the user data in user context information token for when needed, And the user data in user context information token can be modified.
2. as claimed in claim 1 and web session decoupling is automatically injected the service of user context information and adjusts By system, it is characterised in that: in described service call client, user related information includes: user identity Information, affiliated organization, affiliated role, client ip address.
3. as claimed in claim 1 and web session decoupling is automatically injected the service of user context information and adjusts By system, it is characterised in that: described invoked service is completed by one group of service code, and this organizes clothes Business code carries out corresponding Business Processing after getting user data from user context information token.
4. as claimed in claim 1 and web session decoupling is automatically injected the service of user context information and adjusts By system, it is characterised in that: described user context information token, completed by processing code;This use Family contextual information token provides the Processing Interface of contextual information to supply external call, in order to carry out context letter The reading of breath and write operation, be marked the item of information being modified after there is write operation.
5. as claimed in claim 1 and web session decoupling is automatically injected the service of user context information and adjusts By system, it is characterised in that: in described service dispatch top control module, according in the session that request is set up User related information generate user context information token, and according in user context information token User related information in the session that the user data update request being modified is set up, is to pass through service dispatch Top control module reads what required user profile item to be processed completed from the synchronizing information item of user configures.
6. as claimed in claim 5 and web session decoupling is automatically injected the service of user context information and adjusts By system, it is characterised in that: described synchronizing information configuration item is that permission is user-defined.
7. as claimed in claim 1 and web session decoupling is automatically injected the service of user context information and adjusts By system, it is characterised in that: described service dispatch top control module, is the user context information that will generate The current thread space at token write service operation place so that service can be to user context information token Operate.
8. decoupling with web session as described in claim 1-7 any one is automatically injected user's context letter The implementation method of the service calling system of breath, including step:
Step one, the user of service call client initiate web request and call background service;
Step 2, service dispatch top control module obtain user configured context synchronizing information item, without Definition information items, then skip step 3;
Step 3, service dispatch top control module will need the item of information data syn-chronization synchronized in web session information To user context information token;
Step 4, service dispatch top control module by user context information token inject background service for;
Step 5, service call, service code uses and safeguards the number of users in user context information token According to;
Step 6, service dispatch top control module monitor whether the number of users in user context information token According to amendment, if it is not, then skip step 7, step 8;
Step 7, service dispatch top control module obtain user configured context synchronizing information item, without Definition information items, then skip step 8;
Step 8, service dispatch top control module need in the user context information token revised to synchronize by occurring Item of information data syn-chronization in web session information;
Step 9, web request call return.
9. as claimed in claim 8 and web session decoupling is automatically injected the service of user context information and adjusts By the implementation method of system, it is characterised in that: in described step 3, service dispatch top control module is according to step In two, user configured context synchronizing information item, obtains the value of item of information, structuring user's from web session These items of information and its value are put in this user context information token by contextual information token.
CN201010556912.9A 2010-11-24 2010-11-24 With service calling system and the method that contextual information is injected in web session decoupling Active CN102480464B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201010556912.9A CN102480464B (en) 2010-11-24 2010-11-24 With service calling system and the method that contextual information is injected in web session decoupling

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201010556912.9A CN102480464B (en) 2010-11-24 2010-11-24 With service calling system and the method that contextual information is injected in web session decoupling

Publications (2)

Publication Number Publication Date
CN102480464A CN102480464A (en) 2012-05-30
CN102480464B true CN102480464B (en) 2016-08-17

Family

ID=46092946

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201010556912.9A Active CN102480464B (en) 2010-11-24 2010-11-24 With service calling system and the method that contextual information is injected in web session decoupling

Country Status (1)

Country Link
CN (1) CN102480464B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2522432A (en) * 2014-01-23 2015-07-29 Locpin Ltd Computer system and method
CN107124388B (en) * 2016-02-25 2020-10-30 创新先进技术有限公司 Method, device and system for decoupling service and algorithm
CN109597820B (en) * 2018-12-07 2022-03-15 万翼科技有限公司 Client information synchronization method, device and computer readable storage medium
CN110475304B (en) * 2019-07-09 2021-10-26 华为技术有限公司 Radio resource control connection method and device
CN112422602B (en) * 2019-08-23 2022-02-22 阿里巴巴集团控股有限公司 Processing method, device and system for distributed coordination service
CN110737722B (en) * 2019-09-29 2022-07-05 国网福建省电力有限公司检修分公司 Substation monitoring background database, SCD and RCD synchronization system and method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101247395A (en) * 2008-03-13 2008-08-20 武汉理工大学 ISAPI access control system for Session ID fully transparent transmission
CN101299761A (en) * 2008-06-02 2008-11-05 国网信息通信有限公司 Method and system for processing service unitedly in abeyance
CN101534324A (en) * 2009-04-14 2009-09-16 河北全通通信有限公司 Dynamic invocation method of DotNet platform-based pluggable Web service
CN101646270A (en) * 2008-08-06 2010-02-10 华为技术有限公司 Method, system, mobility management entity and memory device for maintaining service continuity

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8732709B2 (en) * 2008-02-05 2014-05-20 Red Hat, Inc. Transaction management in a web service messaging environment
US8751788B2 (en) * 2008-06-10 2014-06-10 Paymetric, Inc. Payment encryption accelerator

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101247395A (en) * 2008-03-13 2008-08-20 武汉理工大学 ISAPI access control system for Session ID fully transparent transmission
CN101299761A (en) * 2008-06-02 2008-11-05 国网信息通信有限公司 Method and system for processing service unitedly in abeyance
CN101646270A (en) * 2008-08-06 2010-02-10 华为技术有限公司 Method, system, mobility management entity and memory device for maintaining service continuity
CN101534324A (en) * 2009-04-14 2009-09-16 河北全通通信有限公司 Dynamic invocation method of DotNet platform-based pluggable Web service

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Web服务安全会话管理的研究与实现;韩坤;《中国优秀硕士学位论文全文数据库 信息科技辑 》;20071115;全文 *

Also Published As

Publication number Publication date
CN102480464A (en) 2012-05-30

Similar Documents

Publication Publication Date Title
CN102480464B (en) With service calling system and the method that contextual information is injected in web session decoupling
US7886001B2 (en) Method and apparatus for controlling actions based on triggers in a conference
CN101472140B (en) System for distributing and requiring multimedia program and implementing method thereof
CN112187585B (en) Network protocol testing method and device
CN103838558B (en) Website build a station system and method, access website method and webpage adaptation system
CN108073828A (en) A kind of webpage integrity assurance, apparatus and system
CN110673993B (en) Fault injection method, platform and system
CN106599085A (en) Automatic refreshing method and device for web system configuration file
CN109040024A (en) A kind of resource access right control method and system
CN104580081A (en) Integrated SSO (single sign on) system
CN114979103A (en) Open API integration and management method and computer equipment
CN103001934A (en) Terminal application login method and terminal application login system
CN113673961A (en) Archive scheduling method based on workflow
CN108805516A (en) A kind of mobile office system based on ERP
CN113315750B (en) Kafka message issuing method, device and storage medium
CN106778306A (en) A kind of Permission Design method based on JavaEJB frameworks
CN112286985B (en) Clinical research statistical analysis system based on cloud computing
CN112925666A (en) Third-party API integrated management method based on groovy script technology
CN105740309A (en) Portal platform-based website content management system
CN116244682A (en) Database access method, device, equipment and storage medium
CN115733685A (en) Web session authentication management method and device, computer equipment and storage medium
CN112100187B (en) Student learning data storage method and device based on VueJS
CN112822432A (en) Video conference system based on block chain and access control method
CN107465641A (en) Based on three-tier architecture software systems and its data request method
CN112149106B (en) Login method, device, equipment and medium of enterprise private applet

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant