Servlets JBoss resteasy-jaxrs-3.12.1 undertow.core-2.1.3--HttpServletRequest null
亲爱的JBoss RESTEasy大师-- 我跟着Servlets JBoss resteasy-jaxrs-3.12.1 undertow.core-2.1.3--HttpServletRequest null,servlets,jboss,request,resteasy,undertow,Servlets,Jboss,Request,Resteasy,Undertow,亲爱的JBoss RESTEasy大师-- 我跟着 但我总是得到HttpServletRequest null 拥有一个)org.jboss.resteasy.resteasy-jaxrs@3.12.1.Final b) 伊奥。在船底。core@2.1.3.Final c) Jdk 15 以下是我的代码片段: @Path("{p_uri}/login-actions") public LActionsService getLActionsService(@Contex
@Path("{p_uri}/login-actions")
public LActionsService getLActionsService(@Context HttpServletRequest rqst, final @PathParam("p_uri") String name) {
ResteasyProviderFactory.getInstance().injectProperties(service);
//Also tried
rqst = ResteasyProviderFactory.getInstance().getContextData(HttpServletRequest.class);
if(rqst == null ) {
System.out.println("parameter request is null");
// do_somethingelse_with rqst
return service;
}
错误转储:
RESTEASY003880: Unable to find contextual data of type: javax.servlet.http.HttpServletRequest 04:44:36,744 ERROR [stderr] (default task-5)
at org.jboss.resteasy.resteasy-jaxrs@3.12.1.Final//org.jboss.resteasy.core.ContextParameterInjector$GenericDelegatingProxy.invoke(ContextParameterInjector.java:77)
非常感谢您的指点。期待您的光临。您是在WildFly这样的容器中使用这些吗?是的,James;纯redhat应用程序,包括wildfly、undertow,当然还有JBossRestEasy——还有进一步的方向吗?我所要寻找的就是在上面提取httpservletrequest,它允许我做其他有用的事情。。。。提前感谢您对该方法有
@GET
或@POST
注释吗?您是否碰巧将RESTEasy包括在部署中?在某些方法中,“在其他方法中,确实有at_Get和at_Post”。我知道只有org.jboss.resteasy.resteasy-jaxrs抛出了错误RESTEASY003880。任何我可以测试或遵循示例代码的东西?我只是用一个方法创建了一个简单的资源,它对我很有用@Path(“context”)@GET public Response checkContext(@context HttpServletRequest request){return Response.ok(String.valueOf(request)).build();}