return methodResource.getMethod().invoke(resource, p);
}
catch (IllegalArgumentException argExc)
{
// should not be thrown
throw new InternalException(argExc);
}
catch (IllegalAccessException accessExc)
{
// should not be thrown
throw new InternalException(accessExc);
}
catch (InvocationTargetException invExc)
{
if (LOG.isDebugEnabled())
{
invExc.printStackTrace();
}
// get cause of exception that method produces
Throwable cause = invExc.getCause();
// if WebApplicationException than it may contain response
if (WebApplicationException.class == cause.getClass())
{
throw (WebApplicationException)cause;
}
throw new InternalException(cause);
}
}