* @return ContentProvider
* @throws Exception
*/
private List<ContentProvider<?>> handleRequest(UrlMappingRule currentRule) throws Exception {
// TODO should we handle the exceptions?
WebApplicationContext context = (WebApplicationContext) Context.getCurrentThreadContext();
RequestHandlerInvokerFactory factory = ((WebApplicationConfiguration) context.getConfiguration()).getRequestHandlerInvokerFactory();
RequestHandlerInvoker invoker = factory.getInvoker();
Object requestHandlerResult;
try {
requestHandlerResult = invoker.invoke(currentRule);
} catch (InvocationTargetException ex) {
logger.error(currentRule.toString(), ex);
requestHandlerResult = ex.getTargetException();
} catch (Exception ex) {
logger.error(currentRule.toString(), ex);
requestHandlerResult = ex;
}
context.setData(KEY_REQUEST_HANDLER_RESULT, requestHandlerResult);
List<ContentProvider<?>> cpList = new ArrayList<>();
if (requestHandlerResult instanceof List) {
List<?> resultList = (List<?>) requestHandlerResult;