本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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("处理失败");
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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()));
}
示例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;
}
示例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);
}
}
示例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);
}
示例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());
}
示例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);
}
示例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;
}