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:io.pivotal.strepsirrhini.chaoslemur.task.TaskManager.java
@RequestMapping(method = RequestMethod.GET, value = "", produces = MediaType.APPLICATION_JSON_VALUE) Set<Resource<Task>> readAll() { return this.tasks.values().stream().map(this.resourceAssembler::toResource).collect(Collectors.toSet()); }
From source file:org.ado.biblio.BarCodeController.java
@RequestMapping(method = RequestMethod.GET, value = "/books/{id}", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<BookMessage[]> getBooks(@NotNull @PathVariable(value = "id") String id) { LOGGER.info("GET /books/{}", id); boolean pullingActive = true; long timeout = System.currentTimeMillis() + (60 * 1000); while (pullingActive && timeout > System.currentTimeMillis()) { if (!barCodeCache.isEmpty(id)) { pullingActive = false;/*from w ww . j a v a2s .c o m*/ } pause(200); } final BookMessage[] bookMessages = barCodeCache.getBookMessages(id); if (bookMessages.length > 0) { StringBuilder messages = new StringBuilder(); for (BookMessage bookMessage : bookMessages) { messages.append(bookMessage).append(" "); } LOGGER.info("sending to [{}] message [{}]", id, messages); return new ResponseEntity<BookMessage[]>(bookMessages, HttpStatus.OK); } else { return new ResponseEntity<BookMessage[]>(HttpStatus.OK); } }
From source file:org.mitre.oauth2.web.ScopeAPI.java
@RequestMapping(value = "", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public String getAll(ModelMap m) { Set<SystemScope> allScopes = scopeService.getAll(); m.put(JsonEntityView.ENTITY, allScopes); return JsonEntityView.VIEWNAME; }
From source file:br.edu.unidavi.restapp.FileUploadController.java
@RequestMapping(value = "/cadastro", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) public HttpEntity<FileUpload> setFileUpload(@RequestBody FileUpload fileUpload) { fileUploadRepository.save(fileUpload); return new ResponseEntity<FileUpload>(fileUpload, HttpStatus.OK); }
From source file:org.mitre.openid.connect.web.StatsAPI.java
@PreAuthorize("hasRole('ROLE_USER')") @RequestMapping(value = "byclientid/{id}", produces = MediaType.APPLICATION_JSON_VALUE) public String statsByClientId(@PathVariable("id") Long id, ModelMap m) { Integer e = statsService.getCountForClientId(id); m.put(JsonEntityView.ENTITY, e);/*from www. j ava 2 s . c om*/ return JsonEntityView.VIEWNAME; }
From source file:com.todo.backend.web.rest.UserApi.java
@RequestMapping(value = "/user", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @Timed/*from w w w. j a va 2s.c om*/ @Transactional @PreAuthorize("hasAuthority('ADMIN')") public ResponseEntity<CreateUserResponse> createUser(@Valid @RequestBody CreateUserRequest request) throws URISyntaxException { log.debug("POST /user {}", request); final User user = convertToUser(request); final User result = userRepository.save(user); return ResponseEntity.created(new URI("/user/" + result.getId())).body(convertToCreateUserResponse(result)); }
From source file:cz.muni.fi.pa165.rest.controllers.RoomController.java
/** * Delete one product by id curl -i -X DELETE * http://localhost:8080/pa165/rest/room/{id} * * @param id identifier for product/*from w w w .j a v a 2s .com*/ * @throws ResourceNotFoundException */ @RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE) public final void deleteRoom(@PathVariable("id") long id) throws Exception { try { roomFacade.deleteRoom(id); } catch (Exception ex) { throw new ResourceNotFoundException(); } }
From source file:com.nebhale.devoxx2013.web.GameController.java
@RequestMapping(method = RequestMethod.GET, value = "/{game}", produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.OK)//w ww . j a v a 2 s .com @Transactional(readOnly = true) Resource<Game> read(@PathVariable Game game) { Assert.notNull(game); return this.resourceAssembler.toResource(game); }
From source file:software.uncharted.rest.ImageSearchResource.java
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public ImageSearchResult searchByUrl(@RequestBody final JsonNode body) throws IOException { long start = System.nanoTime(); String url = JSONUtil.getString(body, "url"); Set<Image> images = service.search(url); long duration = (System.nanoTime() - start) / 1000000L; return new ImageSearchResult().setImages(images).setDuration(duration); }