StencilsetRestResource.java 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. package com.activiti6.controller.editor;
  2. import org.activiti.engine.ActivitiException;
  3. import org.apache.commons.io.IOUtils;
  4. import org.springframework.web.bind.annotation.RequestMapping;
  5. import org.springframework.web.bind.annotation.RequestMethod;
  6. import org.springframework.web.bind.annotation.ResponseBody;
  7. import org.springframework.web.bind.annotation.RestController;
  8. import java.io.InputStream;
  9. /**
  10. * 获取编辑器组件及配置项信息
  11. * liuzhize 2019年3月7日下午3:33:28
  12. */
  13. @RestController
  14. @RequestMapping("service")
  15. public class StencilsetRestResource {
  16. /**
  17. * 获取流程json文件
  18. * @return
  19. */
  20. @RequestMapping(value="/editor/stencilset", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
  21. @ResponseBody
  22. public String getStencilset() {
  23. InputStream stencilsetStream = this.getClass().getClassLoader().getResourceAsStream("stencilset.json");
  24. try {
  25. return IOUtils.toString(stencilsetStream, "utf-8");
  26. } catch (Exception e) {
  27. throw new ActivitiException("Error while loading stencil set", e);
  28. }
  29. }
  30. }