我正在使用Embedded Jetty:
ServletContextHandler context = new ServletContextHandler();
JettyHttpThreadPool jettyHttpThreadPool = new JettyHttpThreadPool(serviceName);
server.setHandler(context);
server.start();
我的春天上下文xml文件是:
<mvc:annotation-driven>
<mvc:message-converters>
<bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="objectMapper" ref="mapper"/>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
<mvc:resources mapping="css/**" location="classpath:/META-INF/resources/"/>
<mvc:resources mapping="images/**" location="classpath:/META-INF/resources/"/>
<mvc:resources mapping="lib/**" location="classpath:/META-INF/resources/"/>
<mvc:resources mapping="swagger-ui.js" location="classpath:/META-INF/resources/"/>
<mvc:resources mapping="/" location="classpath:/META-INF/resources/"/>
<bean id="mapper" class="com.rest.utils.ObjectMapperFactory"/>
<context:annotation-config/>
<context:component-scan base-package="com.rest"/>
当我尝试获取http://localhost:8080/index.html
时,我会收到404 http状态代码。
我做错了什么?为什么我不能获得静态资源?
答案 0 :(得分:0)
问题是另一个servlet的映射应该是“/”而不是“/ *”