Let's talk about it. Integrated Activiti Web Modeler, when you complete the Web integration, it is recommended that you look at this person to write the blog, summed up, learning things or to understand the principle, more look at the source code, a lot of useful and learning places.
When you finish reading the following, recommend this person's blog, Better deep connection source: Click to open the link
1.web Modeler
The world article a big copy
The Activiti version is a 5.20,modeler module that has changed a lot since the 5.16, and the associated API has been quite different.
If you already have a SPRINGMVC project, just copy the following files to your project, the package name can be changed, but specify the package path when searching for classes automatically.
The configuration file is as follows:
<bean id= "Objectmapper" class= "Com.fasterxml.jackson.databind.ObjectMapper"/>
<context:component-scan base-package= "Edu.xxx.web.rest" use-default-filters= "false" >
<context:include-filter type= "Annotation" expression= "Org.springframework.stereotype.Controller"/>
</context:component-scan>
Above is an important configuration point of Spring, you can specify the red font according to your actual path. For example
<!--automatically scans all classes under the controller package so that it thinks spring MVC controllers--<!--<context:component-scan base-package= "Com.chang Neng.sa.controller "/>--<!--note Scan package path--<context:component-scan base-package=" COM.CHANGNENG.SA " > <context:include-filter type= "annotation" expression= "Org.springframework.stereotype.Controller"/> & Lt;context:exclude-filter type= "Annotation" expression= "Org.springframework.stereotype.Service"/> <context: Exclude-filter type= "Annotation" expression= "Org.springframework.stereotype.Repository"/> </context: Component-scan> <!--Configure multiple scans for different package controllers---<context:component-scan base-package= "Org.activiti
. Rest.diagram "/> <context:component-scan base-package=" Org.activiti.rest.editor "/> <!--Annotated mode scan-- <bean class= "Org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/> <bean CLA Ss= "Org.springframework.web.servlet.mvc.Annotation. Defaultannotationhandlermapping "/> <!--SPRINGMVC Note Driver-< @RestController @ResponseBody back after!--configuration jso N--<mvc:annotation-driven> <mvc:message-converters> <bean class= "ORG.SPRINGFR Amework.http.converter.StringHttpMessageConverter "/> <bean class=" Org.springframework.http.converter.jso N.mappingjackson2httpmessageconverter "/> </mvc:message-converters> </mvc:annotation-driven>
Above is my own code: for reference only. Take a look at the source code, looking at what I said below
Stencilsetrestresource this class to its own project. Modeler-related Rest portals
The following three files I put into the project: Edu.xxx.web.rest this location. The Scarlet Letter is your own path spring configuration can know not and annotations in the line, as you put
Modeler-related page files
App-cfg.js files also need to be modified under, specify Contextroot AS/project/service
The above screenshot used in the Activiti source project files, can be downloaded here:
Https://codeload.github.com/Activiti/Activiti/zip/master
Also check that the entry path for rest is consistent with your project path. The default is this:
@RequestMapping (value= "/model/{modelid}/json", method = Requestmethod.get, produces = "Application/json")
I changed it to this:
@RequestMapping (value= "/service/model/{modelid}/json", method = Requestmethod.get, produces = "Application/json")
/project path/process-editor/modeler.html?modelid=xxx can be accessed to the online model editor. Please pay extra attention to the path of the Red section, if you are upgrading Modeler in an existing project, modify the appropriate entry path.
In fact, you follow the above said to do, should have been achieved, not how to write documents, the following supplement,
Now run the project, direct access to address: http://localhost: Port number/project name/modeler.html will find only one layout, a variety of features and components are not displayed, F12 see found access to the online Process Editor home page will find that it visited the http:/ /localhost: Port number/activiti-explorer/service/model//json This address, in fact I have not yet written backstage. This shows two questions: first, the foreground page should be a dead URL. The second is that Activiti should have a corresponding jar package to complete the integration of Activiti Modeler with individual projects.
Finding the foreground page first finds the global access path in App-cfg.js under the Editor-app folder/activiti-explorer/service Change the activiti-explorer to its own project name the service path is configured in Web. XML and can be changed. This http://localhost: The port number/activiti-explorer/service/model//json the actual call place in a method in App.js:
1 2 3 4 5 6 7 8 9 Ten all in |
/* Helper method to fetch model from Server (always needed) */ function Fetchmodel (modelid) { var Modelurl = kisbpm. Url.getmodel (ModelID); $http ({method: ' GET ' |