java jar web_Java-通过Web公开jar资源

我有一个Web服务(使用Spring-WS).

我有一个包含几个架构(schema1.xsd,schema2.xsd和schema3.xsd)的jar,它们包含在我的Web服务中.

在我的Web服务wep应用程序中,有没有办法通过servlet通过jar公开模式?

我的Spring MessageDispatcherServlet映射到/ ws /

我希望将架构公开给/schemas/schema1.xsd /schemas/schema2.xsd,依此类推.

我有一个如何使用servlet的想法,但是它太冗长,必须有更好的方法.

我的想法是拥有一个servlet过滤器,并击中/ schemas /的所有内容检查它是否在我允许的资源列表中并显示它.

谢谢.

解决方法:

又是我!看到您对原始问题的评论后,我想我会提供一种替代解决方案.

如果我理解您的问题,似乎您有一个WSDL(由Spring-WS生成),其中包含对各种模式的引用.当客户端尝试遵循这些架构引用时,它会失败,因为没有此类资源.

Spring-WS提供了一种解决此问题的好方法,如section on WSDL exposure中所述:

If you want to use multiple schemas,

either by includes or imports, you

might want to use the

CommonsXsdSchemaCollection, and refer

to that from the

DefaultWsdl11Definition, like so:

classpath:/path/to/schema1.xsd

classpath:/path/to/schema2.xsd

When the inline property is enabled,

it follows all XSD imports and

includes, and inlines them in the

WSDL. This greatly simplifies the

deloyment of the schemas, which still

making it possible to edit them

separately.

因此,您得到的是生成的WSDL,其中内联了所有引用的架构,因此没有可供客户端遵循的引用.它非常漂亮,这意味着您不必单独公开架构文件.

标签:jar,spring,java,resources

来源: https://codeday.me/bug/20191024/1918239.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值