首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >泽西资源配置和Spring集成http:入站网关

泽西资源配置和Spring集成http:入站网关
EN

Stack Overflow用户
提问于 2016-10-19 15:46:34
回答 1查看 165关注 0票数 0

我目前正在使用的Spring项目工作。我有以下:

代码语言:javascript
复制
<!-- CHANNELS -->
<int:channel id="channelInput"/>
<int:channel id="channelOutput"/>

<int-http:inbound-gateway id="http-inbound-gateway"
                          request-channel="channelInput"
                          reply-channel="channelOutput"
                          supported-methods="GET"
                          path="/urlTest"
                          >
    <int-http:request-mapping consumes="application/json"
                              produces="application/json"/>

</int-http:inbound-gateway>


<int:service-activator input-channel="channelInput"
                       ref="serviceClassImpl"
                       method="testMethod"
                       output-channel="channelOutput">
</int:service-activator>

当我试图对localhost:8080/urlTest做卷曲时,它给了我一个404。

后来我注意到我们有一个泽西资源配置类,在这个类中,我们必须注册使用@Path注释定义的所有路径,所以我假设404错误是因为我没有在泽西注册该路径。但我不确定,因为我以前从未在泽西岛工作过。

代码语言:javascript
复制
@Component
public class ApplicationJerseyConfig extends ResourceConfig {
  public ApplicationJerseyConfig() {
    property(ServletProperties.FILTER_STATIC_CONTENT_REGEX,"/(info|browser/.*|api/(swagger.json|info)?|.*/api-docs.?|console/.*|configuration/.*|.*.html|.*.jpg|.*.gif|.*.png|.*.map|.*.js|.*.css|.*.ttf)?");
    register(TestRest.class);
    }
}

如何在中注册网关"/urlTest“中定义的路径?

提前谢谢你。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-10-24 09:33:24

最后,我只需将路径添加到ServletProperties.FILTER_STATIC_CONTENT_REGEX of ResourceConfig中即可。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40136125

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档