当前位置: 首页>>代码示例>>Java>>正文


Java HttpMethod.GET属性代码示例

本文整理汇总了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;
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:25,代码来源:TestEndpoint.java

示例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;
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:17,代码来源:Endpoint1.java

示例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);
}
 
开发者ID:mzdu,项目名称:AdSearch_Endpoints,代码行数:26,代码来源:AdSearchEndpoints.java

示例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");
	}
		
}
 
开发者ID:andryfailli,项目名称:teampot,代码行数:21,代码来源:TaskEndpoint.java

示例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();
}
 
开发者ID:DawoonC,项目名称:dw-scalable,代码行数:31,代码来源:ConferenceApi.java

示例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();
}
 
开发者ID:udacity,项目名称:ud859,代码行数:29,代码来源:ConferenceApi.java

示例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;
}
 
开发者ID:udacity,项目名称:ud859,代码行数:22,代码来源:ConferenceApi.java

示例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);
}
 
开发者ID:andryfailli,项目名称:teampot,代码行数:19,代码来源:UserEndpoint.java

示例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();
}
 
开发者ID:vs4vijay,项目名称:conferencified,代码行数:29,代码来源:ConferenceApi.java

示例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();
}
 
开发者ID:DawoonC,项目名称:dw-scalable,代码行数:31,代码来源:ConferenceApi.java

示例11: fn2

@ApiMethod(
    name = "api6.foos.fn2",
    path = "fn2",
    httpMethod = HttpMethod.GET
)
public Object fn2() {
  return null;
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:8,代码来源:BridgeInheritanceEndpoint.java

示例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;
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:13,代码来源:ReferenceOverridingEndpoint.java

示例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;
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:12,代码来源:Endpoint1.java

示例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();
}
 
开发者ID:mzdu,项目名称:AdSearch_Endpoints,代码行数:8,代码来源:AdSearchEndpoints.java

示例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());
}
 
开发者ID:victorkp,项目名称:GlassWebNotes,代码行数:16,代码来源:EndpointAPI.java


注:本文中的com.google.api.server.spi.config.ApiMethod.HttpMethod.GET属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。