我有一个java app引擎Web服务,它使用通过Cloud Storage JSON API库访问的Google Cloud Storage.将我的SDK升级到1.19.30后,我开始从一个基本代码中获取异常,该代码从GCS中获取文件.相同的代码在早期的SDK(例如1.19.25)上运行良好,并且在部署到app引擎时也可以正常工作.所以..我想知道开发服务器中是否存在此错误.
目前,我的解决方法是使用较旧的SDK.
例外是:
com.google.apphosting.api.ApiProxy$FeatureNotEnabledException: The Files API is disabled. Further information: https://cloud.google.com/appengine/docs/deprecations/files_api
at com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.callInternal(ApiProxyLocalImpl.java:515)
at com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.call(ApiProxyLocalImpl.java:484)
at com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.call(ApiProxyLocalImpl.java:461)
at java.util.concurrent.Executors$PrivilegedCallable$1.run(Executors.java:493)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.concurrent.Executors$PrivilegedCallable.call(Executors.java:490)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Run Code Online (Sandbox Code Playgroud)
触发它的方法是:
private void getFile(HttpServletRequest req, HttpServletResponse resp, FileEntity fe) {
try {
GcsFilename filename = new GcsFilename(fe.getBucketName(), fe.getObjectName());
GcsFileMetadata metadata = GCS.getInstance().getMetadata(filename);
resp.setContentType(metadata.getOptions().getMimeType());
GcsInputChannel readChannel = GCS.getInstance().openPrefetchingReadChannel(filename, 0, GCS.BUFFER_SIZE);
GCS.copy(Channels.newInputStream(readChannel), resp.getOutputStream());
} catch (IOException e) {
// TODO Auto-generated …Run Code Online (Sandbox Code Playgroud)