Partial Response: JAX-RS Jackson JSON Filter

filter-json-jackson-jaxrs module

License

License

Categories

Categories

JSON Data Jackson
GroupId

GroupId

org.simondean.partial-response
ArtifactId

ArtifactId

filter-json-jackson-jaxrs
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

Partial Response: JAX-RS Jackson JSON Filter
filter-json-jackson-jaxrs module

Download filter-json-jackson-jaxrs

How to add to project

<!-- https://jarcasting.com/artifacts/org.simondean.partial-response/filter-json-jackson-jaxrs/ -->
<dependency>
    <groupId>org.simondean.partial-response</groupId>
    <artifactId>filter-json-jackson-jaxrs</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.simondean.partial-response/filter-json-jackson-jaxrs/
implementation 'org.simondean.partial-response:filter-json-jackson-jaxrs:1.1.0'
// https://jarcasting.com/artifacts/org.simondean.partial-response/filter-json-jackson-jaxrs/
implementation ("org.simondean.partial-response:filter-json-jackson-jaxrs:1.1.0")
'org.simondean.partial-response:filter-json-jackson-jaxrs:jar:1.1.0'
<dependency org="org.simondean.partial-response" name="filter-json-jackson-jaxrs" rev="1.1.0">
  <artifact name="filter-json-jackson-jaxrs" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.simondean.partial-response', module='filter-json-jackson-jaxrs', version='1.1.0')
)
libraryDependencies += "org.simondean.partial-response" % "filter-json-jackson-jaxrs" % "1.1.0"
[org.simondean.partial-response/filter-json-jackson-jaxrs "1.1.0"]

Dependencies

compile (4)

Group / Artifact Type Version
org.simondean.partial-response : filter-json-jackson jar 1.1.0
com.fasterxml.jackson.jaxrs : jackson-jaxrs-json-provider jar 2.11.0
javax.ws.rs : javax.ws.rs-api jar 2.0
javax.inject : javax.inject jar 1

test (5)

Group / Artifact Type Version
junit : junit jar 4.11
org.mockito : mockito-all jar 1.10.8
com.google.guava : guava-testlib jar 29.0-jre
pl.pragmatists : JUnitParams jar 1.0.2
org.jboss.resteasy : resteasy-jaxrs jar 3.0.10.Final

Project Modules

There are no modules declared in this project.

Partial Response

Build Status

This project provides a library to help with the processing and implementation of partial response in an API.

The core library consists of parsers, AST, visitors and matcher for working with a partial response value. Higher level functionality may be added over time including http filters for xml and json to post process your responses for inclusion in the partial response.

Usage

To use this in your Maven project simply include the dependency

<dependency>
  <groupId>org.simondean.partial-response</groupId>
  <artifactId>matcher</artifactId>
  <version>1.0</version>
</dependency>

This will give you the Matcher class which is the core concept for partial response. The Matcher gives you a way to parse and match against a partial response pattern.

Matcher matcher = Matcher.of("name,address,spouse(name,address),children/*");

// matches all of these Leafs
assertTrue(matcher.matches("/name"));
assertTrue(matcher.matches("/address"));
assertTrue(matcher.matches("/address/houseNumber"));
assertTrue(matcher.matches("/spouse/name"));
assertTrue(matcher.matches("/spouse/address"));
assertTrue(matcher.matches("/children"));
assertTrue(matcher.matches("/children/any/path"));

// doesn't match any of these
assertFalse(matcher.matches("/unknown"));
assertFalse(matcher.matches("/spouse/children"));
// Note: spouse as a leaf is not included, only certain sub properties are
assertFalse(matcher.matches("/spouse"));

Out of the box

This project consists of a number of sub-projects to cover different use cases for partial-response.

  • Matcher - contains the core pattern parsers and Matcher class. This is the low level functionality behind all partial response support
  • Jackson JSON Filter - Partial response filter for Jackson JSON serialisation.
  • JAX-RS Jackson JSON Filter - JAX-RS response filter for applying partial-response to JAX-RS based REST API responses.

Versions

Version
1.1.0