我有一段代码如下。有没有人经历过这个问题?谢谢!
def update() {
String metadata = request.reader.text
logger.info("Updating the submission: $metadata")
Map<String, Object> working = [isUpdate: true, isUpdateOnExistingModel: true, isAmend: false, isMetadataSubmission: false]
if (metadata) {
makeSubmission(metadata, working)
} else {
logger.debug("Cannot update the model as requested because of the empty input.")
}
}
private void makeSubmission(String metadata, Map working) {
String uuid = request.getHeader("SubmissionFolder")
working.put("submissionFolder", uuid)
def currentUser = springSecurityService.currentUser
working.put("submitterInfo", [userRealName: currentUser?.person?.userRealName,
username: currentUser.username, email: currentUser.email])
Map map
try {
submissionService.buildFromJSONFile(metadata, working)
} catch (Exception e) {
logger.error e.getMessage()
} finally {
working["repository_files"] = null
if (!working["repository_files"]) {
String msg = "Cannot find the model files. The submission process has to be terminated!"
logger.error(msg)
map = [message: msg, status: 400]
} else {
doValidateSubmissionData(working)
map = doCompleteSubmission()
}
}
withFormat {
json { render map as JSON }
xml { render map as XML }
'*' { render status: 415, view: "/errors/error415" }
}
}
当我启用调试模式(在 IntelliJ IDEA 中)时,入口点(例如,
update
)会被调用两次。请参阅屏幕录制此处。