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


Java MediaTypes.HAL_JSON_VALUE属性代码示例

本文整理汇总了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());
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:24,代码来源:UserRestController.java

示例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);
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:19,代码来源:MovieContributionRestController.java

示例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);
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:19,代码来源:MovieContributionRestController.java

示例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);
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:19,代码来源:MovieContributionRestController.java

示例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()
	));
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-spinnaker,代码行数:20,代码来源:ModuleController.java

示例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")
		));
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-spinnaker,代码行数:19,代码来源:ModuleController.java

示例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()));
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:13,代码来源:MessageRestController.java

示例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()));
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:13,代码来源:MessageRestController.java

示例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());
}
 
开发者ID:spring-projects,项目名称:spring-hateoas-examples,代码行数:9,代码来源:EmployeeController.java

示例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);
}
 
开发者ID:spring-projects,项目名称:spring-hateoas-examples,代码行数:10,代码来源:SupervisorController.java

示例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())));
}
 
开发者ID:spring-projects,项目名称:spring-hateoas-examples,代码行数:9,代码来源:EmployeeController.java

示例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);
}
 
开发者ID:HumanCellAtlas,项目名称:ingest-core,代码行数:10,代码来源:FileController.java

示例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;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dataflow-metrics-collector,代码行数:7,代码来源:RootEndpoint.java

示例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);
}
 
开发者ID:HumanCellAtlas,项目名称:ingest-core,代码行数:10,代码来源:FileController.java

示例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));
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:13,代码来源:MovieRestController.java


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