Hi,
I managed to install my own JAXRSInInterceptor and JAXRSOutInterceptor.
What I would like is to log the final method name and parameter values
for logging purposes. I have done something similar for SOAP in the past
but the crucial BindingOperationInfo is null in case of rest.
Any ideas?
private String getMethod(Message message) {
final BindingOperationInfo bop =
message.getExchange().getBindingOperationInfo();
if (bop != null) {
final MethodDispatcher md = (MethodDispatcher) message
.getExchange().get(Service.class)
.get(MethodDispatcher.class.getName());
Object parameters = message.getContent(List.class);
if (parameters == null) {
parameters = message.getContent(Object.class);
}
return String.format("%s(%s)", md.getMethod(bop).getName(),
StringUtils.preetyPrintObject(new StringBuilder(),
parameters,
-1));
}
final Method method = (Method) message
.get("org.apache.cxf.resource.method");
if (method != null) {
return method.getName();
}
return "unknown";
}
Vassilis Virvilis
--
__________________________________
Vassilis Virvilis Ph.D.
Head of IT
Biovista Inc.
US Offices
2421 Ivy Road
Charlottesville, VA 22903
USA
T: +1.434.971.1141
F: +1.434.971.1144
European Offices
34 Rodopoleos Street
Ellinikon, Athens 16777
GREECE
T: +30.210.9629848
F: +30.210.9647606
www.biovista.com
Biovista is a privately held biotechnology company that finds novel uses
for existing drugs, and profiles their side effects using their
mechanism of action. Biovista develops its own pipeline of drugs in CNS,
oncology, auto-immune and rare diseases. Biovista is collaborating with
biopharmaceutical companies on indication expansion and de-risking of
their portfolios and with the FDA on adverse event prediction.