本文整理汇总了Java中com.google.api.server.spi.config.ApiMethod.HttpMethod.GET属性的典型用法代码示例。如果您正苦于以下问题:Java HttpMethod.GET属性的具体用法?Java HttpMethod.GET怎么用?Java HttpMethod.GET使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.google.api.server.spi.config.ApiMethod.HttpMethod
的用法示例。
在下文中一共展示了HttpMethod.GET属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testParamsQuery
@ApiMethod(httpMethod = HttpMethod.GET, path = "testparamsquery")
public FieldContainer testParamsQuery(
@Named("anint") Integer anInt,
@Named("along") Long aLong,
@Named("afloat") Float aFloat,
@Named("adouble") Double aDouble,
@Named("aboolean") Boolean aBoolean,
@Named("astring") String aString,
@Named("asimpledate") SimpleDate aSimpleDate,
@Named("adateandtime") DateAndTime aDateAndTime,
@Named("adate") Date aDate,
@Named("anenum") TestEnum anEnum) {
FieldContainer ret = new FieldContainer();
ret.anInt = anInt;
ret.aLong = aLong;
ret.aFloat = aFloat;
ret.aDouble = aDouble;
ret.aBoolean = aBoolean;
ret.aString = aString;
ret.aSimpleDate = aSimpleDate;
ret.aDateAndTime = aDateAndTime;
ret.aDate = aDate;
ret.anEnum = anEnum;
return ret;
}
示例2: listFoos
@ApiMethod(
name = "foos.list",
path = "foos",
httpMethod = HttpMethod.GET,
cacheControl = @ApiMethodCacheControl(
noCache = true,
maxAge = 1
),
scopes = {"s0", "s1 s2"},
audiences = {"a0", "a1"},
clientIds = {"c0", "c1"},
authenticators = { FailAuthenticator.class },
peerAuthenticators = { FailPeerAuthenticator.class }
)
public List<Foo> listFoos() {
return null;
}
示例3: getTokens
@ApiMethod(name = "getTokens", path = "getTokens",
httpMethod = HttpMethod.GET)
public List<String> getTokens(@Named("name") String queryString) {
// add Ads data
AdsData ads1 = new AdsData((long) 1231, (long) 66, "basketball kobe shoe nike", 0.37f, 6.0f);
ofy().save().entity(ads1).now();
AdsData ads2 = new AdsData((long) 1232, (long) 66, "soccer shoe nike", 0.23f, 4.0f);
ofy().save().entity(ads2).now();
AdsData ads3 = new AdsData((long) 1233, (long) 67, "running shoe adidas", 0.53f, 7.5f);
ofy().save().entity(ads3).now();
AdsData ads4 = new AdsData((long) 1234, (long) 67, "soccer shoe adidas", 0.19f, 3.5f);
ofy().save().entity(ads4).now();
AdsData ads5 = new AdsData((long) 1235, (long) 67, "basketball shoe adidas", 0.29f, 5.5f);
ofy().save().entity(ads5).now();
// add Campaign data
CampaignData cmp1 = new CampaignData((long) 66, 1500f);
ofy().save().entity(cmp1).now();
CampaignData cmp2 = new CampaignData((long) 67, 2800f);
ofy().save().entity(cmp2).now();
CampaignData cmp3 = new CampaignData((long) 68, 900f);
ofy().save().entity(cmp3).now();
return QUERY_PARSER.parseQuery(queryString);
}
示例4: list
@ApiMethod(
name = "task.list",
path = "task",
httpMethod = HttpMethod.GET
)
public List<Task> list(com.google.appengine.api.users.User gUser, @Nullable @Named("project") String projectId, @Nullable @Named("user") String userId) throws OAuthRequestException, UnauthorizedException, EntityNotFoundException {
userService.ensureEnabled(gUser);
if (projectId != null && userId == null)
return taskService.list(projectId);
else if (projectId == null && userId != null) {
User assignee = userService.get(userId);
if (assignee == null) throw new EntityNotFoundException("User "+userId+" not found");
return taskService.listToDoForUser(assignee);
} else if (projectId == null && userId == null) {
return taskService.list();
} else {
throw new IllegalArgumentException("Please, specify only one of project or user, not both");
}
}
示例5: getSessionsInWishlist
/**
* Returns a collection of Session Object that the user has added to wishlist.
*
* @param user An user who invokes this method, null when the user is not signed in.
* @return a Collection of Sessions that the user has added to wishlist.
* @throws UnauthorizedException when the User object is null.
*/
@ApiMethod(
name = "getSessionsInWishlist",
path = "getSessionsInWishlist",
httpMethod = HttpMethod.GET
)
public Collection<Session> getSessionsInWishlist(final User user)
throws UnauthorizedException, NotFoundException {
if (user == null) {
throw new UnauthorizedException("Authorization required");
}
Profile profile = getProfileFromUser(user);
if (profile == null) {
throw new NotFoundException("Profile doesn't exist.");
}
List<String> keyStringsInWishlist = profile.getSessionKeysInWishlist();
List<Key<Session>> keysInWishlist = new ArrayList<>();
for (String keyString : keyStringsInWishlist) {
keysInWishlist.add(Key.<Session>create(keyString));
}
return ofy().load().keys(keysInWishlist).values();
}
示例6: getConferencesToAttend
/**
* Returns a collection of Conference Object that the user is going to attend.
*
* @param user An user who invokes this method, null when the user is not signed in.
* @return a Collection of Conferences that the user is going to attend.
* @throws UnauthorizedException when the User object is null.
*/
@ApiMethod(
name = "getConferencesToAttend",
path = "getConferencesToAttend",
httpMethod = HttpMethod.GET
)
public Collection<Conference> getConferencesToAttend(final User user)
throws UnauthorizedException, NotFoundException {
// If not signed in, throw a 401 error.
if (user == null) {
throw new UnauthorizedException("Authorization required");
}
Profile profile = ofy().load().key(Key.create(Profile.class, user.getUserId())).now();
if (profile == null) {
throw new NotFoundException("Profile doesn't exist.");
}
List<String> keyStringsToAttend = profile.getConferenceKeysToAttend();
List<Key<Conference>> keysToAttend = new ArrayList<>();
for (String keyString : keyStringsToAttend) {
keysToAttend.add(Key.<Conference>create(keyString));
}
return ofy().load().keys(keysToAttend).values();
}
示例7: getConference
/**
* Returns a Conference object with the given conferenceId.
*
* @param websafeConferenceKey The String representation of the Conference Key.
* @return a Conference object with the given conferenceId.
* @throws NotFoundException when there is no Conference with the given conferenceId.
*/
@ApiMethod(
name = "getConference",
path = "conference/{websafeConferenceKey}",
httpMethod = HttpMethod.GET
)
public Conference getConference(
@Named("websafeConferenceKey") final String websafeConferenceKey)
throws NotFoundException {
Key<Conference> conferenceKey = Key.create(websafeConferenceKey);
Conference conference = ofy().load().key(conferenceKey).now();
if (conference == null) {
throw new NotFoundException("No Conference found with key: " + websafeConferenceKey);
}
return conference;
}
示例8: get
@ApiMethod(
name = "user.get",
path = "user/{id}",
httpMethod = HttpMethod.GET
)
public User get(@Named("id") String id, com.google.appengine.api.users.User gUser) throws EntityNotFoundException,OAuthRequestException, UnauthorizedException {
userService.ensureEnabled(gUser);
User entity;
if (id.equals("me")) {
entity = UserService.getInstance().getUser(gUser);
} else {
entity = dao.get(id);
}
if (entity != null)
return entity;
else
throw new EntityNotFoundException(id);
}
示例9: getConferencesToAttend
/**
* Returns a collection of Conference Object that the user is going to attend.
*
* @param user An user who invokes this method, null when the user is not signed in.
* @return a Collection of Conferences that the user is going to attend.
* @throws UnauthorizedException when the User object is null.
*/
@ApiMethod(
name = "getConferencesToAttend",
path = "getConferencesToAttend",
httpMethod = HttpMethod.GET
)
public Collection<Conference> getConferencesToAttend(final User user)
throws UnauthorizedException, NotFoundException {
// If not signed in, throw a 401 error.
if (user == null) {
throw new UnauthorizedException("Authorization required");
}
Profile profile = ofy().load().key(Key.create(Profile.class, getUserId(user))).now();
if (profile == null) {
throw new NotFoundException("Profile doesn't exist.");
}
List<String> keyStringsToAttend = profile.getConferenceKeysToAttend();
List<Key<Conference>> keysToAttend = new ArrayList<>();
for (String keyString : keyStringsToAttend) {
keysToAttend.add(Key.<Conference>create(keyString));
}
return ofy().load().keys(keysToAttend).values();
}
示例10: getConferencesToAttend
/**
* Returns a collection of Conference Object that the user is going to attend.
*
* @param user An user who invokes this method, null when the user is not signed in.
* @return a Collection of Conferences that the user is going to attend.
* @throws UnauthorizedException when the User object is null.
*/
@ApiMethod(
name = "getConferencesToAttend",
path = "getConferencesToAttend",
httpMethod = HttpMethod.GET
)
public Collection<Conference> getConferencesToAttend(final User user)
throws UnauthorizedException, NotFoundException {
if (user == null) {
throw new UnauthorizedException("Authorization required");
}
Profile profile = getProfileFromUser(user);
if (profile == null) {
throw new NotFoundException("Profile doesn't exist.");
}
List<String> keyStringsToAttend = profile.getConferenceKeysToAttend();
List<Key<Conference>> keysToAttend = new ArrayList<>();
for (String keyString : keyStringsToAttend) {
keysToAttend.add(Key.<Conference>create(keyString));
}
return ofy().load().keys(keysToAttend).values();
}
示例11: fn2
@ApiMethod(
name = "api6.foos.fn2",
path = "fn2",
httpMethod = HttpMethod.GET
)
public Object fn2() {
return null;
}
示例12: getFoo
@ApiMethod(
name = "foos.get3",
path = "foos/{id}",
httpMethod = HttpMethod.GET,
cacheControl = @ApiMethodCacheControl(
noCache = false,
maxAge = 2
)
)
@Override
public Foo getFoo(@Named("id") String id) {
return null;
}
示例13: getFoo
@ApiMethod(
name = "foos.get",
path = "foos/{id}",
httpMethod = HttpMethod.GET,
cacheControl = @ApiMethodCacheControl(
noCache = false,
maxAge = 2
)
)
public Foo getFoo(@Named("id") String id) {
return null;
}
示例14: optimize
@ApiMethod(name = "optimize", path = "optimize",
httpMethod = HttpMethod.GET)
public List<AdsStatsInfo> optimize(@Named("keyWords") List<String> keyWords) {
AdsOptimization adsOptimizer = new AdsOptimizationImpl(findMatch(keyWords));
return adsOptimizer.filterAds(INVENTORY, MIN_RELEVANCE_SCORE, MIN_RESERVE_PRICE)
.selectTopK(K).deDup().adsPricingAndAllocation(INVENTORY, MAINLINE_RESERVE_PRICE)
.showResult();
}
示例15: persistCache
/**
* Called by a cron job to put the contents of the write cache in the datastore.
*/
@ApiMethod(name = "persist_cache", path="persist_cache", httpMethod = HttpMethod.GET)
public UserData persistCache() throws IOException, IllegalArgumentException {
try{
// Add the data to the datastore
UserDatabase.writeCacheToDatastore();
} catch (Exception e){
e.printStackTrace();
return new UserData("Server", "Failed to persist write cache", System.currentTimeMillis());
}
return new UserData("Server", "Persisted the write cache", System.currentTimeMillis());
}