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


Java MediaType.APPLICATION_JSON_UTF8_VALUE属性代码示例

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


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

示例1: indexFromAnnotated

@PostMapping(value = "/graphql", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseBody
public Object indexFromAnnotated(@RequestBody Map<String, Object> request) {

  ExecutionInput executionInput = ExecutionInput.newExecutionInput()
    .query((String) request.get("query"))
    .operationName((String) request.get("operationName"))
    .context(null)
    .root(null) // This we are doing do be backwards compatible
    .build();
  ExecutionResult executionResult = graphQlFromAnnotated.execute(executionInput);

  if (!executionResult.getErrors().isEmpty()) {
    return sanitize(executionResult);
  }

  return executionResult;
}
 
开发者ID:wlindner,项目名称:ReBoot,代码行数:18,代码来源:GraphQlController.java

示例2: visit

@RequestMapping(value = "/{" + GROUP + "}/{" + NAME + "}/{" + STABILITY + "}/{" + VERSION + ":.+}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<?> visit(
        @RequestHeader(value = ErestHeaders.REQUEST_ID, required = false) String requestId,
        @RequestHeader(ErestHeaders.VISITOR_ID) String visitorId,
        @PathVariable(PROVIDER_ID) String providerId,
        @PathVariable(GROUP) String group,
        @PathVariable(NAME) String name,
        @PathVariable(STABILITY) String stability,
        @PathVariable(VERSION) String version) {

    ReadContext context = buildContext(requestId, providerId, visitorId);

    ZoomOutByName form = new ZoomOutByName();
    form.setProviderId(providerId);
    form.setGroup(group);
    form.setName(name);
    form.setStability(stability);
    form.setVersion(version);
    return VisitApiCaller.sync(api, context, form);

}
 
开发者ID:SINeWang,项目名称:kiimate,代码行数:21,代码来源:VisitRawStatusCtl.java

示例3: getBriefMovieOnShowByDay

@RequestMapping(path = "/day/brief",
                method = RequestMethod.GET,
                produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public RestResponse getBriefMovieOnShowByDay(
    @RequestParam("movieId") Integer movieId,
    @RequestParam("cinemaId") Integer cinemaId,
    @RequestParam("showDate") Date showDate,
    HttpServletRequest request, HttpServletResponse response) {
    LogUtil.logReq(Log, request);
    RestResponse result = new RestResponse();
    Object[] objs = movieOnShowService.getBriefMovieOnShowByDate(movieId, showDate, cinemaId);
    List<String> timeList = (List<String>)objs[1];
    Float minPrice = (Float)objs[0];
    if (timeList.size() == 0) minPrice = 0.00F;
    result.put("minPrice", minPrice);
    result.put("showTime", timeList);
    return result;
}
 
开发者ID:AwesomeTickets,项目名称:ServiceServer,代码行数:18,代码来源:MovieOnShowController.java

示例4: update

/**
 * 根据配置数据生成新的nginx.conf,然后优雅重启NGINX
 */
@RequestMapping(value = "/update", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public Object update(@RequestBody List<NginxUpStream> data) {
    boolean success = NginxUtil.refineNginxConf(nginxConf, data);
    if (success) {
        try {
            String command = NginxUtil.nginx(nginxConf);
            Process exec = Runtime.getRuntime().exec(command);
            int exitValue = exec.waitFor();
            if(exitValue != 0){
                return Result.error("程序异常退出 exit:" + exitValue);
            }
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
        return Result.success();
    }
    return Result.error("处理失败");
}
 
开发者ID:dongqilin,项目名称:EDeploy,代码行数:21,代码来源:AppNode.java

示例5: getLanguages

@RequestMapping(value="/languages", produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<String> getLanguages(){
	logger.info( "getLanguages()..." );
	ResponseEntity<String> responseEntity = null;
	try {
		List<Language> languages = this.talkerService.findAllLanguages();			
		
		HttpHeaders responseHeaders = new HttpHeaders();
		String talkerJson = new ObjectMapper().writeValueAsString(languages);
		responseEntity = new ResponseEntity<String>(talkerJson, responseHeaders, HttpStatus.OK);
	} catch (Exception e) {
		logger.error(e.getMessage());
		return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(e.getMessage());
	}
	return responseEntity;
}
 
开发者ID:fabianogoes,项目名称:bruxelas,代码行数:16,代码来源:TalkerRestController.java

示例6: get

@RequestMapping(produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<String> get(){
	logger.info( "get()..." );
	ResponseEntity<String> responseEntity = null;
	try {
		List<ConnectionType> list = this.connectionTypeService.findAll();
		
		HttpHeaders responseHeaders = new HttpHeaders();
		String usuariosJson = new ObjectMapper().writeValueAsString(list);
		responseEntity = new ResponseEntity<String>(usuariosJson, responseHeaders, HttpStatus.OK);
	} catch (Exception e) {
		logger.error(e.getMessage());
		return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(e.getMessage());
	}
	return responseEntity;
}
 
开发者ID:fabianogoes,项目名称:bruxelas,代码行数:16,代码来源:ConnectionTypeRestController.java

示例7: getHealthCheck

/**
 * Gets the health-check status.
 *
 * @param correlationId request correlation id
 * @return health-check model entity
 */
@ApiOperation(value = "Gets health-check status", response = HealthCheck.class)
@ApiResponses(value = {
        @ApiResponse(code = 200, response = HealthCheck.class, message = "Operation is successful"),
        @ApiResponse(code = 401, response = MessageError.class, message = "Unauthorized"),
        @ApiResponse(code = 403, response = MessageError.class, message = "Forbidden"),
        @ApiResponse(code = 404, response = MessageError.class, message = "Not found"),
        @ApiResponse(code = 503, response = MessageError.class, message = "Service unavailable")})
@RequestMapping(value = "/health-check",
        method = RequestMethod.GET,
        produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<HealthCheck> getHealthCheck(
        @RequestHeader(value = CORRELATION_ID, defaultValue = DEFAULT_CORRELATION_ID) String correlationId) {
    logger.debug("getHealthCheck");

    HealthCheck healthCheck = healthCheckService.getHealthCheck(correlationId);
    HttpStatus status = healthCheck.hasNonOperational() ? HttpStatus.GATEWAY_TIMEOUT : HttpStatus.OK;

    return new ResponseEntity<>(healthCheck, new HttpHeaders(), status);
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:25,代码来源:HealthCheckController.java

示例8: delete

@RequestMapping(value="/delete/{id}", produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<String> delete(@PathVariable("id") Long id){
	logger.info( "get()..." );
	ResponseEntity<String> responseEntity = null;
	try {
		this.countryService.delete(id);
		
		HttpHeaders responseHeaders = new HttpHeaders();
		String usuariosJson = new ObjectMapper().writeValueAsString("Delete["+id+"] OK");
		responseEntity = new ResponseEntity<String>(usuariosJson, responseHeaders, HttpStatus.OK);
	} catch (Exception e) {
		logger.error(e.getMessage());
		return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(e.getMessage());
	}
	return responseEntity;
}
 
开发者ID:fabianogoes,项目名称:bruxelas,代码行数:16,代码来源:CountryRestController.java

示例9: getDetails

@ApiOperation(value = "VisitCircle Statistic Detail", notes = "Query detail visitCircle statistic data",
        response = Tuple.class, responseContainer = "list",produces = "application/json;charset=UTF-8")
@PostMapping(value = "/detail",produces= MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResultVo<List<Tuple<String, Number>>> getDetails(@Valid @RequestBody QueryJson queryJson) {
    return new ResultVo<>(ServerCode.SUCCESS,
            service.findByHourAndProbe(queryJson.getHour(),queryJson.getProbeId()));
}
 
开发者ID:cuiods,项目名称:WIFIProbe,代码行数:7,代码来源:VisitCircleController.java

示例10: join

@PutMapping(value = "/conversations/{id}/join", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseBody
public Participant join(
        @RequestBody Participant user, 
        @PathVariable String id){

    Participant participant = conversationService.joinConversation(user, id);
    
    log.info("User {} joined conversation {}", participant, id);
    
    return participant;
}
 
开发者ID:peterjurkovic,项目名称:travel-agency,代码行数:12,代码来源:ConversationController.java

示例11: getFriendsForCurrentUser

@RequestMapping(path = "/myFriends", method = RequestMethod.GET, produces = {MediaType.APPLICATION_JSON_UTF8_VALUE})
public CommonResponse getFriendsForCurrentUser(){
    try{
        return CommonResponse.getSuccessCommonResponse(userService.getFriendsForCurrentUser());
    } catch (Exception ex){
        logger.error("异常信息 : {} - 异常原因 : {} ", ex.getMessage(), ex.getCause());
        throw CommonResponse.getErrorCommonResponse(ex);
    }
}
 
开发者ID:damingerdai,项目名称:web-qq,代码行数:9,代码来源:UserController.java

示例12: save

@PostMapping(value = "/{submitterId}", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation("Creates a new claim")
public Claim save(@Valid @NotNull @RequestBody ClaimData claimData,
                  @PathVariable("submitterId") String submitterId,
                  @RequestHeader(HttpHeaders.AUTHORIZATION) String authorisation) {
    return claimService.saveClaim(submitterId, claimData, authorisation);
}
 
开发者ID:hmcts,项目名称:cmc-claim-store,代码行数:7,代码来源:ClaimController.java

示例13: comparison

@ResponseBody
@RequestMapping(path = "comparisons", method = RequestMethod.GET, produces = {MediaType.APPLICATION_JSON_UTF8_VALUE})
public ComparisonResponse comparison(@Valid @ModelAttribute @ApiParam ComparisonCommand comparisonCommand,
                        @ApiIgnore @AuthenticationPrincipal AuthenticatedPerson authenticatedPerson,
                        @ApiIgnore Errors errors) throws Exception {
    if (errors != null && errors.hasErrors()) {
        throw new ValidationErrorsException(errors);
    }

    return comparisonService.compare(comparisonCommand, authenticatedPerson.getUserId());
}
 
开发者ID:TulevaEE,项目名称:onboarding-service,代码行数:11,代码来源:ComparisonController.java

示例14: getOnShowMovieIDs

@RequestMapping(path = "/on",
                method = RequestMethod.GET,
                produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public RestResponse getOnShowMovieIDs(HttpServletRequest request, HttpServletResponse response) {
    LogUtil.logReq(Log, request);
    List<Integer> movieIDs = movieService.getMovieByStatus("on");
    return new CollectionResponse(movieIDs);
}
 
开发者ID:AwesomeTickets,项目名称:ServiceServer,代码行数:8,代码来源:MovieController.java

示例15: getMovieDetailsByID

@RequestMapping(path = "/{movieId}",
                method = RequestMethod.GET,
                produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public RestResponse getMovieDetailsByID(@PathVariable Integer movieId,
                                        HttpServletRequest request, HttpServletResponse response) {
    LogUtil.logReq(Log, request);
    Movie movie = movieService.getMovieWithAllDetails(movieId);
    if (movie == null) {
        return new ErrorResponse(response, ErrorStatus.RESOURCE_NOT_FOUND);
    }
    List<String> movieStyles = new ArrayList<String>();
    for (MovieStyle ms : movie.getMovieStyleSet()) {
        movieStyles.add(ms.getStyleName());
    }
    RestResponse res = new RestResponse();
    res.put("movieId", movie.getMovieId());
    res.put("title", movie.getTitle());
    res.put("pubDate", movie.getPubDate());
    res.put("length", movie.getLength());
    res.put("rating", movie.getRating());
    res.put("country", movie.getCountry().getCountryName());
    res.put("movieStatus", movie.getMovieStatus().getStatusName());
    res.put("movieType", movie.getMovieType().getTypeName());
    res.put("movieStyle", movieStyles);
    res.put("posterSmall", movie.getPosterSmall());
    res.put("posterLarge", movie.getPosterLarge());
    return res;
}
 
开发者ID:AwesomeTickets,项目名称:ServiceServer,代码行数:28,代码来源:MovieController.java


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