Class BaseUri

java.lang.Object
org.springframework.data.rest.webmvc.BaseUri

public class BaseUri extends Object
Value object to be able to extract the lookup path within a configured base URI that forms a URI namespace.
Author:
Oliver Gierke
  • Field Details

    • NONE

      public static final BaseUri NONE
  • Constructor Details

    • BaseUri

      public BaseUri(URI uri)
      Creates a new BaseUri with the given URI as base.
      Parameters:
      uri - must not be null.
    • BaseUri

      public BaseUri(String uri)
      Creates a new BaseUri with the given URI as base.
      Parameters:
      uri - must not be null.
  • Method Details

    • getUri

      public URI getUri()
      Returns the base URI.
      Returns:
    • getRepositoryLookupPath

      public String getRepositoryLookupPath(org.springframework.web.context.request.NativeWebRequest request)
      Extracts the actual lookup path within the Spring Data REST managed URI space. This includes stripping the necessary parts of the base URI from the source lookup path.
      Parameters:
      request - must not be null.
      Returns:
      the stripped lookup path with then the repository URI space or null in case the lookup path is not pointing into the repository URI space.
    • getRepositoryLookupPath

      public String getRepositoryLookupPath(String lookupPath)
      Extracts the actual lookup path within the Spring Data REST managed URI space. This includes stripping the necessary parts of the base URI from the source lookup path.
      Parameters:
      lookupPath - must not be null.
      Returns:
      the stripped lookup path with then the repository URI space or null in case the lookup path is not pointing into the repository URI space.
    • getUriComponentsBuilder

      public org.springframework.web.util.UriComponentsBuilder getUriComponentsBuilder()
      Returns a new UriComponentsBuilder for the base URI. If the base URI is not absolute, it'll lokup the URI for the current servlet mapping and extend it accordingly.
      Returns:
    • appendPath

      public org.springframework.web.util.UriComponents appendPath(Path path)
      Returns the UriComponents for the given Path appended to the current BaseUri.
      Parameters:
      path - must not be null.
      Returns: