本文整理汇总了Java中org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE属性的典型用法代码示例。如果您正苦于以下问题:Java MediaTypes.HAL_JSON_VALUE属性的具体用法?Java MediaTypes.HAL_JSON_VALUE怎么用?Java MediaTypes.HAL_JSON_VALUE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.springframework.hateoas.MediaTypes
的用法示例。
在下文中一共展示了MediaTypes.HAL_JSON_VALUE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInvitations
@ApiOperation(value = "Get user friends")
@ApiResponses(value = { @ApiResponse(code = 404, message = "No user found") })
@GetMapping(value = "/{username}/invitations", produces = MediaTypes.HAL_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
public
List<UserResource> getInvitations(
@ApiParam(value = "The user's name", required = true)
@PathVariable("username") final String username,
@ApiParam(value = "True, if invitations sent")
@RequestParam(value = "outgoing", defaultValue = "0", required = false) final Boolean outgoing
) {
log.info("Called with username {}, outgoing {}", username, outgoing);
if(!username.equalsIgnoreCase(this.authorizationService.getUsername())) {
throw new ResourceForbiddenException("Forbidden command!");
}
final String id = this.authorizationService.getUserId();
return this.userSearchService.getInvitations(id, outgoing)
.stream()
.map(this.userResourceAssembler::toResource)
.collect(Collectors.toList());
}
示例2: getOtherTitleContribution
@ApiOperation(value = "Get the contribution of titles")
@ApiResponses(value = { @ApiResponse(code = 404, message = "No contribution found") })
@GetMapping(value = "/contributions/{id}/othertitles", produces = MediaTypes.HAL_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
public
ContributionResource<OtherTitle> getOtherTitleContribution(
@ApiParam(value = "The contribution ID", required = true)
@PathVariable("id") final Long id
) {
log.info("Called with id {}", id);
final Contribution<OtherTitle> otherTitleContribution = this.movieContributionSearchService.getOtherTitleContribution(id);
final Link self = linkTo(
methodOn(MovieContributionRestController.class).getOtherTitleContribution(id)
).withSelfRel();
return new ContributionResource<>(otherTitleContribution, self);
}
示例3: getBoxOfficeContribution
@ApiOperation(value = "Get the contribution of box offices")
@ApiResponses(value = { @ApiResponse(code = 404, message = "No contribution found") })
@GetMapping(value = "/contributions/{id}/boxoffices", produces = MediaTypes.HAL_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
public
ContributionResource<BoxOffice> getBoxOfficeContribution(
@ApiParam(value = "The contribution ID", required = true)
@PathVariable("id") final Long id
) {
log.info("Called with id {}", id);
final Contribution<BoxOffice> boxOfficeContribution = this.movieContributionSearchService.getBoxOfficeContribution(id);
final Link self = linkTo(
methodOn(MovieContributionRestController.class).getBoxOfficeContribution(id)
).withSelfRel();
return new ContributionResource<>(boxOfficeContribution, self);
}
示例4: getPosterContribution
@ApiOperation(value = "Get the contribution of posters")
@ApiResponses(value = { @ApiResponse(code = 404, message = "No contribution found") })
@GetMapping(value = "/contributions/{id}/posters", produces = MediaTypes.HAL_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
public
ContributionResource<ImageResponse> getPosterContribution(
@ApiParam(value = "The contribution ID", required = true)
@PathVariable("id") final Long id
) {
log.info("Called with id {}", id);
final Contribution<ImageResponse> posterContribution = this.movieContributionSearchService.getPosterContribution(id);
final Link self = linkTo(
methodOn(MovieContributionRestController.class).getPosterContribution(id)
).withSelfRel();
return new ContributionResource<>(posterContribution, self);
}
示例5: statuses
@RequestMapping(method = RequestMethod.GET, value = ApiController.BASE_PATH + "/modules", produces = MediaTypes.HAL_JSON_VALUE)
public ResponseEntity<?> statuses(@RequestHeader("api") URL api,
@RequestHeader("org") String org,
@RequestHeader("space") String space,
@RequestHeader("email") String email,
@RequestHeader("password") String password,
@RequestHeader(value = "namespace", defaultValue = "") String namespace) {
return ResponseEntity.ok(new Resources<>(
moduleService.getStatuses(api, org, space, email, password, namespace)
.map(appStatus -> new Resource<>(
appStatus,
linkTo(methodOn(ModuleController.class).status(appStatus.getDeploymentId(), api, org, space, email, password, namespace)).withSelfRel(),
linkTo(methodOn(ModuleController.class).start(appStatus.getDeploymentId(), api, org, space, email, password, namespace)).withRel("start"),
linkTo(methodOn(ModuleController.class).stop(appStatus.getDeploymentId(), api, org, space, email, password, namespace)).withRel("stop"),
linkTo(methodOn(ModuleController.class).link(appStatus.getDeploymentId(), api, org, space, email, password, namespace)).withRel("link")))
.collect(Collectors.toList()),
linkTo(methodOn(ModuleController.class).statuses(api, org, space, email, password, namespace)).withSelfRel()
));
}
示例6: status
@RequestMapping(method = RequestMethod.GET, value = ApiController.BASE_PATH + "/modules/{module}", produces = MediaTypes.HAL_JSON_VALUE)
public ResponseEntity<?> status(@PathVariable String module,
@RequestHeader("api") URL api,
@RequestHeader("org") String org,
@RequestHeader("space") String space,
@RequestHeader("email") String email,
@RequestHeader("password") String password,
@RequestHeader(value = "namespace", defaultValue = "") String namespace) {
return ResponseEntity.ok(new Resource<>(
moduleService.getStatus(module, api, org, space, email, password, namespace),
linkTo(methodOn(ModuleController.class).status(module, api, org, space, email, password, namespace)).withSelfRel(),
linkTo(methodOn(ModuleController.class).statuses(api, org, space, email, password, namespace)).withRel("all"),
linkTo(methodOn(ApiController.class).root(api, org, space, email, password, namespace)).withRel("root"),
linkTo(methodOn(ModuleController.class).start(module, api, org, space, email, password, namespace)).withRel("start"),
linkTo(methodOn(ModuleController.class).stop(module, api, org, space, email, password, namespace)).withRel("stop"),
linkTo(methodOn(ModuleController.class).link(module, api, org, space, email, password, namespace)).withRel("link")
));
}
示例7: getMessageSent
@ApiOperation(value = "Get sent message by ID")
@ApiResponses(value = { @ApiResponse(code = 404, message = "No message found or no user found") })
@GetMapping(value = "/sent/{id}", produces = MediaTypes.HAL_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
public
MessageSentResource getMessageSent(
@ApiParam(value = "The message ID", required = true)
@PathVariable("id") final String id
) {
log.info("Called with id {}", id);
return this.messageSentResourceAssembler.toResource(this.messageSearchService.getMessageSent(id, this.authorizationService.getUserId()));
}
示例8: getMessageReceived
@ApiOperation(value = "Get received message by ID")
@ApiResponses(value = { @ApiResponse(code = 404, message = "No message found or no user found") })
@GetMapping(value = "/received/{id}", produces = MediaTypes.HAL_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
public
MessageReceivedResource getMessageReceived(
@ApiParam(value = "The message ID", required = true)
@PathVariable("id") final String id
) {
log.info("Called with id {}", id);
return this.messageReceivedResourceAssembler.toResource(this.messageSearchService.getMessageReceived(id, this.authorizationService.getUserId()));
}
示例9: findDetailedEmployee
@GetMapping(value = "/employees/{id}/detailed", produces = MediaTypes.HAL_JSON_VALUE)
public ResponseEntity<Resource<EmployeeWithManager>> findDetailedEmployee(@PathVariable Long id) {
return repository.findById(id)
.map(EmployeeWithManager::new)
.map(employeeWithManagerResourceAssembler::toResource)
.map(ResponseEntity::ok)
.orElse(ResponseEntity.notFound().build());
}
示例10: findOne
@GetMapping(value = "/supervisors/{id}", produces = MediaTypes.HAL_JSON_VALUE)
public ResponseEntity<Resource<Supervisor>> findOne(@PathVariable Long id) {
Resource<Manager> managerResource = controller.findOne(id).getBody();
Resource<Supervisor> supervisorResource = new Resource<>(
new Supervisor(managerResource.getContent()),
managerResource.getLinks());
return ResponseEntity.ok(supervisorResource);
}
示例11: findAllDetailedEmployees
@GetMapping(value = "/employees/detailed", produces = MediaTypes.HAL_JSON_VALUE)
public ResponseEntity<Resources<Resource<EmployeeWithManager>>> findAllDetailedEmployees() {
return ResponseEntity.ok(
employeeWithManagerResourceAssembler.toResources(
StreamSupport.stream(repository.findAll().spliterator(), false)
.map(EmployeeWithManager::new)
.collect(Collectors.toList())));
}
示例12: linkFileToEnvelope
@RequestMapping(path = "/submissionEnvelopes/{sub_id}/files/{id}",
method = RequestMethod.PUT,
produces = MediaTypes.HAL_JSON_VALUE)
ResponseEntity<Resource<?>> linkFileToEnvelope(@PathVariable("sub_id") SubmissionEnvelope submissionEnvelope,
@PathVariable("id") File file,
final PersistentEntityResourceAssembler assembler) {
File entity = getFileService().addFileToSubmissionEnvelope(submissionEnvelope, file);
PersistentEntityResource resource = assembler.toFullResource(entity);
return ResponseEntity.accepted().body(resource);
}
示例13: info
@RequestMapping(method = RequestMethod.GET, produces = MediaTypes.HAL_JSON_VALUE)
public RootResource info() {
String streamTemplated = entityLinks.linkToCollectionResource(StreamMetrics.class).getHref() + "?{name}";
RootResource rootResource = new RootResource();
rootResource.add(new Link(streamTemplated).withRel("/collector/metrics/streams"));
return rootResource;
}
示例14: addFileToEnvelope
@RequestMapping(path = "/submissionEnvelopes/{sub_id}/files",
method = RequestMethod.POST,
produces = MediaTypes.HAL_JSON_VALUE)
ResponseEntity<Resource<?>> addFileToEnvelope(@PathVariable("sub_id") SubmissionEnvelope submissionEnvelope,
@RequestBody File file,
final PersistentEntityResourceAssembler assembler) {
File entity = getFileService().addFileToSubmissionEnvelope(submissionEnvelope, file);
PersistentEntityResource resource = assembler.toFullResource(entity);
return ResponseEntity.accepted().body(resource);
}
示例15: getMovie
@ApiOperation(value = "Get movie")
@ApiResponses(value = { @ApiResponse(code = 404, message = "No movie found") })
@GetMapping(value = "/{id}", produces = MediaTypes.HAL_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
public
MovieResource getMovie(
@ApiParam(value = "The movie ID", required = true)
@PathVariable("id") final Long id
) {
log.info("Called with id {}", id);
return this.movieResourceAssembler.toResource(this.movieSearchService.getMovie(id));
}