根据Google App Engine灵活的文档,对于任何传入请求,作为应用程序的服务,App Engine会向所有请求添加以下标头:
X-AppEngine-Country as an ISO 3166-1 alpha-2 country code
X-AppEngine-Region as an ISO-3166-2 standard
X-AppEngine-City
X-AppEngine-CityLatLong
X-Cloud-Trace-Context
X-Forwarded-For: [CLIENT_IP(s)], [global forwarding rule IP]
X-Forwarded-Proto [http | https]
Run Code Online (Sandbox Code Playgroud)
无论如何,我可以使用Java从请求标头使用上述信息获得时区偏移量?
我正在使用Blueimp/jQuery-File-Upload进行多个图像上传,我把sql语句放在数据库中为blueimp/jQuery-File-Upload 存储图像文件名?
我正在使用 Google 服务帐户使用以下代码从服务端获取访问令牌。但我得到的访问令牌为空。相同的返回令牌将用于在客户端为相同的 userEmailId 打开 Google 文件选择器。请建议我在代码中做错了什么。
private static final List SCOPE = Arrays.asList("https://www.googleapis.com/auth/drive");
public String getAccessToken(String SERVICE_ACCOUNT_EMAIL, String SERVICE_ACCOUNT_PKCS12_FILE_PATH,String userEmailId){
try {
HttpTransport httpTransport = new NetHttpTransport();
JsonFactory jsonFactory = new JacksonFactory();
GoogleCredential credential = new GoogleCredential.Builder()
.setTransport(httpTransport)
.setJsonFactory(jsonFactory)
.setServiceAccountId(SERVICE_ACCOUNT_EMAIL)
.setServiceAccountScopes(SCOPE)
.setServiceAccountUser(userEmailId)
.setServiceAccountPrivateKeyFromP12File(new java.io.File(SERVICE_ACCOUNT_PKCS12_FILE_PATH))
.build();
credential.getRefreshToken();
return credential.getAccessToken();
} catch (Exception e) {
// TODO: handle exception
log.severe("Error while getting Drive credentilas. 5.0"+ e.getMessage());
return null;
}
}Run Code Online (Sandbox Code Playgroud)