isPollMethod = method.getName().startsWith( POLL_METHOD_NAME_PREFIX );
}
// Check that a method is just of only one kind of method
if( isStandardMethod && isFormPostMethod ) {
ApiConfigurationException ex = ApiConfigurationException.forMethodCantBeStandardAndFormPostMethodAtTheSameTime(actionTemplate, method);
logger.fatal( ex.getMessage(), ex );
throw ex;
}
if( (methodAnnotation != null || postMethodAnnotation != null) && isPollMethod) {
ApiConfigurationException ex = ApiConfigurationException.forPollMethodCantBeStandardOrFormPostMethodAtTheSameTime(actionTemplate, method);
logger.fatal( ex.getMessage(), ex );
throw ex;
}
// Process standard and form post methods together, as they are very similar
if( isStandardMethod || isFormPostMethod) {
String methodName = "";
if( isStandardMethod ) {
methodName = getStandardMethodName(method, methodAnnotation);
}
else {
methodName = getFormPostMethodName( method, postMethodAnnotation);
}
if( actionTemplate.hasStandardMethod(methodName) ) {
ApiConfigurationException ex = ApiConfigurationException.forMethodAlreadyRegisteredInAction(methodName, actionTemplate.getName());
logger.fatal( ex.getMessage(), ex );
throw ex;
}
if( isFormPostMethod && !RegisteredStandardMethod.isValidFormHandlingMethod(method)) {
ApiConfigurationException ex = ApiConfigurationException.forMethodHasWrongParametersForAFormHandler( actionTemplate.getName(), methodName );
logger.fatal( ex.getMessage(), ex );
throw ex;
}
for( RegisteredAction actionToRegister : actions ) {
actionToRegister.addStandardMethod( methodName, method, isFormPostMethod );