AI智能
改变未来

activit工作流保存的时候model.html报错Required request body is missing ModelSaveRestResource.saveModel


springboot整合activiti 工作流的坑点有点多。下面是model.html 页面保存出现错误的解决办法。

解决办法

ModelSaveRestResource 中的saveModel方法去掉,换成下面的方法即可

@RequestMapping(value = \"/model/{modelId}/save\", method = RequestMethod.PUT)@ResponseStatus(value = HttpStatus.OK)public void saveModel(@PathVariable String modelId, String name, String description, String json_xml,String svg_xml) {try {Model model = repositoryService.getModel(modelId);ObjectNode modelJson = (ObjectNode) objectMapper.readTree(model.getMetaInfo());modelJson.put(MODEL_NAME, name);modelJson.put(MODEL_DESCRIPTION, description);model.setMetaInfo(modelJson.toString());model.setName(name);repositoryService.saveModel(model);repositoryService.addModelEditorSource(model.getId(), json_xml.getBytes(\"utf-8\"));InputStream svgStream = new ByteArrayInputStream(svg_xml.getBytes(\"utf-8\"));TranscoderInput input = new TranscoderInput(svgStream);PNGTranscoder transcoder = new PNGTranscoder();// Setup outputByteArrayOutputStream outStream = new ByteArrayOutputStream();TranscoderOutput output = new TranscoderOutput(outStream);// Do the transformationtranscoder.transcode(input, output);final byte[] result = outStream.toByteArray();repositoryService.addModelEditorSourceExtra(model.getId(), result);outStream.close();} catch (Exception e) {LOGGER.error(\"Error saving model\", e);throw new ActivitiException(\"Error saving model\", e);}}
赞(0) 打赏
未经允许不得转载:爱站程序员基地 » activit工作流保存的时候model.html报错Required request body is missing ModelSaveRestResource.saveModel