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


Java HttpMethod.POST属性代码示例

本文整理汇总了Java中com.google.api.server.spi.config.ApiMethod.HttpMethod.POST属性的典型用法代码示例。如果您正苦于以下问题:Java HttpMethod.POST属性的具体用法?Java HttpMethod.POST怎么用?Java HttpMethod.POST使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.google.api.server.spi.config.ApiMethod.HttpMethod的用法示例。


在下文中一共展示了HttpMethod.POST属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSession

/**
 * Creates a new session from {@link WaxNewSessionRequest}.
 *
 * @return {@link WaxNewSessionResponse} with the created session id
 * @throws InternalServerErrorException if the session creation failed
 * @throws BadRequestException if the requested session name is bad
 */
@ApiMethod(
    name = "sessions.create",
    path = "newsession",
    httpMethod = HttpMethod.POST)
public WaxNewSessionResponse createSession(WaxNewSessionRequest request)
    throws InternalServerErrorException, BadRequestException {
  if (Strings.isNullOrEmpty(request.getSessionName())) {
    throw new BadRequestException("Name must be non-empty");
  }
  String sessionId =
      store.createSession(request.getSessionName(), request.getDurationInMillis());
  if (sessionId != null) {
    return new WaxNewSessionResponse(sessionId);
  }
  throw new InternalServerErrorException("Error while adding session");
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:23,代码来源:WaxEndpoint.java

示例2: registerGtfsTask

/**
 * Register the gtfs creation task.
 *
 * @author Rodrigo Cabrera ([email protected])
 * @param password a simple password to avoid excess of petitions
 * @param trailIds the trail ids to be added to the GTFS
 * @throws IOException 
 * @throws UnsupportedEncodingException 
 * @since 19 / feb / 2016
 */
@ApiMethod(name = "registerGtfsTask", path = "registerGtfsTask", httpMethod = HttpMethod.POST)
public void registerGtfsTask(@Named("password") String password, @Named("trailIds") String trailIds) throws TrailNotFoundException, UnsupportedEncodingException, IOException{
	logger.debug("registering gtfs task");
	FileInputStream inputStream = new FileInputStream(new File("WEB-INF/config.txt"));
	String passConfig = CharStreams.toString(new InputStreamReader(inputStream, "UTF-8"));

	if(password.equals(passConfig)){
		HashMap<String, String> params = new HashMap<>();
		params.put(GtfsGenerationTask.Params.trailIds.name(), trailIds);
		
		new GtfsGenerationTask().enqueue(params);
	}
	
	logger.debug("registration finished");
}
 
开发者ID:LabPLC,项目名称:MapatonAPI,代码行数:25,代码来源:MapatonPublicAPI.java

示例3: registerGtfsFullTask

/**
 * Register the gtfs creation task of all valid trails
 *
 * @author Rodrigo Cabrera ([email protected])
 * @param password a simple password to avoid excess of petitions
 * @throws IOException 
 * @throws UnsupportedEncodingException 
 * @since 26 / feb / 2016
 */
@ApiMethod(name = "registerGtfsFullTask", path = "registerGtfsFullTask", httpMethod = HttpMethod.POST)
public void registerGtfsFullTask(@Named("password") String password) throws TrailNotFoundException, UnsupportedEncodingException, IOException{
	logger.debug("registering gtfs task");
	FileInputStream inputStream = new FileInputStream(new File("WEB-INF/config.txt"));
	String passConfig = CharStreams.toString(new InputStreamReader(inputStream, "UTF-8"));

	if(password.equals(passConfig)){
		ArrayList<Long> ids = new TrailsHandler().getAllValidGtfsTrailsIds();
		HashMap<String, String> params = new HashMap<>();
		String trailIds = Arrays.toString(ids.toArray()).replace("[", "").replace("]", "").replace(" ", "");
		params.put(GtfsGenerationTask.Params.trailIds.name(), trailIds);
		
		new GtfsGenerationTask().enqueue(params);
	}
	
	logger.debug("registration finished");
}
 
开发者ID:LabPLC,项目名称:MapatonAPI,代码行数:26,代码来源:MapatonPublicAPI.java

示例4: pollVote

@ApiMethod(
	name = "meeting.pollVote",
	path = "meeting/{id}/poll/vote",
	httpMethod = HttpMethod.POST
)
public Meeting pollVote(@Named("id") String id, @Named("proposedStartDate") Long proposedStartDate, @Named("proposedEndDate") Long proposedEndDate, @Named("result") boolean result, com.google.appengine.api.users.User gUser) throws OAuthRequestException, MeetingPollPastException, EntityNotFoundException, UnauthorizedException {
	userService.ensureEnabled(gUser);
	
	Meeting meeting = meetingService.get(id);
	
	if (meeting == null) throw new EntityNotFoundException(id);
	if (meeting.isPast()) throw new MeetingPollPastException(id);
	
	MeetingPollProposedDate proposedDate = new MeetingPollProposedDate();
	proposedDate.setStartTimestamp(proposedStartDate);
	proposedDate.setEndTimestamp(proposedEndDate);
	
	MeetingPollVote vote = new MeetingPollVote();
	vote.setUser(userService.getUser(gUser));
	vote.setProposedDate(proposedDate);
	vote.setResult(result);
	
	meetingService.pollVote(meeting, vote);
	return meeting;
}
 
开发者ID:andryfailli,项目名称:teampot,代码行数:25,代码来源:MeetingEndpoint.java

示例5: removeMember

@ApiMethod(
	name = "project.removeMember",
	path = "project/{id}/removemember/{memberEmail}",
	httpMethod = HttpMethod.POST
)
public User removeMember(@Named("id") String id, @Named("memberEmail") String memberEmail, com.google.appengine.api.users.User gUser) throws OAuthRequestException, UnauthorizedException {
	userService.ensureEnabled(gUser);
	
	User member = userService.getUser(memberEmail);
	User user = userService.getUser(gUser);
	Project entity = projectService.get(id);

	projectService.removeMember(entity, member, user);
	
	return member;
}
 
开发者ID:andryfailli,项目名称:teampot,代码行数:16,代码来源:ProjectEndpoint.java

示例6: queryConferences

/**
 * Queries against the datastore with the given filters and returns the result.
 *
 * Normally this kind of method is supposed to get invoked by a GET HTTP method,
 * but we do it with POST, in order to receive conferenceQueryForm Object via the POST body.
 *
 * @param conferenceQueryForm A form object representing the query.
 * @return A List of Conferences that match the query.
 */
@ApiMethod(
        name = "queryConferences",
        path = "queryConferences",
        httpMethod = HttpMethod.POST
)
public List<Conference> queryConferences(ConferenceQueryForm conferenceQueryForm) {
    Iterable<Conference> conferenceIterable = conferenceQueryForm.getQuery();
    List<Conference> result = new ArrayList<>(0);
    List<Key<Profile>> organizersKeyList = new ArrayList<>(0);
    for (Conference conference : conferenceIterable) {
        organizersKeyList.add(Key.create(Profile.class, conference.getOrganizerUserId()));
        result.add(conference);
    }
    // To avoid separate datastore gets for each Conference, pre-fetch the Profiles.
    ofy().load().keys(organizersKeyList);
    return result;
}
 
开发者ID:udacity,项目名称:ud859,代码行数:26,代码来源:ConferenceApi.java

示例7: getConferencesCreated

/**
 * Returns a list of Conferences that the user created.
 * In order to receive the websafeConferenceKey via the JSON params, uses a POST method.
 *
 * @param user An user who invokes this method, null when the user is not signed in.
 * @return a list of Conferences that the user created.
 * @throws UnauthorizedException when the user is not signed in.
 */
@ApiMethod(
        name = "getConferencesCreated",
        path = "getConferencesCreated",
        httpMethod = HttpMethod.POST
)
public List<Conference> getConferencesCreated(final User user) throws UnauthorizedException {
    // If not signed in, throw a 401 error.
    if (user == null) {
        throw new UnauthorizedException("Authorization required");
    }
    String userId = getUserId(user);
    return ofy().load().type(Conference.class)
            .ancestor(Key.create(Profile.class, userId))
            .order("name").list();
}
 
开发者ID:udacity,项目名称:ud859,代码行数:23,代码来源:ConferenceApi.java

示例8: createHIT

@ApiMethod(name = "createHIT", path = "createHIT/{surveyId}", httpMethod = HttpMethod.POST)
public StringResponse createHIT(@Named("surveyId") String surveyId,
        @Nullable @Named("production") Boolean production, User user)
        throws InternalServerErrorException, NotFoundException, UnauthorizedException {
    Security.verifyAuthenticatedUser(user);
    try {
        Survey survey = surveyService.get(surveyId);
        if(survey == null) {
            throw new NotFoundException(String.format("Survey %s doesn't exist", surveyId));
        }
        HIT hit = createHITService.createHIT(production, survey);
        return new StringResponse(String.format("created HIT with id: %s", hit.getHITId()));
    } catch (MturkException e) {
        logger.log(Level.SEVERE, "Error creating HIT", e);
        throw new InternalServerErrorException(e.getMessage(), e);
    }
}
 
开发者ID:ipeirotis,项目名称:mturk-surveys,代码行数:17,代码来源:MturkEndpoint.java

示例9: auth

@ApiMethod(
	name = "user.auth", 
	path = "user/auth",
	httpMethod = HttpMethod.POST
)
public User auth(@Named("code") String code, com.google.appengine.api.users.User gUser) throws OAuthRequestException, IOException, UnauthorizedException {
	if (gUser == null) throw new GUserNullUnauthorizedException("User not logged in");
	
	GoogleCredential credential = GoogleServices.getCredentialFromOneTimeCode(gUser.getEmail(), code);
	
	User user = UserService.getInstance().getUser(gUser.getEmail());
	user.setCredential(credential);
			
	UserService.getInstance().provisionProfile(user);
	
	TaskService.getInstance().createCalendarEventsForUser(user);
	
	userService.ensureEnabled(user);
	
	return user;
}
 
开发者ID:andryfailli,项目名称:teampot,代码行数:21,代码来源:UserEndpoint.java

示例10: getConferencesCreated

@ApiMethod(
        name = "getConferencesCreated",
        path = "getConferencesCreated",
        httpMethod = HttpMethod.POST
)
public List<Conference> getConferencesCreated(final User user)
    throws UnauthorizedException {
    if (user == null) {
        throw new UnauthorizedException("Authorization required");
    }
    
    Key<Profile> userKey = Key.create(Profile.class, user.getUserId());
    Query<Conference> query = ofy().load().type(Conference.class).ancestor(userKey);
    
    return query.list();
}
 
开发者ID:DawoonC,项目名称:dw-scalable,代码行数:16,代码来源:ConferenceApi.java

示例11: invisible0

@ApiMethod(
    name = "api2.foos.invisible0",
    path = "invisible0",
    httpMethod = HttpMethod.POST
)
protected String invisible0() {
  return null;
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:8,代码来源:Endpoint2.java

示例12: invisible1

@SuppressWarnings("unused")
@ApiMethod(
    name = "api2.foos.invisible1",
    path = "invisible1",
    httpMethod = HttpMethod.POST
)
private String invisible1() {
  return null;
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:9,代码来源:Endpoint2.java

示例13: insertFoo

@ApiMethod(
    name = "foos.insert",
    path = "foos",
    httpMethod = HttpMethod.POST,
    cacheControl = @ApiMethodCacheControl(
        noCache = false,
        maxAge = 3
    )
)
public Foo insertFoo(Foo r) {
  return null;
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:12,代码来源:Endpoint1.java

示例14: removeSession

/**
 * Remove an existing session.
 * <p>
 * Clients that create sessions without a duration (will last forever) will need to call this
 * method on their own to clean up the session.
 *
 * @return {@link WaxRemoveSessionResponse} with the deleted session id
 * @throws InternalServerErrorException if the session deletion failed
 */
@ApiMethod(
    name = "sessions.remove",
    path = "removesession",
    httpMethod = HttpMethod.POST)
public WaxRemoveSessionResponse removeSession(@Named("sessionId") String sessionId)
    throws InternalServerErrorException {
  try {
    store.deleteSession(sessionId);
    return new WaxRemoveSessionResponse(sessionId);
  } catch (InvalidSessionException e) {
    throw new InternalServerErrorException(e.getMessage());
  }
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:22,代码来源:WaxEndpoint.java

示例15: getAllTrails

/**
 * Gets a number of trails from the datastore, can be paginated using a cursor (send empty to start from the beginning)
 *
 * @author Rodrigo Cabrera ([email protected])
 * @param parameter the cursor to know where to start from, and number of elements needed
 * @return the number of trails from the cursor sent
 * @since 16 / feb / 2016
 */
@ApiMethod(path = "getAllTrails", name = "getAllTrails", httpMethod = HttpMethod.POST)
public TrailListResponse getAllTrails(CursorParameter parameter){
	logger.debug("Getting all trails for all user ");

	TrailListResponse result = new TrailsHandler().getAllTrails(parameter);
	logger.debug("All mapped trails ");

	return result;
}
 
开发者ID:LabPLC,项目名称:MapatonAPI,代码行数:17,代码来源:MapatonPublicAPI.java


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