private static Log log = LogFactory.getLog(ResourceInvokeHandler.class);
public void handleRequest(MessageContext messageContext) throws CuubezException {
SelectedResourceMetaData selectedResourceMetaData = messageContext.getRequestContext().getSelectedResource();
log.trace("resource invocation process started");
try {
Object[] arguments = getResourceArguments(selectedResourceMetaData);
Class<?> cls = selectedResourceMetaData.getSelectedMethodMetaData().getClazz();
Object obj = cls.newInstance();
java.lang.reflect.Method selectedMethod = selectedResourceMetaData.getSelectedMethodMetaData().getReflectionMethod();
validateArguments(selectedMethod, arguments);
Object returnObject = selectedMethod.invoke(obj, arguments);
if (selectedMethod.getReturnType().equals(Void.TYPE)) {
messageContext.getResponseContext().setResponseCode(HttpServletResponse.SC_NO_CONTENT);
} else if (returnObject != null) {
messageContext.getResponseContext().setReturnObject(returnObject);
messageContext.getResponseContext().setMediaType(populateResponseMediaType(selectedResourceMetaData.getSelectedMethodMetaData().getProduce(), messageContext.getRequestContext().getUrlContext().getMediaType()));
}
} catch (InvocationTargetException e) {
log.error(e);