0

を解決し得ていない、私はhttps://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/appengine/endpoints-frameworks-v2/backend/src/main/java/com/example/echo/Echo.javaapiKeyRequired Googleのクラウドエンドポイントは、私はGoogleクラウドエンドポイントのAPIを作成してい

@ApiMethod(name = "echo_api_key", path = "echo_api_key", apiKeyRequired =AnnotationBoolean.TRUE) 
    public Message echoApiKey(Message message, @Named("n") @Nullable Integer n) { 
return doEcho(message, n); 
} 

私のコードに例として

apiKeyRequired = AnnotationBoolean.TRUE 

を使用しようとしていますこのです。 IDEはこの属性を解決できません。私はApiMethodアノテーションを逆コンパイル

@ApiMethod(
     name = "get", 
     path = "name/{id}", 
     httpMethod = ApiMethod.HttpMethod.GET, 
     apikeyRequired = AnnotationBoolean.TRUE) 

、それはあなたがKを活用する必要がある属性

package com.google.api.server.spi.config; 

import com.google.api.server.spi.config.ApiMethodCacheControl; 
import com.google.api.server.spi.config.AuthLevel; 
import com.google.api.server.spi.config.Authenticator; 
import com.google.api.server.spi.config.PeerAuthenticator; 
import java.lang.annotation.ElementType; 
import java.lang.annotation.Retention; 
import java.lang.annotation.RetentionPolicy; 
import java.lang.annotation.Target; 

@Retention(RetentionPolicy.RUNTIME) 
@Target({ElementType.METHOD}) 
public @interface ApiMethod { 
String name() default ""; 

String path() default ""; 

String httpMethod() default ""; 

/** @deprecated */ 
@Deprecated 
ApiMethodCacheControl cacheControl() default @ApiMethodCacheControl; 

AuthLevel authLevel() default AuthLevel.UNSPECIFIED; 

String[] scopes() default {"_UNSPECIFIED_LIST_STRING_VALUE"}; 

String[] audiences() default {"_UNSPECIFIED_LIST_STRING_VALUE"}; 

String[] clientIds() default {"_UNSPECIFIED_LIST_STRING_VALUE"}; 

Class<? extends Authenticator>[] authenticators() default {Authenticator.class}; 

Class<? extends PeerAuthenticator>[] peerAuthenticators() default {PeerAuthenticator.class}; 

public static class HttpMethod { 
    public static final String GET = "GET"; 
    public static final String POST = "POST"; 
    public static final String PUT = "PUT"; 
    public static final String DELETE = "DELETE"; 

    public HttpMethod() { 
    } 
    } 
    } 
+0

Cloud Endpoints Framework 2.0にapiKeyRequired属性が追加されました。依存関係の確認:com.google.endpoints:endpoints-framework:2.0.0(古いバージョンはcom.google.appengine:appengine-endpoints:1.x.xのようになります) – KrisPrajapati

答えて

0

をapikeyRequiredていません。つまり、apiKeyRequiredではなく、apikeyRequiredです。

1

私は前に同じ問題がありました。古いアプリケーションエンジンエンドポイントの依存関係をすべて削除し、新しいエンドポイントフレームワークを使用するようにしてください。

compile group: 'com.google.endpoints', name: 'endpoints-framework', version: '2.0.+' 
関連する問題