我正在尝试创建一个Spring集成Web应用程序,它将通过REST服务调用接收的任何有效负载转发到标准输出(稍后将由另一个后端端点替换)。
我在发布到weblogic后尝试访问网络服务器的网址
http://localhost:7001/ws_inboundBlobDispatcher/rest/services/inboundBlobDispatch/110/publish
我收到404错误。我不知道为什么会这样,或者是否正在创建其余端点。
我的整个弹簧配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/http
http://www.springframework.org/schema/integration/http/spring-integration-http.xsd
http://www.springframework.org/schema/integration/stream
http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-http="http://www.springframework.org/schema/integration/http"
xmlns:stream="http://www.springframework.org/schema/integration/stream">
<int:annotation-config/>
<!-- Inbound/Outbound Channels -->
<int:channel id="inboundBlobMessages" />
<int:channel id="inboundBlobResponse" />
<int-http:inbound-gateway id="inboundEmployeeSearchRequestGateway"
supported-methods="GET, POST"
request-channel="inboundBlobMessages"
reply-channel="inboundBlobResponse"
mapped-response-headers="Return-Status, Return-Status-Msg, HTTP_RESPONSE_HEADERS"
path="/rest/services/inboundBlobDispatch/{uniqueKey}/publish"
reply-timeout="50000"
/>
<stream:stdout-channel-adapter channel="inboundBlobMessages" append-newline="true"/>
</beans>
以下是我的web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>YourSimpleWebAppNameHere</display-name>
<servlet>
<servlet-name>rest</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>rest</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
</web-app>
rest-servlet.xml如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
</beans>
答案 0 :(得分:2)
我相信你的<int-http:inbound-gateway/>
必须在servlet上下文中(你的是空的,对吧?)。您还有一个重复的/rest
路径前缀(如果您为端口中的请求映射中不需要它的servlet定义它)。