當前位置: 首頁>>代碼示例>>Java>>正文


Java ResourceSupport.add方法代碼示例

本文整理匯總了Java中org.springframework.hateoas.ResourceSupport.add方法的典型用法代碼示例。如果您正苦於以下問題:Java ResourceSupport.add方法的具體用法?Java ResourceSupport.add怎麽用?Java ResourceSupport.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.hateoas.ResourceSupport的用法示例。


在下文中一共展示了ResourceSupport.add方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getStatusIndex

import org.springframework.hateoas.ResourceSupport; //導入方法依賴的package包/類
@RequestMapping(
    value = {"/status/", "/status"},
    method = RequestMethod.GET,
    produces = "application/hal+json"
)
@ApiOperation(
    value = "Hypermedia endpoint to get all supported Status operations",
    notes = "Status operations are based on Spring Boot Actuator",
    produces = "application/hal+json",
    response = ResourceSupport.class
)
public ResourceSupport getStatusIndex(HttpServletRequest request) throws Exception {
    String baseURL = request.getRequestURL().toString()
        .replace("/api/status", "").replace("/api/status/", "");
    ResourceSupport support = new HiddenResourceSupport();
    support.add(new Link(baseURL + actuatorHealthPath, "health"));
    support.add(new Link(baseURL + actuatorMetricsPath, "metrics"));
    if (actuatorMappingsActive)
        support.add(new Link(baseURL + actuatorMappingsPath, "mappings"));
    support.add(linkTo(methodOn(CommonController.class).getStatusIndex(null)).withSelfRel());
    return support;
}
 
開發者ID:StuPro-TOSCAna,項目名稱:TOSCAna,代碼行數:23,代碼來源:CommonController.java

示例2: getIndex

import org.springframework.hateoas.ResourceSupport; //導入方法依賴的package包/類
@RequestMapping(
    value = {"/", ""},
    method = RequestMethod.GET,
    produces = "application/hal+json"
)
@ApiOperation(
    value = "Hypermedia endpoint to get all resource endpoints",
    notes = "The retuned links to the endpoints are: Csars, platforms and status",
    produces = "application/hal+json",
    response = ResourceSupport.class
)
public ResourceSupport getIndex() throws Exception {
    ResourceSupport support = new HiddenResourceSupport();
    support.add(linkTo(methodOn(CommonController.class).getIndex()).withSelfRel());
    support.add(linkTo(methodOn(CommonController.class).getStatusIndex(null)).withRel("status"));
    support.add(linkTo(methodOn(PlatformController.class).getPlatforms()).withRel("platforms"));
    support.add(linkTo(methodOn(CsarController.class).listCSARs()).withRel("csars"));
    return support;
}
 
開發者ID:StuPro-TOSCAna,項目名稱:TOSCAna,代碼行數:20,代碼來源:CommonController.java

示例3: info

import org.springframework.hateoas.ResourceSupport; //導入方法依賴的package包/類
/**
 * Return a {@link ResourceSupport} object containing the resources
 * served by the Data Flow server.
 *
 * @return {@code ResourceSupport} object containing the Data Flow server's resources
 */
@RequestMapping("/")
public ResourceSupport info() {
	ResourceSupport resourceSupport = new ResourceSupport();
	resourceSupport.add(new Link(dashboard(""), "dashboard"));
	resourceSupport.add(entityLinks.linkToCollectionResource(AppRegistrationResource.class).withRel("apps"));

	resourceSupport.add(entityLinks.linkToCollectionResource(AppStatusResource.class).withRel("runtime/apps"));
	resourceSupport.add(unescapeTemplateVariables(entityLinks.linkForSingleResource(AppStatusResource.class, "{appId}").withRel("runtime/apps/app")));
	resourceSupport.add(unescapeTemplateVariables(entityLinks.linkFor(AppInstanceStatusResource.class, UriComponents.UriTemplateVariables.SKIP_VALUE).withRel("runtime/apps/instances")));

	resourceSupport.add(entityLinks.linkToCollectionResource(ApplicationDefinitionResource.class).withRel("applications/definitions"));
	resourceSupport.add(unescapeTemplateVariables(entityLinks.linkToSingleResource(ApplicationDefinitionResource.class, "{name}").withRel("applications/definitions/definition")));
	resourceSupport.add(entityLinks.linkToCollectionResource(ApplicationDeploymentResource.class).withRel("applications/deployments"));
	resourceSupport.add(unescapeTemplateVariables(entityLinks.linkToSingleResource(ApplicationDeploymentResource.class, "{name}").withRel("applications/deployments/deployment")));

	String completionStreamTemplated = entityLinks.linkFor(CompletionProposalsResource.class).withSelfRel().getHref() + ("/stream{?start,detailLevel}");
	resourceSupport.add(new Link(completionStreamTemplated).withRel("completions/stream"));
	String completionTaskTemplated = entityLinks.linkFor(CompletionProposalsResource.class).withSelfRel().getHref() + ("/task{?start,detailLevel}");
	resourceSupport.add(new Link(completionTaskTemplated).withRel("completions/task"));
	return resourceSupport;
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-dashboard,代碼行數:28,代碼來源:RootController.java

示例4: execution

import org.springframework.hateoas.ResourceSupport; //導入方法依賴的package包/類
@Around("@annotation(org.educama.common.api.resource.PageLinks) && execution(org.springframework.hateoas.ResourceSupport+ *(..)) && args(page, ..)")
public Object pageLinksAdvice(ProceedingJoinPoint joinPoint, Page<?> page) throws Throwable {
    HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
    Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
    PageLinks pageLinks = method.getAnnotation(PageLinks.class);
    Class<?> controller = pageLinks.value();
    UriComponentsBuilder original = originalUri(controller, request);
    ResourceSupport resourceSupport = (ResourceSupport) joinPoint.proceed();
    if (page.hasNext()) {
        UriComponentsBuilder nextBuilder = replacePageParams(original, page.nextPageable());
        resourceSupport.add(new Link(nextBuilder.toUriString()).withRel("next"));
    }
    if (page.hasPrevious()) {
        UriComponentsBuilder prevBuilder = replacePageParams(original, page.previousPageable());
        resourceSupport.add(new Link(prevBuilder.toUriString()).withRel("prev"));
    }
    return resourceSupport;
}
 
開發者ID:Educama,項目名稱:Showcase,代碼行數:19,代碼來源:PageLinksAspect.java

示例5: root

import org.springframework.hateoas.ResourceSupport; //導入方法依賴的package包/類
@GetMapping("/")
ResponseEntity<ResourceSupport> root() {

	ResourceSupport resourceSupport = new ResourceSupport();

	resourceSupport.add(linkTo(methodOn(RootController.class).root()).withSelfRel());
	resourceSupport.add(linkTo(methodOn(EmployeeController.class).findAll()).withRel("employees"));
	resourceSupport.add(linkTo(methodOn(EmployeeController.class).findAllDetailedEmployees()).withRel("detailedEmployees"));
	resourceSupport.add(linkTo(methodOn(ManagerController.class).findAll()).withRel("managers"));

	return ResponseEntity.ok(resourceSupport);
}
 
開發者ID:spring-projects,項目名稱:spring-hateoas-examples,代碼行數:13,代碼來源:RootController.java

示例6: root

import org.springframework.hateoas.ResourceSupport; //導入方法依賴的package包/類
@GetMapping(value = "/", produces = MediaTypes.HAL_JSON_VALUE)
public ResourceSupport root() {

	ResourceSupport rootResource = new ResourceSupport();
	
	rootResource.add(
		linkTo(methodOn(EmployeeController.class).root()).withSelfRel(),
		linkTo(methodOn(EmployeeController.class).findAll()).withRel("employees"));

	return rootResource;
}
 
開發者ID:spring-projects,項目名稱:spring-hateoas-examples,代碼行數:12,代碼來源:EmployeeController.java

示例7: root

import org.springframework.hateoas.ResourceSupport; //導入方法依賴的package包/類
@GetMapping(value = "/", produces = MediaTypes.HAL_JSON_VALUE)
public ResourceSupport root() {

	ResourceSupport rootResource = new ResourceSupport();

	rootResource.add(
		linkTo(methodOn(EmployeeController.class).root()).withSelfRel(),
		linkTo(methodOn(EmployeeController.class).findAll()).withRel("employees"));

	return rootResource;
}
 
開發者ID:spring-projects,項目名稱:spring-hateoas-examples,代碼行數:12,代碼來源:EmployeeController.java

示例8: addEndpointLinks

import org.springframework.hateoas.ResourceSupport; //導入方法依賴的package包/類
public void addEndpointLinks(ResourceSupport resource, String self) {
	if (!resource.hasLink("self")) {
		resource.add(linkTo(LinksEnhancer.class).slash(this.rootPath + self)
				.withSelfRel());
	}
	Set<String> added = new HashSet<String>();
	for (MvcEndpoint endpoint : this.endpoints.getEndpoints()) {
		if (!endpoint.getPath().equals(self) && !added.contains(endpoint.getPath())) {
			addEndpointLink(resource, endpoint);
		}
		added.add(endpoint.getPath());
	}
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:14,代碼來源:LinksEnhancer.java

示例9: addEndpointLink

import org.springframework.hateoas.ResourceSupport; //導入方法依賴的package包/類
private void addEndpointLink(ResourceSupport resource, MvcEndpoint endpoint) {
	Class<?> type = endpoint.getEndpointType();
	type = (type == null ? Object.class : type);
	String path = endpoint.getPath();
	String rel = (path.startsWith("/") ? path.substring(1) : path);
	if (StringUtils.hasText(rel)) {
		String fullPath = this.rootPath + endpoint.getPath();
		resource.add(linkTo(type).slash(fullPath).withRel(rel));
	}
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:11,代碼來源:LinksEnhancer.java

示例10: home

import org.springframework.hateoas.ResourceSupport; //導入方法依賴的package包/類
@RequestMapping("")
public ResourceSupport home() {
	ResourceSupport resource = new ResourceSupport();
	resource.add(linkTo(SpringBootHypermediaApplication.class).slash("/")
			.withSelfRel());
	return resource;
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:8,代碼來源:HalBrowserMvcEndpointServerContextPathIntegrationTests.java

示例11: registerCashDesk

import org.springframework.hateoas.ResourceSupport; //導入方法依賴的package包/類
@RequestMapping(method = RequestMethod.GET)
	public ResponseEntity<?> registerCashDesk(@Context HttpServletRequest req) {

		ResourceSupport ret = new ResourceSupport();
		ret.add(linkTo(methodOn(RegistrationRest.class).registerCashDesk(null, "{id}")).withRel("registration"));
//		ret.add(linkTo(methodOn(IncomeRest.class).postIncome(null, null)).withRel("income"));

		return ResponseEntity.ok(ret);
	}
 
開發者ID:eetlite,項目名稱:eet.osslite.cz,代碼行數:10,代碼來源:IndexRest.java

示例12: fillLinksForAuthenticatedUser

import org.springframework.hateoas.ResourceSupport; //導入方法依賴的package包/類
private void fillLinksForAuthenticatedUser(User user, ResourceSupport links) {
    links.add(linkTo(methodOn(MarkdownController.class).create(user.getUsername(), null)).withRel("createDoc"));
    links.add(linkTo(methodOn(MarkdownController.class).getUserDocs(user.getUsername())).withRel("getDocs"));
}
 
開發者ID:AlexIvchenko,項目名稱:markdown-redactor,代碼行數:5,代碼來源:RootIntegrationServiceImpl.java

示例13: fillLinksForAnonymousUser

import org.springframework.hateoas.ResourceSupport; //導入方法依賴的package包/類
private void fillLinksForAnonymousUser(ResourceSupport links) {
    links.add(linkTo(methodOn(UserController.class).create(null))
            .withRel("signUp"));
}
 
開發者ID:AlexIvchenko,項目名稱:markdown-redactor,代碼行數:5,代碼來源:RootIntegrationServiceImpl.java


注:本文中的org.springframework.hateoas.ResourceSupport.add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。