问题:
调用activity的api显示流程图片的时候,发现图片名称作为参数传入到下面的方法中,参数值只截取到了“.”前面的值。“.png”被丢掉了。导致错误。
spring版本:4.3.11.RELEASE
activity版本:5.22.0
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.activiti.engine.ActivitiObjectNotFoundException: Could not find a resource with id 'leaveWithCondition' in deployment '117543'.
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:167)
org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:80)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:83)
org.springframework.web.multipart.support.MultipartFilter.doFilterInternal(MultipartFilter.java:122)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
root cause
org.activiti.rest.service.api.repository.BaseDeploymentResourceDataResource;类的getDeploymentResourceData方法。
url:http://localhost:8080/项目/rest/repository/deployments/117543/resourcedata/leaveWithCondition.png
117543:deploymentId
leaveWithCondition.png:resourceName
解决方法1:测试无效(原因不明)
spring中设置如下
<mvc:annotation-driven>
<mvc:path-matching suffix-pattern="false" />
</mvc:annotation-driven>
或者追加config类。
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
public class MvcConfig extends WebMvcConfigurerAdapter {
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
configurer.setUseSuffixPatternMatch(false);//可以让URL路径中带小数点 '.' 后面的值不被忽略
}
}
解决方法2:测试通过
url的尾部追加一个斜杠“/”
修改前:url:http://localhost:8080/项目/rest/repository/deployments/117543/resourcedata/leaveWithCondition.png
修改后:url:http://localhost:8080/项目/rest/repository/deployments/117543/resourcedata/leaveWithCondition.png/
成功调用之后,图片在ie11下可以正常显示图片,其他浏览器edge,chrome,火狐等显示乱码。