2013-10-22 23 views
2

我正在使用Apache CXF創建一個RESTful Web服務。 我想對使用@Authenticate註釋的資源進行身份驗證。爲此,我打算編寫一個匹配ContainerRequestFilter的帖子並驗證請求,如果驗證失敗,請執行ContainerRequestContext.abortWith(javax.ws.rs.core.Response)。不過,我只想對使用@Authenticate進行註釋的資源進行身份驗證。如何從Apache CXF中的ContainerRequestFilter獲取目標資源

問題是我找不到如何訪問匹配的資源。我知道我可以使用CXF攔截器來做到這一點,但我想堅持使用JAX-RS 2.0提供的功能。 我在另一篇文章,你可以用下面的休息,容易

ResourceMethodInvoker methodInvoker = (ResourceMethodInvoker) 
      requestContext.getProperty("org.jboss.resteasy.core.ResourceMethodInvoker"); 
Method method = methodInvoker.getMethod(); 

可以類似的方法在CXF進行看見?

感謝

回答

相關問題