【发布时间】:2015-12-02 21:02:25
【问题描述】:
我正在使用wildfly 9.0.1.Final
我正在部署一个 REST 应用程序,它的端点定义如下:
@GET
@Path("/view/products")
@Produces(MediaType.APPLICATION_JSON)
@CORSEnabled
@Protected
public String getConfiguredProducts(
@Context ContainerRequestContext request) {
if (request != null) {
Integer companyId = (Integer) request.getProperty("company");
if (companyId != null) {
//do stuff
}
}
// ... more staff
}
当应用程序运行时,上下文被注入,即'request'不为空。
当我尝试检索属性时,我得到了错误:
executing GET /complaints/view/products:
org.jboss.resteasy.spi.LoggableFailure: Unable to find contextual data
of type: javax.ws.rs.container.ContainerRequestContext
请注意,该应用程序在 glassfish/jersey 上运行没有问题,当我尝试将其移动到 wildfly/resteasy 时出现问题。
有什么想法吗?
【问题讨论】: