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


Java RequestBody类代码示例

本文整理汇总了Java中org.springframework.web.bind.annotation.RequestBody的典型用法代码示例。如果您正苦于以下问题:Java RequestBody类的具体用法?Java RequestBody怎么用?Java RequestBody使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testConnectorCallback

import org.springframework.web.bind.annotation.RequestBody; //导入依赖的package包/类
@RequestMapping(value = "/CISCore/postmessage/other", method = RequestMethod.POST)
public ResponseEntity<Response> testConnectorCallback(@RequestBody CISOtherContent otherpayload) {
	log.info("--> testConnectorCallback");
	Response response = new Response();
	
	log.info(otherpayload);
	
	log.info("testConnectorCallback -->");
	return new ResponseEntity<Response>(response, HttpStatus.OK);
}
 
开发者ID:DRIVER-EU,项目名称:CommonInformationSpace,代码行数:11,代码来源:CISCoreConnectorRestController.java

示例2: updateAllRecord

import org.springframework.web.bind.annotation.RequestBody; //导入依赖的package包/类
/**
	 * 更新当前全部记录
	 * @throws InterruptedException 
	 * @throws IOException 
	 */
	@RequestMapping(value= "/updateAllRecord", method=RequestMethod.POST)
	public String updateAllRecord(@RequestBody List<Object> updateRecordList) throws IOException, InterruptedException {
		String executeFile = getExecuteFile();
		ArrayList<Thread> threadList = new ArrayList<Thread>();
		for(int i=0; i < updateRecordList.size(); i++) {
			HashMap<String, String> allRecord = (HashMap<String, String>) updateRecordList.get(i);
//			executePy(allRecord.get("jobTable"), allRecord.get("jobPath"), allRecord.get("jobName"), 
//					allRecord.get("jobDay"), allRecord.get("jobType"), executeFile);
			Thread newThread = new Thread(new MyRunable(allRecord, executeFile));
			newThread.start();
			threadList.add(newThread);

		}
		
		for(Thread thread: threadList) {
			thread.join();
		} 
		
		System.out.println("主线程执行完毕");
		return "index";
	}
 
开发者ID:lpj24,项目名称:jobManage,代码行数:27,代码来源:JobManageController.java

示例3: sendEmail

import org.springframework.web.bind.annotation.RequestBody; //导入依赖的package包/类
@ApiOperation(value = "Trimite email.", tags = {"email"})
@RequestMapping(value = {"/mail"}, method = {RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_VALUE,
        consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public ResponseEntity<String> sendEmail(@RequestBody @Valid EmailModel model) {
    logger.info("start: trimitere email");

    try {
        mailService.send(model);
    } catch (VaVedemApiException ex) {
        if (ex instanceof VaVedemEmailException) {
            logger.info(ex.getMessage());
            return new ResponseEntity("error send email", HttpStatus.BAD_REQUEST);
        }
    }

    return new ResponseEntity<String>(HttpStatus.OK);
}
 
开发者ID:CoruptiaUcide,项目名称:va-vedem-api,代码行数:19,代码来源:MailAPI.java

示例4: updatePodInfo

import org.springframework.web.bind.annotation.RequestBody; //导入依赖的package包/类
/**
 * Create / update pod info.  This endpoint is protected by an "API key" to prevent unauthorized access which
 * could inject bogus pod information into the PodDirectory. For this implementation, the API key is just a
 * hardcoded constant.  Real implementations probably want something more secure - at least a different API key
 * for each pod. The API key is passed as an HTTP header value with name "X-API-KEY".
 *
 * @param podInfo PodInfo object containing metadata about a pod
 * @param apiKey API Key.  Comes from HTTP Header value "X-API-KEY"
 *
 * @return HTTP 401 - if API key missing or invalid<br/>
 *         HTTP 400 - if PodInfo bad or missing<br/>
 *         HTTP 200 - otherwise.
 */
@RequestMapping(method = RequestMethod.POST, path = "/podInfo")
public ResponseEntity updatePodInfo(@RequestBody PodInfo podInfo, @RequestHeader("X-API-KEY") String apiKey) {

    // Check API key
    if (StringUtils.isEmpty(apiKey) || !webhookConfiguration.getApiKey().equals(apiKey)) {
        return new ResponseEntity(HttpStatus.UNAUTHORIZED);
    }

    // Ensure pod info present and at least has company ID.
    if (StringUtils.isEmpty(podInfo.getCompanyId())) {
        return new ResponseEntity(HttpStatus.BAD_REQUEST);
    }

    // Store pod info
    podDirectory.addPodInfo(podInfo);

    return new ResponseEntity(HttpStatus.OK);

}
 
开发者ID:symphonyoss,项目名称:app-auth-example,代码行数:33,代码来源:DirectoryWebhookController.java

示例5: updateOE_HEL_SP_AI_Stars

import org.springframework.web.bind.annotation.RequestBody; //导入依赖的package包/类
@RequestMapping(value = "/updateOE_HEL_SP_AI_Stars")
@ResponseBody
public PageData updateOE_HEL_SP_AI_Stars(@RequestBody PageData pd) throws Exception {
	if (StringUtils.isBlank(pd.getString("OE_TYPE"))) {
		return WebResult.requestFailed(10001, "参数缺失!", null);
	}
	else {
		if("1".equals(pd.getString("OE_TYPE"))){//专家
			appUserEvaluateMapper.updateHEL_STARS(pd);
		}else if("2".equals(pd.getString("OE_TYPE"))){//代理
			appUserEvaluateMapper.updateSP_STARS(pd);
		}else if("3".equals(pd.getString("OE_TYPE"))){//陪诊
			appUserEvaluateMapper.updateAI_STARS(pd);
		}
		return WebResult.requestSuccess();
	}
}
 
开发者ID:noseparte,项目名称:Spring-Boot-Server,代码行数:18,代码来源:AppUserEvaluateRestful.java

示例6: getDoctorInfo

import org.springframework.web.bind.annotation.RequestBody; //导入依赖的package包/类
/**
 * 医生信息
 * @return
 */
@RequestMapping(value = "/get")
@ResponseBody
public PageData getDoctorInfo(@RequestBody PageData pd) throws Exception {
	if (StringUtils.isBlank(pd.getString("HEL_ID"))) {
		return WebResult.requestFailed(10001, "参数缺失!", null);
	}
	else {
		PageData earnestMoney = appServiceMapper.getEarestMoney();
		String searnestMoney = earnestMoney.getString("CODE");
		float f = Float.valueOf("500");
		if (StringUtils.isNotBlank(searnestMoney)) {
			f = Float.valueOf(searnestMoney);
		}
		PageData accInfo = appDoctorInfoMapper.getDoctorInfo(pd);
		accInfo.put("EARNEST_MONEY", f);
		List<PageData> videoList = appDoctorInfoMapper.getDoctorVideoList(pd);
		accInfo.put("videoList", videoList);
		List<PageData> deptVideoList = appDoctorInfoMapper.getDeptVideoList(accInfo);
		accInfo.put("deptVideoList", deptVideoList);
		return WebResult.requestSuccess(accInfo);
	}
}
 
开发者ID:noseparte,项目名称:Spring-Boot-Server,代码行数:27,代码来源:AppDoctorInfoRestful.java

示例7: add

import org.springframework.web.bind.annotation.RequestBody; //导入依赖的package包/类
@PostMapping("history")
public ResponseEntity<?> add(@RequestBody CalcEntry entry) {
	
	try
	{
		entry = CalcWorker.getResult( entry );
	}
	catch (CalcException e)
	{
		LOGGER.error("Exception while calculation result for {}", entry.getOperation());
		// TODO: Stacktrace in logger
		
		// TODO: Error Message (not only Error Status) to Frontend?
		return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
	}
	
	return ResponseEntity.ok(repo.save(entry));
}
 
开发者ID:ZaidoR1,项目名称:calculator,代码行数:19,代码来源:CalcController.java

示例8: postHTML2

import org.springframework.web.bind.annotation.RequestBody; //导入依赖的package包/类
@RequestMapping(
		value = "/changeInfo",
		method = RequestMethod.POST, produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE },
		consumes = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE })
public ResponseEntity<ChangePasswordInfo> postHTML2(@RequestBody ChangePassword info){

	if (info.getEmail() == null || info.getPassword() == null || info.getNewPassword() == null
			|| info.getEmail().equals("") || info.getPassword().equals("") || info.getNewPassword().equals("")) {
		throw new HTTP404Exception("No se han introducido todos los datos");
	}
	
	Ciudadano ci = updateInfo.UpdateCitizen(info);
	
	if (ci == null) {
		throw new HTTP404Exception("Email o contraseña incorrectas");
	}
	
	
	return new ResponseEntity<ChangePasswordInfo>(new ChangePasswordInfo("Se ha cambiado correctamente la contraseña"),
			HttpStatus.OK);
}
 
开发者ID:Arquisoft,项目名称:participants1b,代码行数:22,代码来源:UpdateInfoController.java

示例9: gerarTokenJwt

import org.springframework.web.bind.annotation.RequestBody; //导入依赖的package包/类
/**
 * Gera e retorna um novo token JWT.
 * 
 * @param authenticationDto
 * @param result
 * @return ResponseEntity<Response<TokenDto>>
 * @throws AuthenticationException
 */
@PostMapping
public ResponseEntity<Response<TokenDto>> gerarTokenJwt(
		@Valid @RequestBody JwtAuthenticationDto authenticationDto, BindingResult result)
		throws AuthenticationException {
	Response<TokenDto> response = new Response<TokenDto>();

	if (result.hasErrors()) {
		log.error("Erro validando lançamento: {}", result.getAllErrors());
		result.getAllErrors().forEach(error -> response.getErrors().add(error.getDefaultMessage()));
		return ResponseEntity.badRequest().body(response);
	}

	log.info("Gerando token para o email {}.", authenticationDto.getEmail());
	Authentication authentication = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(
			authenticationDto.getEmail(), authenticationDto.getSenha()));
	SecurityContextHolder.getContext().setAuthentication(authentication);

	UserDetails userDetails = userDetailsService.loadUserByUsername(authenticationDto.getEmail());
	String token = jwtTokenUtil.obterToken(userDetails);
	response.setData(new TokenDto(token));

	return ResponseEntity.ok(response);
}
 
开发者ID:SergioColetto,项目名称:borabeber-api,代码行数:32,代码来源:AuthenticationController.java

示例10: saveService

import org.springframework.web.bind.annotation.RequestBody; //导入依赖的package包/类
/**
 * Adds the service to the Service Registry.
 * @param request the request
 * @param response the response
 * @param result the result
 * @param service the edit bean
 */
@RequestMapping(method = RequestMethod.POST, value = {"saveService.html"})
public void saveService(final HttpServletRequest request,
                        final HttpServletResponse response,
                        @RequestBody final RegisteredServiceEditBean.ServiceData service,
                        final BindingResult result) {
    try {

        final RegisteredService svcToUse = registeredServiceFactory.createRegisteredService(service);
        final RegisteredService newSvc = this.servicesManager.save(svcToUse);
        logger.info("Saved changes to service {}", svcToUse.getId());

        final Map<String, Object> model = new HashMap<>();
        model.put("id", newSvc.getId());
        model.put("status", HttpServletResponse.SC_OK);
        JsonViewUtils.render(model, response);

    } catch (final Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:yuweijun,项目名称:cas-server-4.2.1,代码行数:28,代码来源:RegisteredServiceSimpleFormController.java

示例11: track

import org.springframework.web.bind.annotation.RequestBody; //导入依赖的package包/类
@ResponseBody
@RequestMapping(value = "/bed/track/histogram", method = RequestMethod.POST)
@ApiOperation(
        value = "Returns a histogram of BED records amount on regions of chromosome",
        notes = "It provides histogram for a BEd track with the given scale factor between the " +
                "beginning position with the first base having position 1 and ending position inclusive " +
                "in a target chromosome. All parameters are mandatory and described below:<br/><br/>" +
                "1) <b>id</b> specifies ID of a track;<br/>" +
                "2) <b>chromosomeId</b> specifies ID of a chromosome corresponded to a track;<br/>" +
                "3) <b>startIndex</b> is the most left base position for a requested window. The first base in a " +
                "chromosome always has got position 1;<br/>" +
                "4) <b>endIndex</b> is the last base position for a requested window. " +
                "It is treated inclusively;<br/>" +
                "5) <b>scaleFactor</b> specifies an inverse value to number of bases per one visible element" +
                " on a track (e.g., pixel) - IS IGNORED FOR NOW",
        produces = MediaType.APPLICATION_JSON_VALUE)
@ApiResponses(
        value = {@ApiResponse(code = HTTP_STATUS_OK, message = API_STATUS_DESCRIPTION)
        })
public Result<Track<Wig>> loadHistogram(@RequestBody final TrackQuery trackQuery)
        throws HistogramReadingException {
    final Track<Wig> histogramTrack = convertToTrack(trackQuery);
    return Result.success(bedManager.loadHistogram(histogramTrack));
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:25,代码来源:BedController.java

示例12: updateTask

import org.springframework.web.bind.annotation.RequestBody; //导入依赖的package包/类
@PostMapping
@ApiOperation(value = "新增任务")
@RequiresPermissions("sys.task.scheduled.update")
public Object updateTask(@RequestBody TaskScheduled scheduled, ModelMap modelMap) {
	Assert.notNull(scheduled.getTaskGroup(), "TASKGROUP");
	Assert.notNull(scheduled.getTaskName(), "TASKNAME");
	Assert.notNull(scheduled.getJobType(), "JOBTYPE");
	Assert.notNull(scheduled.getTaskType(), "TASKTYPE");
	Assert.notNull(scheduled.getTargetObject(), "TARGETOBJECT");
	Assert.notNull(scheduled.getTargetMethod(), "TARGETMETHOD");
	Assert.notNull(scheduled.getTaskCron(), "TASKCRON");
	Assert.notNull(scheduled.getTaskDesc(), "TASKDESC");
	if (TaskType.dubbo.equals(scheduled.getTaskType())) {
		Assert.notNull(scheduled.getTargetSystem(), "TARGETSYSTEM");
	}
	scheduledService.updateTask(scheduled);
	return setSuccessModelMap(modelMap);
}
 
开发者ID:tb544731152,项目名称:iBase4J,代码行数:19,代码来源:ScheduledController.java

示例13: executeAsyncScript

import org.springframework.web.bind.annotation.RequestBody; //导入依赖的package包/类
/**
 * Implements the "Execute Async Script" command See
 * https://www.w3.org/TR/webdriver/#dfn-execute-async-script
 */
@RequestMapping(value = "/session/{sessionId}/execute/async", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
public @ResponseBody ResponseEntity<Response> executeAsyncScript(@PathVariable String sessionId,
		@RequestBody(required = false) String body) throws Throwable {
	LOGGER.info("executeAsyncScript -->");
	LOGGER.info("  -> " + body);
	LOGGER.info("  <- ERROR: unknown command");
	LOGGER.info("executeAsyncScript <--");

	return responseFactory.error(sessionId, ProtocolError.UNKNOWN_COMMAND);
}
 
开发者ID:MicroFocus,项目名称:SilkAppDriver,代码行数:15,代码来源:W3CProtocolController.java

示例14: addWatcher

import org.springframework.web.bind.annotation.RequestBody; //导入依赖的package包/类
public void addWatcher(@RequestBody String provisionWatcher) {
  if (provisionWatcher != null) {
    if (update.addWatcher(provisionWatcher)) {
      logger.debug("New device watcher received to add devices with provision watcher id:"
          + provisionWatcher);
    } else {
      logger.error("Received add device provision watcher request without an id attached.");
      throw new NotFoundException("provisionWatcher", provisionWatcher);
    }
  }
}
 
开发者ID:edgexfoundry,项目名称:device-mqtt,代码行数:12,代码来源:UpdateController.java

示例15: getPathTest

import org.springframework.web.bind.annotation.RequestBody; //导入依赖的package包/类
@RequestMapping(produces = "application/json")
public ResponseEntity<HttpJson> getPathTest(@RequestBody String test) {
    HttpJson inObj = new HttpJson(test);
    HttpJson json = new HttpJson();
    UserExtend ue = new UserExtend();
    json.setClassObject(ue);
    json.setClassName(String.class.toString());

    return new ResponseEntity<HttpJson>(json, HttpStatus.ACCEPTED);
}
 
开发者ID:okingjerryo,项目名称:WeiMusicCommunity-server,代码行数:11,代码来源:PathController.java


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