我很驚訝沒有在Google上獲得任何關於"org.apache.cxf.resource.method"
的信息。雖然,有很多攔截器使用它(在我已經給出的代碼中)。CXF中「org.apache.cxf.resource.method」的意義是什麼?
例如,這(在自定義FaultOutInterceptor
):
private boolean isServiceResponseRequested(Message message) {
Method method = (Method) message.getExchange().getInMessage()
.get("org.apache.cxf.resource.method");
if (method != null) {
Class c = method.getReturnType();
if (c != null) {
if (c.getSimpleName().equals(
ServiceResponse.class.getSimpleName())) {
return true;
}
}
}
return false;
}
AbstractAuthorizingInInterceptor也有它的一個引用。
任何一個人都可以解釋「org.apache.cxf.resource.method
」的含義以及「set
」的具體含義嗎?
編輯: 作爲一個黑客以達到預期的,這是我做了什麼:
我寫了inInterceptor
爲Phase.PRE_STREAM
,在jaxrs:inInterceptors
配置,並在
handleMessage(Message message)
{
Message inMessage = message.getExchange().getInMessage();
Method appMethod = //Logic to determine the method based on the request Url
inMessage.put("org.apache.cxf.resource.method", appMethod);
}
雖然,它給了我期望的結果,它完全是一種破解,並且看起來並不正確。任何意見?
你爲什麼要設置它? –
有一個基於它是否設置的自定義邏輯(上面的例子),因此,想知道爲什麼和如何。 –