if (ReflectUtil.isTypeOf(chunkClass, ActionWrapper.class)) {
wrappers = ArraysUtil.append(wrappers, chunkClass);
continue;
}
throw new MadvocException("Unsupported type: " + chunk);
}
// http method
if ( chunk.equals(Action.GET) ||
chunk.equals(Action.HEAD) ||
chunk.equals(Action.POST) ||
chunk.equals(Action.PUT) ||
chunk.equals(Action.DELETE) ||
chunk.equals(Action.TRACE) ||
chunk.equals(Action.OPTIONS) ||
chunk.equals(Action.CONNECT) ||
chunk.equals(Action.PATCH)
) {
action.httpMethod(chunk);
continue;
}
// last remaining unprocessed chunk is an alias
action.alias(chunk);
}
// process wrappers
if (wrappers.length == 0) {
wrappers = currentWrappers;
}
for (Class<? extends ActionWrapper> wrapper : wrappers) {
if (ReflectUtil.isTypeOf(wrapper, ActionInterceptor.class)) {
action.interceptBy((Class<? extends ActionInterceptor>) wrapper);
}
else if (ReflectUtil.isTypeOf(wrapper, ActionFilter.class)) {
action.filterBy((Class<? extends ActionFilter>) wrapper);
}
else {
throw new MadvocException("Invalid wrapper: " + wrapper.getName());
}
}
if (action.isSet()) {
action.bind();