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


Java ControllerLinkBuilder类代码示例

本文整理汇总了Java中org.springframework.hateoas.mvc.ControllerLinkBuilder的典型用法代码示例。如果您正苦于以下问题:Java ControllerLinkBuilder类的具体用法?Java ControllerLinkBuilder怎么用?Java ControllerLinkBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ControllerLinkBuilder类属于org.springframework.hateoas.mvc包,在下文中一共展示了ControllerLinkBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resourceLinks

import org.springframework.hateoas.mvc.ControllerLinkBuilder; //导入依赖的package包/类
@RequestMapping(method = RequestMethod.GET)
public ReleaseControllerLinksResource resourceLinks() {
	ReleaseControllerLinksResource resource = new ReleaseControllerLinksResource();
	resource.add(ControllerLinkBuilder.linkTo(methodOn(ReleaseController.class).status(null))
			.withRel("status/name"));
	resource.add(ControllerLinkBuilder.linkTo(methodOn(ReleaseController.class).status(null, null))
			.withRel("status/name/version"));
	resource.add(
			ControllerLinkBuilder.linkTo(methodOn(ReleaseController.class).manifest(null))
					.withRel("manifest"));
	resource.add(ControllerLinkBuilder.linkTo(methodOn(ReleaseController.class).manifest(null, null))
			.withRel("manifest/name/version"));
	resource.add(ControllerLinkBuilder.linkTo(methodOn(ReleaseController.class).upgrade(null))
			.withRel("upgrade"));
	resource.add(
			ControllerLinkBuilder.linkTo(methodOn(ReleaseController.class).rollback(null, 123))
					.withRel("rollback"));
	resource.add(ControllerLinkBuilder.linkTo(methodOn(ReleaseController.class).delete(null, true))
						.withRel("delete"));
	resource.add(ControllerLinkBuilder.linkTo(methodOn(ReleaseController.class).list())
			.withRel("list"));
	resource.add(ControllerLinkBuilder.linkTo(methodOn(ReleaseController.class).list(null))
			.withRel("list/name"));
	return resource;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-skipper,代码行数:26,代码来源:ReleaseController.java

示例2: toResource

import org.springframework.hateoas.mvc.ControllerLinkBuilder; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public UserResource toResource(final User user) {
    final UserResource userResource = new UserResource(user);

    userResource.add(
            ControllerLinkBuilder.linkTo(
                    ControllerLinkBuilder
                            .methodOn(UserRestController.class)
                            .getProfile(user.getUsername())
            ).withSelfRel()
    );

    userResource.add(
            ControllerLinkBuilder.linkTo(
                    ControllerLinkBuilder
                            .methodOn(UserRestController.class)
                            .getFriends(user.getUsername())
            ).withRel("friends")
    );

    return userResource;
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:26,代码来源:UserResourceAssembler.java

示例3: LogResponse

import org.springframework.hateoas.mvc.ControllerLinkBuilder; //导入依赖的package包/类
public LogResponse(
    @JsonProperty("start") long start,
    @JsonProperty("end") long end,
    @JsonProperty("logs") List<LogEntry> logEntries,
    String platform,
    String csarName
) {
    this.start = start;
    this.end = end;
    this.logEntries = logEntries;
    //Add Self Link
    this.add(ControllerLinkBuilder.linkTo(methodOn(TransformationController.class)
        .getTransformationLogs(csarName, platform, start))
        .withSelfRel().expand(csarName));
    //Add link to retrieve only new log messages (next link)
    this.add(linkTo(methodOn(TransformationController.class)
        .getTransformationLogs(csarName, platform, end))
        .withRel("next").expand(csarName));
}
 
开发者ID:StuPro-TOSCAna,项目名称:TOSCAna,代码行数:20,代码来源:LogResponse.java

示例4: getSecurityInfo

import org.springframework.hateoas.mvc.ControllerLinkBuilder; //导入依赖的package包/类
/**
 * Return security information. E.g. is security enabled? Which user do you represent?
 */
@ResponseBody
@RequestMapping(method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
public SecurityInfoResource getSecurityInfo() {

	final boolean authenticationEnabled = securityProperties.getBasic().isEnabled();

	final SecurityInfoResource securityInfo = new SecurityInfoResource();
	securityInfo.setAuthenticationEnabled(authenticationEnabled);
	securityInfo.add(ControllerLinkBuilder.linkTo(SecurityController.class).withSelfRel());

	if (authenticationEnabled && SecurityContextHolder.getContext() != null) {
		final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
		if (!(authentication instanceof AnonymousAuthenticationToken)) {
			securityInfo.setAuthenticated(authentication.isAuthenticated());
			securityInfo.setUsername(authentication.getName());
		}
	}

	return securityInfo;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dashboard,代码行数:25,代码来源:SecurityController.java

示例5: getDeployments

import org.springframework.hateoas.mvc.ControllerLinkBuilder; //导入依赖的package包/类
/**
 * Get all deployments.
 * 
 * @param pageable
 *          {@Link Pageable}
 * @param pagedAssembler
 *          {@link PagedResourcesAssembler}
 * @return {@link DeploymentResource}
 */
@ResponseStatus(HttpStatus.OK)
@RequestMapping(value = "/deployments", method = RequestMethod.GET,
    produces = MediaType.APPLICATION_JSON_VALUE)
public PagedResources<DeploymentResource> getDeployments(
    @RequestParam(name = "createdBy", required = false) @Nullable String createdBy,
    @PageableDefault(sort = AbstractResourceEntity.CREATED_COLUMN_NAME,
        direction = Direction.DESC) Pageable pageable,
    PagedResourcesAssembler<Deployment> pagedAssembler) {

  Page<Deployment> deployments = deploymentService.getDeployments(pageable, createdBy);

  return pagedAssembler.toResource(deployments, deploymentResourceAssembler,
      ControllerLinkBuilder
          .linkTo(
              DummyInvocationUtils
                  .methodOn(DeploymentController.class)
                  .getDeployments(createdBy, pageable, pagedAssembler))
          .withSelfRel());

}
 
开发者ID:indigo-dc,项目名称:orchestrator,代码行数:30,代码来源:DeploymentController.java

示例6: getBaseResource

import org.springframework.hateoas.mvc.ControllerLinkBuilder; //导入依赖的package包/类
private BaseResource getBaseResource(Resource entity) {
  BaseResource resource = BaseResource.builder()
      .uuid(entity.getId())
      .creationTime(entity.getCreated())
      .updateTime(entity.getUpdated())
      .physicalId(entity.getIaasId())
      .state(entity.getState())
      .toscaNodeType(entity.getToscaNodeType())
      .toscaNodeName(entity.getToscaNodeName())
      .build();
  resource
      .add(ControllerLinkBuilder.linkTo(DummyInvocationUtils.methodOn(DeploymentController.class)
          .getDeployment(entity.getDeployment().getId())).withRel("deployment"));
  resource
      .add(
          ControllerLinkBuilder
              .linkTo(DummyInvocationUtils
                  .methodOn(ResourceController.class, entity.getDeployment().getId())
                  .getResource(entity.getDeployment().getId(), entity.getId()))
              .withSelfRel());
  return resource;
}
 
开发者ID:indigo-dc,项目名称:orchestrator,代码行数:23,代码来源:BaseResourceAssembler.java

示例7: toResource

import org.springframework.hateoas.mvc.ControllerLinkBuilder; //导入依赖的package包/类
@Override
public MessageDto toResource(MessageDto message)
{
	message.removeLinks(); // So we are sure the below links are the only ones
	ControllerLinkBuilder selfLinkBuilder = getAnonymousMessageLinkBuilder(goalIdMapping.getUserId(),
			message.getMessageId());
	addSelfLink(selfLinkBuilder, message);
	addActionLinks(selfLinkBuilder, message);
	addRelatedMessageLink(message, message);
	addSenderUserPhotoLinkIfAvailable(message);
	if (message.canBeDeleted())
	{
		addEditLink(selfLinkBuilder, message);
	}
	doDynamicDecoration(message);
	return message;
}
 
开发者ID:yonadev,项目名称:yona-server,代码行数:18,代码来源:MessageController.java

示例8: resourceLinks

import org.springframework.hateoas.mvc.ControllerLinkBuilder; //导入依赖的package包/类
@RequestMapping(method = RequestMethod.GET)
public PackageControllerLinksResource resourceLinks() {
	PackageControllerLinksResource resource = new PackageControllerLinksResource();
	resource.add(
			ControllerLinkBuilder.linkTo(methodOn(PackageController.class).upload(null))
					.withRel("upload"));
	resource.add(ControllerLinkBuilder.linkTo(methodOn(PackageController.class).install(null))
			.withRel("install"));
	resource.add(ControllerLinkBuilder.linkTo(methodOn(PackageController.class).install(null, null))
			.withRel("install/id"));
	return resource;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-skipper,代码行数:13,代码来源:PackageController.java

示例9: process

import org.springframework.hateoas.mvc.ControllerLinkBuilder; //导入依赖的package包/类
@Override
public RepositoryLinksResource process(RepositoryLinksResource resource) {
	resource.add(ControllerLinkBuilder.linkTo(methodOn(AboutController.class).getAboutResource()).withRel("about"));
	resource.add(ControllerLinkBuilder.linkTo(ReleaseController.class).withRel("release"));
	resource.add(ControllerLinkBuilder.linkTo(PackageController.class).withRel("package"));
	return resource;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-skipper,代码行数:8,代码来源:SkipperLinksResourceProcessor.java

示例10: toResource

import org.springframework.hateoas.mvc.ControllerLinkBuilder; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public MovieSearchResultResource toResource(final MovieSearchResult movie) {
    final MovieSearchResultResource movieResource = new MovieSearchResultResource(movie);

    movieResource.add(
            ControllerLinkBuilder.linkTo(
                    ControllerLinkBuilder
                            .methodOn(MovieRestController.class)
                            .getMovie(Long.valueOf(movie.getId()))
            ).withSelfRel()
    );

    return movieResource;
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:18,代码来源:MovieSearchResultResourceAssembler.java

示例11: toResource

import org.springframework.hateoas.mvc.ControllerLinkBuilder; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public MessageReceivedResource toResource(final MessageReceived message) {
    final MessageReceivedResource messageResource = new MessageReceivedResource(message);

    messageResource.add(
            ControllerLinkBuilder.linkTo(
                    ControllerLinkBuilder
                            .methodOn(MessageRestController.class)
                            .getMessageReceived(message.getId())
            ).withSelfRel()
    );

    return messageResource;
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:18,代码来源:MessageReceivedResourceAssembler.java

示例12: toResource

import org.springframework.hateoas.mvc.ControllerLinkBuilder; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public MessageSentResource toResource(final MessageSent message) {
    final MessageSentResource messageResource = new MessageSentResource(message);

    messageResource.add(
            ControllerLinkBuilder.linkTo(
                    ControllerLinkBuilder
                            .methodOn(MessageRestController.class)
                            .getMessageSent(message.getId())
            ).withSelfRel()
    );

    return messageResource;
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:18,代码来源:MessageSentResourceAssembler.java

示例13: toResource

import org.springframework.hateoas.mvc.ControllerLinkBuilder; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public UserSearchResultResource toResource(final UserSearchResult user) {
    final UserSearchResultResource userResource = new UserSearchResultResource(user);

    userResource.add(
            ControllerLinkBuilder.linkTo(
                    ControllerLinkBuilder
                            .methodOn(UserRestController.class)
                            .getProfile(user.getUsername())
            ).withSelfRel()
    );

    return userResource;
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:18,代码来源:UserSearchResultResourceAssembler.java

示例14: findUsers

import org.springframework.hateoas.mvc.ControllerLinkBuilder; //导入依赖的package包/类
@ApiOperation(value = "Find users")
@GetMapping(produces = MediaTypes.HAL_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
public
PagedResources<UserSearchResultResource> findUsers(
        @ApiParam(value = "The user's name")
        @RequestParam(value = "q", required = false) final String q,
        @PageableDefault(sort = {"id"}, direction = Sort.Direction.ASC) final Pageable page,
        final PagedResourcesAssembler<UserSearchResult> assembler
) {
    log.info("Called with q {}, page {}", q, page);

    // Build the self link which will be used for the next, previous, etc links
    final Link self = ControllerLinkBuilder
            .linkTo(
                    ControllerLinkBuilder
                            .methodOn(UserRestController.class)
                            .findUsers(
                                    q,
                                    page,
                                    assembler
                            )
            ).withSelfRel();

    return assembler.toResource(this.userSearchService.findUsers(
            q, page
    ), this.userSearchResultResourceAssembler, self);
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:29,代码来源:UserRestController.java

示例15: GetPropertiesResponse

import org.springframework.hateoas.mvc.ControllerLinkBuilder; //导入依赖的package包/类
public GetPropertiesResponse(
    String csarName,
    String platformName,
    @JsonProperty("properties") List<PropertyWrap> properties
) {
    this.properties = properties;
    add(ControllerLinkBuilder.linkTo(methodOn(TransformationController.class)
        .getTransformationProperties(null, null))
        .withSelfRel().expand(csarName, platformName)
    );
}
 
开发者ID:StuPro-TOSCAna,项目名称:TOSCAna,代码行数:12,代码来源:GetPropertiesResponse.java


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