小编Man*_*ane的帖子

是否可以从谷歌应用引擎响应标题中删除"谷歌前端"?

我想知道是否有任何方法可以从google app引擎响应标头中删除服务器名称(Google Frontend),以隐藏应用程序部署在GAE上.

google-app-engine httpresponse http-headers response-headers

11
推荐指数
2
解决办法
6958
查看次数

Google应用引擎更新用户信息获取错误400 BAD_REQUEST

使用Admin SDK的Directory API更新用户信息时收到错误:

400 BAD_REQUEST

{
  "code" : 400,
  "errors" : [ {
    "domain" : "global",
    "message" : "Invalid Input: Bad request for ",
    "reason" : "invalid"
  } ],
  "message" : "Invalid Input: Bad request for "
}
Run Code Online (Sandbox Code Playgroud)

尝试为用户更新组织详细信息,如名称,标题和部门

我的示例代码: `

Get users = directoryService.users().get(userEmail);
User user = users.execute();
try{
    List<UserOrganization> userOrg = new ArrayList<UserOrganization>();
    userOrg = user.getOrganizations();
    if(userOrg != null){
        UserOrganization f_userOrg = new UserOrganization();
        f_userOrg = userOrg.get(0);
     if(f_userOrg != null){
            f_userOrg.setTitle("SAP Asso");
            f_userOrg.setName("xyz company name");
            f_userOrg.setDepartment("xyz dept name"); …
Run Code Online (Sandbox Code Playgroud)

java google-app-engine google-admin-sdk google-directory-api

5
推荐指数
1
解决办法
404
查看次数

返回不同类型的方法?

我正在写一个方法.

这是层次结构树:

IProtocoll
|
|--ProtocolImpl1
|
|--ProtocolImpl2
|
|--ProtocolImpl3
Run Code Online (Sandbox Code Playgroud)

该方法本身如下所示:

public static List<IProtocol> getProtocolsByType(String type, Transaction trx) {
    Iterator<IProtocol> protocols = trx.getProtocols();
    List<IProtocol> protocolsList = new ArrayList<IProtocol>();
    while (protocols.hasNext()) {
        if (StringHeper.isEqual(protocolls.next().getProtocolType(), type) {
            protocolsList.add(protocolls.next());
        }
    }
    return protocolsList
}
Run Code Online (Sandbox Code Playgroud)

和用法示例.

List<IProtocol> list = ProtocolHelper.getrProtocolsByType("PROTOCOL1", trx)

for (IProtocol protocol : list) {
    ProtocolHelper.createProtocolType1((ProtocolImpl1) protocol)
}
Run Code Online (Sandbox Code Playgroud)

现在 - 如在类型层次结构中所见 - 这种方法可以返回3种可能性.

String type正在定义应返回什么类型的协议.trx.getProtocols()将返回包含所有3种类型协议的迭代器.

有没有办法以某种方式统一这个方法,它将返回这3种类型中的一种,而不使用以后使用该方法时不必要的转换?

java collections iterator

3
推荐指数
1
解决办法
97
查看次数