无法将Wink Rest Servlet与Spring Dispatcher Servlet集成

时间:2018-07-27 13:22:18

标签: spring-mvc apache-wink

我已经将apache wink rest servlet用于REST服务,并且我试图将其与Spring MVC调度程序servlet集成。但是调度程序Servlet的网址无法访问。 这是我的web.xml:

    <?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="3.0"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <display-name>DomesticCollect</display-name>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    <!-- it appears that below "classpath:META-INF/server/wink-core-context.xml" 
        is needed for WebSphere 7 ; this is apparently not needed for 8 -->
    <!-- classpath:META-INF/server/wink-core-context.xml -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <!-- <param-value> classpath:WEB-INF/ApplicationContext-context.xml</param-value> -->
        <!-- com/qvc/supplychain/app/service/web/config/ -->
        <param-value> 
    classpath:ApplicationContext-context.xml
    </param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <servlet>
        <servlet-name>DomesticCollectService</servlet-name>
        <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
        <init-param>
            <param-name>javax.ws.rs.Application</param-name>
            <param-value>com.qvc.supplychain.app.service.web.controller.IntegrationService</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>DispatcherServlet</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
    <servlet>
        <servlet-name>DispatcherServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>DispatcherServlet</servlet-name>
        <url-pattern>/admin/*</url-pattern>
    </servlet-mapping>
    <!-- <resource-ref>
        <description>Connection to Main DB</description>
        <res-ref-name>jdbc/SCMPOFRT DB2 DataSource</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
        <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    <resource-ref>
        <description>Connection to secondary DB</description>
        <res-ref-name>jdbc/tmsVendorAsnDS</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
        <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref> -->

</web-app>

这是我的DispatcherServlet-servlet.xml:

<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    <property name="alwaysUseFullPath">
        <value>true</value>
    </property>
    <property name="mappings">
        <props>
            <prop key="/admin/**">ApplicationPropertyController</prop>                
        </props>
    </property>
</bean>
<bean id="ApplicationPropertyController" class="com.qvc.supplychain.app.domesticcollect.web.ApplicationPropertyController">
    <property name="applicationPropertyManager" ref="ApplicationPropertyManager" />     
</bean>

<mvc:annotation-driven/>

<!-- <context:component-scan base-package="com.qvc.supplychain.app.domesticcollect.web"/> -->

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="viewClass"><value>org.springframework.web.servlet.view.JstlView</value></property>
    <property name="prefix" value="/WEB-INF/jsps/"/>
    <property name="suffix" value=".jsp"/>
</bean>

如何提供url模式,以便可以访问其余服务和调度程序servlet?

0 个答案:

没有答案