Java Code Examples for org.springframework.data.rest.webmvc.BaseUri

The following examples show how to use org.springframework.data.rest.webmvc.BaseUri. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: spring-content   Author: paulcwarren   File: ContentLinksResourceProcessor.java    License: Apache License 2.0 5 votes vote down vote up
private Link propertyLink(ResourceMetadata md, URI baseUri, Object id, String property, String contentId) {
	LinkBuilder builder = new RepositoryLinkBuilder(md, new BaseUri(baseUri));

	builder = builder.slash(id).slash(property);

	if (contentId != null) {
		builder = builder.slash(contentId);
	}

	return builder.withRel(property);
}
 
Example #2
Source Project: moserp   Author: thomasletsch   File: ValuePropertyFactory.java    License: Apache License 2.0 5 votes vote down vote up
private String calculateValueListUri(PropertyFactoryContext context) {
    ValueListKey valueListValue = getAnnotation(context, ValueListKey.class);
    String valueListKey = valueListValue.value();
    final BaseUri baseUri = new BaseUri("http://" + moduleRegistry.getModuleForResource("valueLists") + "/valueLists");
    UriComponentsBuilder builder = baseUri.getUriComponentsBuilder();
    return builder.pathSegment(valueListKey).pathSegment("values").build().toUriString();
}
 
Example #3
Source Project: moserp   Author: thomasletsch   File: ResourceAssociationPropertyFactory.java    License: Apache License 2.0 5 votes vote down vote up
private String calculateValueListUri(PropertyFactoryContext context) {
    ResourceAssociation resourceAssociation = getAnnotation(context, ResourceAssociation.class);
    String resourceName = resourceAssociation.value();

    final BaseUri baseUri = new BaseUri("http://" + moduleRegistry.getModuleForResource(resourceName));
    UriComponentsBuilder builder = baseUri.getUriComponentsBuilder();
    return builder.path(resourceName).build().toUriString();
}
 
Example #4
Source Project: moserp   Author: thomasletsch   File: ValuePropertyJsonSchemaFactory.java    License: Apache License 2.0 5 votes vote down vote up
private String calculateValueListUri(PropertyFactoryContext context) {
    ValueListKey valueListValue = getAnnotation(context, ValueListKey.class);
    String valueListKey = valueListValue.value();
    final BaseUri baseUri = new BaseUri("http://" + moduleRegistry.getModuleForResource("valueLists") + "/valueLists");
    UriComponentsBuilder builder = baseUri.getUriComponentsBuilder();
    return builder.pathSegment(valueListKey).pathSegment("values").build().toUriString();
}
 
Example #5
Source Project: moserp   Author: thomasletsch   File: ApplicationStructureController.java    License: Apache License 2.0 4 votes vote down vote up
private String getRootPath() {
    BaseUri baseUri = new BaseUri(configuration.getBaseUri());
    return baseUri.getUriComponentsBuilder().path(BASE_PATH).build().toString();
}
 
Example #6
Source Project: moserp   Author: thomasletsch   File: AssociationPropertyFactory.java    License: Apache License 2.0 4 votes vote down vote up
private String calculateUri(PropertyFactoryContext context) {
    ResourceMetadata mapping = mappings.getMetadataFor(context.getPersistentProperty().getType());
    final BaseUri baseUri = new BaseUri("http://" + moduleRegistry.getModuleForResource(mapping.getRel()));
    UriComponentsBuilder builder = baseUri.getUriComponentsBuilder();
    return builder.path(mapping.getPath().toString()).build().toUriString();
}