Announcement Announcement Module
Collapse
No announcement yet.
Spring Data REST RestResource url Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Data REST RestResource url

    Hi all,

    Is it possible to export a @RestResource in Spring Data REST with a prefixed URL like /xxx/yyy/<path>?

    Now, i'm able to define such a resource:

    @RestResource(exported = true, rel = "asignaturas", path = "asignaturas")
    public interface AsignaturaRepository extends PagingAndSortingRepository<TfgVwAsignaturas, String>
    {
    @RestResource
    public Page<TfgVwAsignaturas> findByNombre(@Param("nombre") String nombre, Pageable pageable);
    }

    But i would like to be able to access different resources through different urls:

    *. /aaa/bbb/ccc/asignaturas
    *. /xxx/yyy/another
    *. /www/xxx/anotherone

    I have seen that i can configure the WebApplicationInitializer to register a different mapping URL, but this is for the whole application and i want different prefixes for different resources ...

    I have tried this, but breaks with a NPE:

    @RestResource(exported = true, rel = "asignaturas", path = "/aaa/bbb/ccc/asignaturas")
    public interface AsignaturaRepository extends PagingAndSortingRepository<TfgVwAsignaturas, String>
    {
    @RestResource
    public Page<TfgVwAsignaturas> findByNombre(@Param("nombre") String nombre, Pageable pageable);
    }

    Thanks a lot for your help!!!!

    Best regards,
    Ricardo

  • #2
    Hi again,

    I have found some information to change the base URL:

    RepositoryRestConfiguration.setBaseUri("http://xxxx")

    I'm also able to modify the path attribute for repositories, but i always get an error accesing the new resource.
    How can i map this new URL to the resource?

    Thanks!!

    Comment


    • #3
      Hi again,

      I have seen this issue in JIRA:

      https://jira.springsource.org/browse/DATAREST-79

      Can anybody confirm that doen't exist a workaround for this?

      Best regards,
      Ricardo

      Comment

      Working...
      X