private void fillParamsMetadata(ApiAction action, MethodRef methodRef) throws ApiException { final Class[] params = methodRef.getMethod().getParameterTypes(); for (final Class paramType : params) { if (paramType.equals(RequestContext.class)) { methodRef.addParam(RequestObjectParam.getInstance()); } else if (paramType.equals(HttpServletRequest.class)) { methodRef.addParam(HttpServletRequestParam.getInstance()); } else if (paramType.equals(HttpServletResponse.class)) { methodRef.addParam(HttpServletResponseParam.getInstance()); } else if (Model.class.isAssignableFrom(paramType) && action.getModelType() == null) { methodRef.addParam(buildModelParam(paramType)); action.setModelType(paramType); } else { throw new ApiException( "Unexpected action parameter " + paramType.getName() + " for action " + action); } } }