diff --git a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/ProfileController.java b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/ProfileController.java index 0f1124741..9c6093f50 100644 --- a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/ProfileController.java +++ b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/ProfileController.java @@ -21,7 +21,6 @@ import java.util.Collections; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.repository.support.Repositories; -import org.springframework.data.rest.core.Path; import org.springframework.data.rest.core.config.RepositoryRestConfiguration; import org.springframework.data.rest.core.mapping.RepositoryResourceMappings; import org.springframework.data.rest.core.mapping.ResourceMapping; @@ -41,7 +40,7 @@ import org.springframework.web.bind.annotation.RequestMethod; * Profile-based controller exposing multiple forms of metadata. * * @author Greg Turnquist - * @see DATAREST-638 + * @author Oliver Gierke * @since 2.4 */ @BasePathAwareController @@ -63,7 +62,7 @@ public class ProfileController { */ @Autowired public ProfileController(RepositoryRestConfiguration configuration, RepositoryResourceMappings mappings, - Repositories repositories) { + Repositories repositories) { Assert.notNull(configuration, "RepositoryRestConfiguration must not be null!"); Assert.notNull(mappings, "RepositoryResourceMappings must not be null!"); @@ -113,7 +112,7 @@ public class ProfileController { } /** - * Return href for the profile root link of a given baseUri. + * Return the href for the profile root link of a given baseUri. * * @param configuration is the source of the app's baseUri. * @return @@ -125,7 +124,7 @@ public class ProfileController { } /** - * Return href for the profile link of a given baseUri and domain type mapping. + * Return the href for the profile link of a given baseUri and domain type mapping. * * @param configuration is the source of the app's baseUri. * @param mapping provides the resource's path. @@ -133,10 +132,7 @@ public class ProfileController { */ public static String getPath(RepositoryRestConfiguration configuration, ResourceMapping mapping) { - if (mapping == null) { - return getRootPath(configuration); - } else { - return getRootPath(configuration) + mapping.getPath(); - } + String path = getRootPath(configuration); + return mapping == null ? path : path + mapping.getPath(); } } diff --git a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/ProfileResourceProcessor.java b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/ProfileResourceProcessor.java index e1a21ea42..7a62ed0a3 100644 --- a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/ProfileResourceProcessor.java +++ b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/ProfileResourceProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2014-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +24,8 @@ import org.springframework.util.Assert; /** * {@link ResourceProcessor} to add a {@code profile} link to the root resource to point to multiple forms of metadata. * + * @author Oliver Gierke * @author Greg Turnquist - * @see DATAREST-638 * @since 2.4 */ public class ProfileResourceProcessor implements ResourceProcessor { @@ -43,7 +43,6 @@ public class ProfileResourceProcessor implements ResourceProcessor alpsOptions() { verifyAlpsEnabled();