我想隱藏Apache Camel Servlet隱藏在Spring MVC Controller入口點後面,因爲我擁有一些專有組件,我必須使用它們,這取決於Sping Boot和Spring MVC Controller。將Apache Camel servlet隱藏在Spring MVC Controller入口點後面
我有以下Apache的駱駝路線,這是工作的罰款
<route id="Route">
<from uri="servlet:messages?httpMethodRestrict=POST"/>
<process ref="..."></process>
<to uri="{{storage.service.endpoint}}?bridgeEndpoint=true"/>
</route>
我已經註冊了駱駝的Servlet without any URL mappings,因爲我不希望直接訪問。春豆:
@Bean
ServletRegistrationBean servletRegistrationBean() {
CamelHttpTransportServlet camelServlet = new CamelHttpTransportServlet();
ServletRegistrationBean servletBean = new ServletRegistrationBean(camelServlet, false, new String[]{});
servletBean.setName("CamelServlet");
return servletBean;
}
在Spring控制器入口點我只需要轉發到駱駝的Servlet:
@RequestMapping(method=RequestMethod.POST, value="/api/v1/*")
public void wrapper(HttpServletRequest request, HttpServletResponse response) throws Exception{
context.getNamedDispatcher("CamelServlet").forward(request, response);
}
問題是駱駝的Servlet依賴於ServletResolveConsumerStrategy使用request.getPathInfo()
,這始終是null
在Spring Controller入口點。我已嘗試@RequestMapping
中的不同路徑,但總是request.getServletPath()
具有完整路徑並且pathInfo
爲空
P.S.該應用程序在Tomcat 8上運行。