public ResponseEntity callback()

in solution/solution-oss-pre-signed/code-example/java/spring-boot/src/main/java/org/example/service/UploadService.java [140:162]


    public ResponseEntity<PostCallbackResp> callback(String callbackBody, HttpServletRequest request) {
        HttpStatus status = HttpStatus.OK;
        PostCallbackResp postCallbackResp = new PostCallbackResp();
        try {
            Boolean verification = verifyOssCallback(callbackBody, request);
            if (verification) {
                postCallbackResp.setSuccess(true);
                postCallbackResp.setMessage("Upload successfully.");
            } else {
                status = HttpStatus.BAD_REQUEST;
                postCallbackResp.setSuccess(false);
                postCallbackResp.setMessage("OSS callback verification failed.");
            }
        } catch (Exception e) {
            // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
            e.printStackTrace();
            status = HttpStatus.BAD_REQUEST;
            postCallbackResp.setSuccess(false);
            postCallbackResp.setMessage("A system error occurred.");
        }

        return ResponseEntity.status(status).body(postCallbackResp);
    }