List of usage examples for org.springframework.http MediaType APPLICATION_JSON_VALUE
String APPLICATION_JSON_VALUE
To view the source code for org.springframework.http MediaType APPLICATION_JSON_VALUE.
Click Source Link
From source file:com.boxedfolder.carrot.web.client.AnalyticsResource.java
@JsonView(View.Meta.class) @ResponseStatus(HttpStatus.OK)//from w w w. j a va2s .c o m @RequestMapping(value = "/logs", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public List<AnalyticsLog> getAnalyticsLogs( @RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) DateTime from, @RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) DateTime to) { return service.findAll(from, to); }
From source file:com.blstream.patronage.ctf.web.controller.trusted.AddPlayerController.java
/** * This method create new player in data base. * * Request context: /api/players/add/*w ww .java 2 s . c o m*/ * Request method: POST * Request consumes: JSON * Response produces: JSON * * @param playerUI * @return MessageUI */ @RequestMapping(value = "/add", method = RequestMethod.POST, consumes = { MediaType.APPLICATION_JSON_VALUE }, produces = { MediaType.APPLICATION_JSON_VALUE }) @ResponseStatus(HttpStatus.CREATED) public @ResponseBody MessageUI addNewPlayer(@RequestBody PlayerUI playerUI) { if (logger.isDebugEnabled()) { logger.debug("---- addNewPlayer method invoked ----"); } Assert.notNull(playerUI, "PlayerUI cannot be null"); MessageUI message = new MessageUI(); try { Player player = playerService.createNewPlayer(playerUI); if (logger.isDebugEnabled()) { logger.debug( String.format("Player %s was created successfully", player.getPortalUser().getUsername())); } // TODO: get message from properties file: error-codes.properties // message.setMessage(SUCCESS); message.setErrorCode(ErrorCodeType.SUCCESS); } catch (AlreadyExistsException e) { if (logger.isWarnEnabled()) { logger.warn("New player was not created."); } // TODO: get message from properties file: error-codes.properties message.setError(ErrorCodeType.PLAYER_ALREADY_EXISTS.toString()); message.setErrorDescription(e.getMessage()); message.setErrorCode(ErrorCodeType.PLAYER_ALREADY_EXISTS); } catch (Exception e) { if (logger.isErrorEnabled()) { logger.error("New player was not created.", e); } // TODO: get message from properties file: error-codes.properties message.setError(ErrorCodeType.CANNOT_CREATE_NEW_PLAYER.toString()); message.setErrorDescription(e.getMessage()); message.setErrorCode(ErrorCodeType.CANNOT_CREATE_NEW_PLAYER); } return message; }
From source file:com.github.lynxdb.server.api.http.handlers.EpTree.java
@RequestMapping(path = "/collisions", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity collisions() { return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build(); }
From source file:com.boxedfolder.carrot.web.client.CrudResource.java
@JsonView(View.Client.class) @ResponseStatus(HttpStatus.OK)// w w w . j a v a 2 s .c om @RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public S get(@PathVariable("id") Long id) { return service.find(id); }
From source file:it.reply.orchestrator.controller.ResourceController.java
/** * Get all resources associated to a deployment. *//*from w ww . j a va2s . c o m*/ @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/resources", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public PagedResources<BaseResource> getResources(@PathVariable("deploymentId") String deploymentId, @PageableDefault(sort = AbstractResourceEntity.CREATED_COLUMN_NAME, direction = Direction.DESC) Pageable pageable, PagedResourcesAssembler<Resource> pagedAssembler) { Page<Resource> resources = resourceService.getResources(deploymentId, pageable); PagedResources<BaseResource> pagedResources = pagedAssembler.toResource(resources, baseResourceAssembler); return pagedResources; }
From source file:com.jci.item.apis.ItemController.java
/** * Gets the segmented item details./* w w w. j ava2 s.co m*/ * * @param request * the request * @return the segmented item details */ @HystrixCommand(commandProperties = { @HystrixProperty(name = "execution.isolation.strategy", value = "THREAD"), @HystrixProperty(name = "execution.timeout.enabled", value = "false"), @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "60000"), @HystrixProperty(name = "fallback.enabled", value = "false") }) @RequestMapping(value = "/getSegmentedMapicsItemDetails", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public SegmentedDetailRes getSegmentedMapicsItemDetails(@RequestBody SegmentedDetailReq request) { request.setTableName(itemTableName); request.setPartition(AzureUtils.getPartitionKey(request.getErpName().toUpperCase())); request.setFirstRequest(false); SegmentedDetailRes response = new SegmentedDetailRes(); try { response = poService.getItemResultSet(request); } catch (InvalidKeyException | URISyntaxException | StorageException e) { response.setError(true); response.setMessage(e.getMessage()); LOG.error("### Exception in PoController.getSegmentedItemDetails ###", e); } return response; }
From source file:curly.artifact.ArtifactResourceController.java
@RequestMapping(method = GET, produces = MediaType.APPLICATION_JSON_VALUE) public DeferredResult<HttpEntity<PagedArtifact>> artifactResources(@PageableDefault(20) Pageable pageable) { log.trace("Querying resources with page {}, size {}", pageable.getPageNumber(), pageable.getPageSize()); artifactService.findAll(pageable).forEach(System.out::println); return defer(artifactService.findAll(pageable) .map(o -> o.<ResourceNotFoundException>orElseThrow(ResourceNotFoundException::new)) .map(PagedArtifact::new).map(ResponseEntity::ok)); }
From source file:com.nebhale.devoxx2013.web.DoorController.java
@RequestMapping(method = RequestMethod.PUT, value = "/{door}", consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.OK)//from w w w . j a va 2 s . c o m @Transactional void update(@PathVariable Door door, @RequestBody Door transition) throws IllegalTransitionException { Assert.notNull(door); Assert.notNull(transition); Door.DoorStatus targetStatus = transition.getStatus(); if (Door.DoorStatus.CLOSED == targetStatus) { throw new IllegalTransitionException(door.getGame().getId(), door.getId(), targetStatus); } else if (Door.DoorStatus.OPENED == targetStatus) { this.gameService.open(door); } else if (Door.DoorStatus.SELECTED == targetStatus) { this.gameService.select(door); } else { throw new IllegalStateException(); } }
From source file:com.jci.job.apis.ApiClientController.java
/** * Gets the gr details.// w w w .j a v a 2 s. c om * * @param plant the plant * @param erp the erp * @param region the region * @return the gr details */ @RequestMapping(value = "/getGrDetails", method = RequestMethod.GET, consumes = MediaType.APPLICATION_JSON_VALUE, produces = { MediaType.APPLICATION_JSON_VALUE }) public String getGrDetails(@RequestParam("plant") String plant, @RequestParam("erp") String erp, @RequestParam("region") String region) { String response = service.getGrDetails(plant, erp, region); return response; }