This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "firstName": "John", | |
| "links": [ | |
| { | |
| "rel": "self", | |
| "href": "http://localhost:8080/users/1?fields=firstName" | |
| }, | |
| { | |
| "rel": "user", | |
| "href": "http://localhost:8080/users/1{?projection}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @RepositoryRestController | |
| public class UserController { | |
| private final UserRepository userRepository; | |
| private final RepositoryEntityLinks links; | |
| public UserController(final UserRepository userRepository, | |
| final RepositoryEntityLinks links) { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "username": "jsmith", | |
| "_links": { | |
| "self": { | |
| "href": "http://localhost:8080/users/1" | |
| }, | |
| "user": { | |
| "href": "http://localhost:8080/users/1{?projection}", | |
| "templated": true | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "alps": { | |
| "version": "1.0", | |
| "descriptors": [ | |
| { | |
| "id": "get-users", | |
| "name": "users", | |
| "type": "SAFE", | |
| "rt": "#user-representation", | |
| "descriptors": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "_embedded": { | |
| "users": [] | |
| }, | |
| "_links": { | |
| "self": { | |
| "href": "http://localhost:8080/users" | |
| }, | |
| "profile": { | |
| "href": "http://localhost:8080/profile/users" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "username": "jsmith", | |
| "firstName": "John", | |
| "lastName": "Smith", | |
| "_links": { | |
| "self": { | |
| "href": "http://localhost:8080/users/1" | |
| }, | |
| "user": { | |
| "href": "http://localhost:8080/users/1{?projection}", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.samkruglov.entities.projections; | |
| @Projection(name = "username-only", types = User.class) | |
| public interface UserUsername { | |
| String getUsername(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "username": "jsmith", | |
| "groupName": "A" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface UserRepository extends CrudRepository<User, Long> { | |
| @RestResource(path = "username", rel = "getUsername") | |
| UserUsernameAndGroupName findUsernameAndGroupNameById(@Param("id") Long id); | |
| interface UserUsernameAndGroupName { | |
| String getUsername(); | |
| default String getGroupName() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "username": "jsmith", | |
| "_links": { | |
| "self": { | |
| "href": "http://localhost:8080/users/search/username{?id}", | |
| "templated": true | |
| }, | |
| "user": { | |
| "href": "http://localhost:8080/users/1" | |
| } |