mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-14 06:17:55 +00:00
docs: update partial response
This commit is contained in:
1 parent
3a569a691d
commit
3cd86ab135
1 file changed
-10
@@ -84,7 +84,6 @@ public class FieldJsonMapper {
|
|||||||
- It splits the `fields` parameter into a set of field names, uses `FieldJsonMapper` to include only those fields in the response, and returns the partial JSON response.
|
- It splits the `fields` parameter into a set of field names, uses `FieldJsonMapper` to include only those fields in the response, and returns the partial JSON response.
|
||||||
|
|
||||||
```java
|
```java
|
||||||
|
|
||||||
@Path("/videos")
|
@Path("/videos")
|
||||||
public class VideoResource {
|
public class VideoResource {
|
||||||
@GET
|
@GET
|
||||||
@@ -119,14 +118,10 @@ public class VideoResource {
|
|||||||
- The server listens on `http://localhost:8080/`.
|
- The server listens on `http://localhost:8080/`.
|
||||||
|
|
||||||
```java
|
```java
|
||||||
import org.glassfish.jersey.server.ResourceConfig;
|
|
||||||
import org.glassfish.jersey.simple.SimpleContainerFactory;
|
|
||||||
|
|
||||||
public class App {
|
public class App {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
ResourceConfig config = new ResourceConfig();
|
ResourceConfig config = new ResourceConfig();
|
||||||
config.register(VideoResource.class);
|
config.register(VideoResource.class);
|
||||||
|
|
||||||
SimpleContainerFactory.create("http://localhost:8080/", config);
|
SimpleContainerFactory.create("http://localhost:8080/", config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -141,10 +136,6 @@ To summarize, in this example:
|
|||||||
|
|
||||||
By implementing the Partial Response design pattern, clients can request only the necessary data, enhancing performance and reducing bandwidth usage.
|
By implementing the Partial Response design pattern, clients can request only the necessary data, enhancing performance and reducing bandwidth usage.
|
||||||
|
|
||||||
## Class diagram
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Applicability
|
## Applicability
|
||||||
|
|
||||||
Use the Partial Response pattern when
|
Use the Partial Response pattern when
|
||||||
@@ -184,4 +175,3 @@ Trade-offs:
|
|||||||
* [Building Microservices](https://amzn.to/3UACtrU)
|
* [Building Microservices](https://amzn.to/3UACtrU)
|
||||||
* [Designing Data-Intensive Applications: The Big Ideas Behind Reliable, Scalable, and Maintainable Systems](https://amzn.to/4dKEwBa)
|
* [Designing Data-Intensive Applications: The Big Ideas Behind Reliable, Scalable, and Maintainable Systems](https://amzn.to/4dKEwBa)
|
||||||
* [RESTful Web APIs: Services for a Changing World](https://amzn.to/3wG4fu3)
|
* [RESTful Web APIs: Services for a Changing World](https://amzn.to/3wG4fu3)
|
||||||
* [Google Cloud Common Design Patterns](https://cloud.google.com/apis/design/design_patterns)
|
|
||||||
Reference in new issue
Block a user