CN101901163A - Method and device for distributing messages - Google Patents

Method and device for distributing messages Download PDF

Info

Publication number
CN101901163A
CN101901163A CN2010102305769A CN201010230576A CN101901163A CN 101901163 A CN101901163 A CN 101901163A CN 2010102305769 A CN2010102305769 A CN 2010102305769A CN 201010230576 A CN201010230576 A CN 201010230576A CN 101901163 A CN101901163 A CN 101901163A
Authority
CN
China
Prior art keywords
request message
controller
service class
advance
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.)
Granted
Application number
CN2010102305769A
Other languages
Chinese (zh)
Other versions
CN101901163B (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.)
Beijing Cennavi Technologies Co Ltd
Original Assignee
Beijing Cennavi Technologies 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 Beijing Cennavi Technologies Co Ltd filed Critical Beijing Cennavi Technologies Co Ltd
Priority to CN2010102305769A priority Critical patent/CN101901163B/en
Publication of CN101901163A publication Critical patent/CN101901163A/en
Priority to PCT/CN2011/074538 priority patent/WO2012006908A1/en
Application granted granted Critical
Publication of CN101901163B publication Critical patent/CN101901163B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/18Information format or content conversion, e.g. adaptation by the network of the transmitted or received information for the purpose of wireless delivery to users or terminals
    • H04W4/185Information format or content conversion, e.g. adaptation by the network of the transmitted or received information for the purpose of wireless delivery to users or terminals by embedding added-value information into content, e.g. geo-tagging

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the invention discloses a method and a device for distributing messages, relating to the field of network geographic information. The method is used for applying Spring MVC frames to Web-GiIS. In the method, a server acquires a request message transmitted by a client and the request message is in the same form with a preset message form; the server distributes the request message to a corresponding controller for processing according to the preset mapping relation between the request message and controller identifications; and the server returns results processed and obtained by the controller according to the request message to the client. The method and device for distributing messages in the embodiment of the invention can be applied to the fields of traffic information and numerical maps.

Description

The method and apparatus of assignment messages
Technical field
The present invention relates to the network geographic information field, relate in particular to a kind of method and apparatus of assignment messages.
Background technology
The MVC Design Mode is the abbreviation of " Model-View-Controller ", and is promptly mandatory separately the input of an application, processing and output flow process.Use the MVC application program to be divided into three parts: model, view, controller.Model (Model) is exactly the processing of operation flow/state and the formulation of business rule.View (View) representative of consumer interactive interface.Controller (Controller) can be understood as from the user and accepts request, and with model and views registered together, finishes user's request jointly.
When network geographic information system Web-GIS application and development program,, carry out the detailed design exploitation so need to use the MVC pattern, with view, controller, model separation because service logic complexity, data volume are big among the Web-GIS.Spring MVC framework is that the MVC of a Full Featured structure web application realizes., how be the problem that needs solve in Web-GIS with Spring MVC frame application.
Summary of the invention
The embodiment of the invention provides the method and apparatus of assignment messages, in order to Spring MVC frame application in Web-GIS.
For achieving the above object, the embodiment of the invention adopts following technical scheme:
A kind of method of assignment messages comprises: server end obtains the identical request message of the form of message with setting in advance that client sends; Server end is handled the described request distribution of messages according to request message that sets in advance and the mapping relations between the controller identifier to corresponding controller; Server end returns to client with described controller according to the result that the described request Message Processing obtains.
A kind of distributor comprises:
First acquiring unit is used to obtain the identical request message of the form of message with setting in advance that client sends;
Allocation units are used for according to request message that sets in advance and the mapping relations between the controller identifier, and the request message that described acquiring unit obtains is distributed to the corresponding controller processing;
Return the unit, be used for described controller is returned to client according to the result that the described request Message Processing obtains.
The method and apparatus of the assignment messages that the embodiment of the invention provides, obtain the identical request message of form of message that client sends and the described request distribution of messages is handled to corresponding controller by server end with setting in advance, realized that the controller in the Spring MVC framework accepts request from the user, with model and views registered together, finish the specific implementation of user's request jointly.Realize the separating of view, controller and model of Web-GIS, reduced the degree of coupling of Web-GIS program, improved the reusability of code, improved the maintenance in Web-GIS program later stage.
Description of drawings
The method flow diagram of the assignment messages that Fig. 1 provides for the embodiment of the invention;
The method flow diagram of the assignment messages that Fig. 2 provides for further embodiment of this invention;
The distributor structural representation one that Fig. 3 provides for the embodiment of the invention;
The distributor structural representation two that Fig. 4 provides for the embodiment of the invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that is obtained under the creative work prerequisite.
For with Spring MVC frame application in Web-GIS, the embodiment of the invention provides a kind of method and apparatus of assignment messages.
As shown in Figure 1, the method for the assignment messages that the embodiment of the invention provides comprises:
Step 101, server end are obtained the identical request message of the form of message with setting in advance that client sends.
Step 102, server end is handled the described request distribution of messages according to request message that sets in advance and the mapping relations between the controller identifier to corresponding controller.
Step 103, server end returns to client with described controller according to the result that the described request Message Processing obtains.
The method of the assignment messages that the embodiment of the invention provides, obtain the identical request message of form of message that client sends and the described request distribution of messages is handled to corresponding controller by server end with setting in advance, realized that the controller in the Spring MVC framework accepts request from the user, with model and views registered together, finish the specific implementation of user's request jointly.Realize the separating of view, controller and model of Web-GIS, reduced the degree of coupling of Web-GIS program, improved the reusability of code, improved the maintenance in Web-GIS program later stage.
As shown in Figure 2, the method for the assignment messages that further embodiment of this invention provides realizes based on Spring MVC framework, comprising:
Step 201, server end are obtained the identical request message of the form of message with setting in advance that client sends.
In the present embodiment, the described form of message that sets in advance can realize by the DispatcherServlet that configuration Spring framework in the web.xml file under the web engineering provides.For example, can realize obtaining the form that client sends by program code is that .do is all request messages of ending:
Figure 20101023057691000021
Step 202, server end is handled the described request distribution of messages according to request message that sets in advance and the mapping relations between the controller identifier to corresponding controller.
In the present embodiment, described request message that sets in advance and the mapping relations between the controller identifier are kept in the configuration file with the .xml form.Described request message that sets in advance and the mapping relations between the controller identifier can be preserved by the SimpleUrlHandlerMapping class that the Spring framework provides, when concrete the application, can the described request message maps be arrived the controller identifier corresponding with described request message by described SimpleUrlHandlerMapping class, by described controller identifier described request be distributed to corresponding controller in detail and handle.Can realize by following code as, mapping relations between described request message and the controller identifier, query.do can be called the LBSController controller and process operation for all requests of ending have been assigned to name by following code:
Figure 20101023057691000022
Described controller realizes by the specific implementation class of definition controller in described configuration file, can be by the definition of following program code realization to the specific implementation class of described controller:
What deserves to be explained is that an attribute in the specific implementation class of described controller is defined this attribute
Figure 20101023057691000023
Effect be to preserve request message type, controller can be according to request message type to each self-corresponding service class dispense request.
Step 203, described controller obtains the concrete service class sign corresponding with the described request type of message according to described request type of message and request message type that sets in advance and concrete service class sign corresponding relation.
Also define the specific implementation class that request message type is arranged in described configuration file, realize having defined an attribute in the class in described request message, the effect of this attribute is the concrete service class sign of preserving different request message type correspondences.In the present embodiment, the described request type of message is with data structure Map<key with the corresponding relation of concrete service class sign, value〉define, this data structure is stored by the key-value pair end data, so can obtain the value corresponding fast by key with it, obtaining after the value can be by<ref bean=...〉form call and the corresponding concrete service class of described concrete service class sign, its specific implementation can be passed through following program code realization:
Figure 4
Step 204, controller are called the concrete service class corresponding with described concrete service class sign and are handled with the corresponding request message of described service class and obtain result.
In the present embodiment, described concrete service class by control counter-rotating (Inversion of Control, mode Ioc) obtains, described Ioc creates object, but describes the mode of creating object.Ioc directly is not connected with service with object in code, promptly creates the service that concrete service class needs but describe the establishment object in configuration file.
Step 205, server end returns to client with described controller according to the result that the described request Message Processing obtains.
The method of the assignment messages that the embodiment of the invention provides, obtain the identical request message of form of message that client sends and the described request distribution of messages is handled to corresponding controller by server end with setting in advance, realized that the controller in the Spring MVC framework accepts request from the user, with model and views registered together, finish the specific implementation of user's request jointly.Realize the separating of view, controller and model of Web-GIS, reduced the degree of coupling of Web-GIS program, improved the reusability of code, improved the maintenance in Web-GIS program later stage.
As shown in Figure 3, the distributor that the embodiment of the invention provides comprises:
First acquiring unit 301 is used to obtain the identical request message of the form of message with setting in advance that client sends; Concrete implementation method can be described referring to step 201 as shown in Figure 2, repeats no more herein.
Allocation units 302 are used for according to request message that sets in advance and the mapping relations between the controller identifier, and the request message that described acquiring unit obtains is distributed to the corresponding controller processing; Concrete implementation method can be described referring to step 202 as shown in Figure 2, repeats no more herein.
Return unit 303, be used for described controller is returned to client according to the result that the described request Message Processing obtains.Concrete implementation method can be described referring to step 205 as shown in Figure 2, repeats no more herein.
As shown in Figure 4, described distributor also comprises:
Second acquisition unit 401 is used for according to described request type of message and request message type that sets in advance and concrete service class sign, obtains the corresponding concrete service class sign of obtaining with described second acquisition unit of request message type; Concrete implementation method can be described referring to step 203 as shown in Figure 2, repeats no more herein.
Processing unit 402 is used to call the corresponding concrete service class of obtaining with described the 3rd acquiring unit of concrete service class sign and handles with the corresponding request message of described service class and obtain result.Concrete implementation method can be described referring to step 204 as shown in Figure 2, repeats no more herein.
The distributor that the embodiment of the invention provides, obtain the identical request message of form of message that client sends and the described request distribution of messages is handled to corresponding controller by server end with setting in advance, realized that the controller in the Spring MVC framework accepts request from the user, with model and views registered together, finish the specific implementation of user's request jointly.Realize the separating of view, controller and model of Web-GIS, reduced the degree of coupling of Web-GIS program, improved the reusability of code, improved the maintenance in Web-GIS program later stage.
The method and apparatus of the assignment messages that the embodiment of the invention provides can be applied to transport information and numerical map field.
One of ordinary skill in the art will appreciate that all or part of step that realizes in the foregoing description method is to instruct relevant hardware to finish by program, described program can be stored in the computer-readable recording medium, as ROM/RAM, magnetic disc or CD etc.
The above; only be the specific embodiment of the present invention, but protection scope of the present invention is not limited thereto, anyly is familiar with those skilled in the art in the technical scope that the present invention discloses; can expect easily changing or replacing, all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection domain of described claim.

Claims (7)

1. the method for an assignment messages is characterized in that, comprising:
Server end obtains the identical request message of the form of message with setting in advance that client sends;
Server end is handled the described request distribution of messages according to request message that sets in advance and the mapping relations between the controller identifier to corresponding controller;
Server end returns to client with described controller according to the result that the described request Message Processing obtains.
2. method according to claim 1 is characterized in that, described controller specifically comprises according to the result that the described request Message Processing obtains:
Controller obtains the concrete service class sign corresponding with the described request type of message according to described request type of message and request message type that sets in advance and the corresponding relation that concrete service class identifies;
Controller calls the concrete service class corresponding with described concrete service class sign and handles with the corresponding request message of described service class and obtain result.
3. method according to claim 2 is characterized in that, described concrete service class obtains by the mode of control counter-rotating.
4. according to each described method of claim 1-3, it is characterized in that described request message that sets in advance and the mapping relations between the controller identifier are kept in the configuration file of .xml form.
5. according to each described method of claim 1-3, it is characterized in that described method realizes based on the SpringMVC framework.
6. a distributor is characterized in that, comprising:
First acquiring unit is used to obtain the identical request message of the form of message with setting in advance that client sends;
Allocation units are used for according to request message that sets in advance and the mapping relations between the controller identifier, and the request message that described acquiring unit obtains is distributed to the corresponding controller processing;
Return the unit, be used for described controller is returned to client according to the result that the described request Message Processing obtains.
7. device according to claim 6 is characterized in that, also comprises:
Second acquisition unit is used for according to described request type of message and request message type that sets in advance and the corresponding relation that concrete service class identifies, and obtains the corresponding concrete service class sign of obtaining with described second acquisition unit of request message type;
Processing unit is used to call the corresponding concrete service class of obtaining with described the 3rd acquiring unit of concrete service class sign and handles with the corresponding request message of described service class and obtain result.
CN2010102305769A 2010-07-13 2010-07-13 Method and device for distributing messages Active CN101901163B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN2010102305769A CN101901163B (en) 2010-07-13 2010-07-13 Method and device for distributing messages
PCT/CN2011/074538 WO2012006908A1 (en) 2010-07-13 2011-05-23 Message allocating method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2010102305769A CN101901163B (en) 2010-07-13 2010-07-13 Method and device for distributing messages

Publications (2)

Publication Number Publication Date
CN101901163A true CN101901163A (en) 2010-12-01
CN101901163B CN101901163B (en) 2012-10-31

Family

ID=43226715

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2010102305769A Active CN101901163B (en) 2010-07-13 2010-07-13 Method and device for distributing messages

Country Status (2)

Country Link
CN (1) CN101901163B (en)
WO (1) WO2012006908A1 (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012006908A1 (en) * 2010-07-13 2012-01-19 北京世纪高通科技有限公司 Message allocating method and device
CN102609255A (en) * 2012-01-19 2012-07-25 中国科学院计算机网络信息中心 Generation method for Spring IOC (Inversion of Control) configuration file
CN103257855A (en) * 2012-12-11 2013-08-21 深圳市梦圆皇宫管理顾问有限公司 MVC (model view controller) based processing system, MVC based processing method and application in facial beautifying software
CN103647828A (en) * 2013-12-11 2014-03-19 北京荣之联科技股份有限公司 REST-based JAVA MVC system and data processing method thereof
CN104267944A (en) * 2014-09-22 2015-01-07 浪潮软件集团有限公司 Spring-based MVC (model view controller) mode optimization system
CN104767780A (en) * 2014-01-08 2015-07-08 上海博科资讯股份有限公司 IOC-based web application system
WO2015103982A1 (en) * 2014-01-08 2015-07-16 Tencent Technology (Shenzhen) Company Limited Method and apparatus for processing request
CN106843895A (en) * 2017-02-07 2017-06-13 上海网易小额贷款有限公司 Method, system and readable storage medium storing program for executing for processing request

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1870562A (en) * 2005-05-23 2006-11-29 国际商业机器公司 Dynamic web service calling method, system and web service agent
CN101311894A (en) * 2007-03-30 2008-11-26 英特尔公司 Method and apparatus for speculative prefetching in a multi-processor/multi-core message-passing machine
CN101459631A (en) * 2007-06-11 2009-06-17 华为技术有限公司 Virtual media gateway selection method, apparatus and system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101901163B (en) * 2010-07-13 2012-10-31 北京世纪高通科技有限公司 Method and device for distributing messages

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1870562A (en) * 2005-05-23 2006-11-29 国际商业机器公司 Dynamic web service calling method, system and web service agent
CN101311894A (en) * 2007-03-30 2008-11-26 英特尔公司 Method and apparatus for speculative prefetching in a multi-processor/multi-core message-passing machine
CN101459631A (en) * 2007-06-11 2009-06-17 华为技术有限公司 Virtual media gateway selection method, apparatus and system

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012006908A1 (en) * 2010-07-13 2012-01-19 北京世纪高通科技有限公司 Message allocating method and device
CN102609255A (en) * 2012-01-19 2012-07-25 中国科学院计算机网络信息中心 Generation method for Spring IOC (Inversion of Control) configuration file
CN102609255B (en) * 2012-01-19 2015-09-23 中国科学院计算机网络信息中心 A kind of generation method of Spring IOC configuration file
CN103257855A (en) * 2012-12-11 2013-08-21 深圳市梦圆皇宫管理顾问有限公司 MVC (model view controller) based processing system, MVC based processing method and application in facial beautifying software
CN103257855B (en) * 2012-12-11 2016-04-06 深圳市梦圆皇宫管理顾问有限公司 A kind of disposal system based on MVC, disposal route and the application in beauty treatment software
CN103647828A (en) * 2013-12-11 2014-03-19 北京荣之联科技股份有限公司 REST-based JAVA MVC system and data processing method thereof
CN103647828B (en) * 2013-12-11 2017-01-11 北京荣之联科技股份有限公司 REST-based JAVA MVC system and data processing method thereof
CN104767780A (en) * 2014-01-08 2015-07-08 上海博科资讯股份有限公司 IOC-based web application system
WO2015103982A1 (en) * 2014-01-08 2015-07-16 Tencent Technology (Shenzhen) Company Limited Method and apparatus for processing request
CN104767780B (en) * 2014-01-08 2018-09-18 上海博科资讯股份有限公司 A kind of web application systems based on IOC
CN104267944A (en) * 2014-09-22 2015-01-07 浪潮软件集团有限公司 Spring-based MVC (model view controller) mode optimization system
CN106843895A (en) * 2017-02-07 2017-06-13 上海网易小额贷款有限公司 Method, system and readable storage medium storing program for executing for processing request

Also Published As

Publication number Publication date
WO2012006908A1 (en) 2012-01-19
CN101901163B (en) 2012-10-31

Similar Documents

Publication Publication Date Title
CN101901163B (en) Method and device for distributing messages
CN102255934B (en) Cloud service dissemination method and cloud service intermediary
CN106850788A (en) Towards the integrated framework and integrated approach of multi-source heterogeneous geographic information resources
CN103888456A (en) Webpage client side, server side and data processing device and method
CN103780627A (en) Native APP, Web APP and Wechat-similar APP information synchronization system
CN101447891B (en) Service model self-adapting system and method thereof
CN105281921A (en) Method and device enabling virtual desktop to realize multicast
CN109901938A (en) Big screen system and visual presentation method are interacted based on WebSocket communication
CN102523109A (en) Resource state updating method, management client ends, and server
CN105072118A (en) Login management system and method for call center seat
CN105787632A (en) Method and system for managing conference room
CN104378419A (en) High-speed data push method and system
CN105120002B (en) A kind of information processing method and device
CN105577622A (en) Method of distributing user grouping for digital label and apparatus thereof, and digital label system
CN103209162B (en) A kind of Web class service deployment method and device
CN107402826B (en) A kind of method and device carrying out remote procedure call in an asynchronous manner
CN107659491A (en) A kind of Group file sharing method and system based on instant messaging
CN106161547B (en) A kind of method and apparatus generating cloud service experience tool
CN105844546A (en) Power distribution network information interaction method based on GIS mirror image technology
CN103220636A (en) Terminal application client registration method and system and device
CN106453677A (en) Address allocation method and apparatus
CN109683875A (en) The application framework and its method of MVC pattern under distributed environment
CN110231965A (en) A kind of cloud device, applied program processing method and electronic equipment
CN105897476B (en) A kind of method and device creating transmission channel
CN111930830B (en) Distributed transaction data processing method and system based on shared database

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