Оцените презентацию от 1 до 5 баллов!
Тип файла:
ppt / pptx (powerpoint)
Всего слайдов:
18 слайдов
Для класса:
1,2,3,4,5,6,7,8,9,10,11
Размер файла:
72.08 kB
Просмотров:
99
Скачиваний:
0
Автор:
неизвестен
Слайды и текст к этой презентации:
№1 слайд![Spring data rest](/documents_6/ed4bcc26ac2c76414a9a44da60c649cd/img0.jpg)
Содержание слайда: Spring data rest
№2 слайд![Features Provides rest api](/documents_6/ed4bcc26ac2c76414a9a44da60c649cd/img1.jpg)
Содержание слайда: Features
Provides rest api for domain model using HAL.
Supports pagination.
Allows to define projections.
№3 слайд![What is HATEOAS? HATEOAS is a](/documents_6/ed4bcc26ac2c76414a9a44da60c649cd/img2.jpg)
Содержание слайда: What is HATEOAS?
HATEOAS is a concept of application architecture. It defines the way in which application clients interact with the server, by navigating hypermedia links they find inside resource models returned by the server.
A core principle of HATEOAS is that resources should be discoverable through the publication of links that point to the available resources.
№4 слайд![What is HAL? HAL Hypertext](/documents_6/ed4bcc26ac2c76414a9a44da60c649cd/img3.jpg)
Содержание слайда: What is HAL?
HAL = Hypertext Application Language.
HAL is a generic media type with which Web APIs can be developed and
exposed as series of links.
MediaType = "application/hal+json"
№5 слайд![What is HAL? GET orders HTTP](/documents_6/ed4bcc26ac2c76414a9a44da60c649cd/img4.jpg)
Содержание слайда: What is HAL?
GET /orders/523 HTTP/1.1
Host: example.org
Accept: application/hal+json
HTTP/1.1 200 OK
Content-Type: application/hal+json
{
"_embedded" : {
"transactions" : [ { ... } ]
},
"_links" : {
"first" : {
"href" : "http://localhost:8080/api/transactions?page=0&size=20"
}, …
},
"page" : {
"size" : 20,
"totalElements" : 26,
"totalPages" : 2,
"number" : 0
}
}
№6 слайд![Dependency lt dependency gt](/documents_6/ed4bcc26ac2c76414a9a44da60c649cd/img5.jpg)
Содержание слайда: Dependency
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
№7 слайд![RepositoryRestConfigurer Bean](/documents_6/ed4bcc26ac2c76414a9a44da60c649cd/img6.jpg)
Содержание слайда: RepositoryRestConfigurer
@Bean
public RepositoryRestConfigurer repositoryRestConfigurer() {
return new RepositoryRestConfigurerAdapter() {
@Override
public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
config.setBasePath("/api");
}
};
}
№8 слайд![RepositoryRestConfigurer](/documents_6/ed4bcc26ac2c76414a9a44da60c649cd/img7.jpg)
Содержание слайда: RepositoryRestConfigurer properties
basePath
defaultPageSize
maxPageSize
pageParamName
limitParamName
sortParamName
defaultMediaType
e.t.c.
№9 слайд![Example](/documents_6/ed4bcc26ac2c76414a9a44da60c649cd/img8.jpg)
Содержание слайда: Example
@RepositoryRestResource
public interface UserRepository extends JpaRepository<User, Long> {}
№10 слайд![Supported http methods GET](/documents_6/ed4bcc26ac2c76414a9a44da60c649cd/img9.jpg)
Содержание слайда: Supported http methods
GET
POST
PUT
DELETE
HEAD
OPTIONS
№11 слайд![User Entity public class User](/documents_6/ed4bcc26ac2c76414a9a44da60c649cd/img10.jpg)
Содержание слайда: User
@Entity
public class User {
@Id @GeneratedValue
private long userId;
private String username;
private int age;
...getters/setters
}
№12 слайд![How to access repository? The](/documents_6/ed4bcc26ac2c76414a9a44da60c649cd/img11.jpg)
Содержание слайда: How to access repository?
The path is derived from the uncapitalized, pluralized, simple class name of the domain class being managed.
User -> …/users
…/users/3
№13 слайд![GET request users find all](/documents_6/ed4bcc26ac2c76414a9a44da60c649cd/img12.jpg)
Содержание слайда: GET request
…/users // find all users using default pagination. Returns first page
…/users?page=1 // find all users using default pagination. Returns second page
…/users?size=2 // find all users using pagination by 2. returns first page.
№14 слайд![POST request users body](/documents_6/ed4bcc26ac2c76414a9a44da60c649cd/img13.jpg)
Содержание слайда: POST request
…/users
body:
{
“username” : “test”,
“age” : “1”
}
№15 слайд![PUT request users body](/documents_6/ed4bcc26ac2c76414a9a44da60c649cd/img14.jpg)
Содержание слайда: PUT request
…/users/1
body:
{
“username” : “test”,
“age” : “1”
}
№16 слайд![DELETE request users](/documents_6/ed4bcc26ac2c76414a9a44da60c649cd/img15.jpg)
Содержание слайда: DELETE request
…/users/1
№17 слайд![Custom database query](/documents_6/ed4bcc26ac2c76414a9a44da60c649cd/img16.jpg)
Содержание слайда: Custom database query
@RepositoryRestResource
public interface UserRepository extends JpaRepository<User, Long> {
Collection<User> findByAge(@Param(“age”) int age);
}
№18 слайд![Custom database query call](/documents_6/ed4bcc26ac2c76414a9a44da60c649cd/img17.jpg)
Содержание слайда: Custom database query call
.../users/search/findByAge?age=10