Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Commit

Permalink
Support for JSON-B. Clarification on how to support JSON-B and JSON-P…
Browse files Browse the repository at this point in the history
… simultaneously.
  • Loading branch information
spericas committed May 23, 2017
1 parent 671e2eb commit cfa1083
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions chapters/changes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ \section{Changes Since 2.1 Public Review}
\begin{itemize}
\item Section \ref{executor_services}: Removed defaults for all environments not supporting the Java Concurrenty Utilities for Java EE API.
\item Section \ref{jsonp}: Support for \code{JsonValue} and all its sub-types.
\item Section \ref{jsonb}: New section for JSON-B support.
\end{itemize}

\section{Changes Since 2.1 Early Draft}
Expand Down
12 changes: 10 additions & 2 deletions chapters/environment.tex
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,19 @@ \subsection{Bean Validation}
\subsection{Java API for JSON Processing}
\label{jsonp}

In a product that supports the Java API for JSON Processing (JSON-P) \cite{jsonp}, implementations MUST support entity providers for \code{JsonValue} and all of its sub-types:
\code{JsonStructure}, \code{JsonObject}, \code{JsonArray}, \code{JsonString} and \code{JsonNumber}. Therefore, the standard set of entity providers from Section~\ref{standard_entity_providers} is extended to support these types in combinations with the \code{application/json} media type.
In a product that supports the Java API for JSON Processing (JSON-P) \cite{jsonp}, implementations MUST support entity providers for \code{JsonValue} and all of its sub-types: \code{JsonStructure}, \code{JsonObject}, \code{JsonArray}, \code{JsonString} and \code{JsonNumber}.

Note that other types from the JSON-P API such as \code{JsonParser}, \code{JsonGenerator}, \code{JsonReader} and \code{JsonWriter} can also be integrated into JAX-RS applications using the entity providers for \code{InputStream} and \code{StreamingOutput}.


\subsection{Java API for JSON Binding}
\label{jsonb}
In a product that supports the Java API for JSON Binding (JSON-B) \cite{jsonb},
implementations MUST support entity providers for all Java types supported by JSON-B in combination with the \code{application/json} media type.

Note that if JSON-B and JSON-P are both supported in the same environment, entity providers for JSON-B take precedence over those for JSON-P for all types except \code{JsonValue} and its sub-types.


\subsection{Additional Requirements}
\label{additional_reqs}

Expand Down
2 changes: 2 additions & 0 deletions chapters/providers.tex
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ \subsection{Standard Entity Providers}
\item[\code{java.lang.Boolean}, \code{java.lang.Character}, \code{java.lang.Number} \label{primitive_types}] Only for \code{text/plain}. Corresponding primitive types supported via boxing/unboxing conversion.
\end{description}

Depending on the environment, the list of standard entity providers MUST also include those for media type \code{application/json}. For more information about these providers see Sections \ref{jsonp} and \ref{jsonb}.

When reading zero-length message entities all pre-packaged \MsgRead\ implementations, except the JAXB one and those for the (boxed) primitive types above, MUST create a corresponding Java object that represents zero-length data. The pre-packaged JAXB and the pre-packaged primitive type \MsgRead\ implementations MUST throw a \code{NoContentException} for zero-length message entities.

When a \code{NoContentException} is thrown while reading a server request entity from a \MsgRead\, it MUST be translated by the server runtime into a \code{BadRequestException} wrapping the original \code{NoContentException} and re-thrown to be processed by any registered exception mappers.
Expand Down
9 changes: 9 additions & 0 deletions references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,15 @@ @techreport{jsonp
Title = {{Java} {API} {for} {JSON} {Processing} {1.1}},
Type = {{JSR}},
Year = 2017}

@techreport{jsonb,
Author = {Dmitry Kornilov},
Institution = {JCP},
Month = {July},
Note = {See http://jcp.org/en/jsr/detail?id=367},
Title = {{Java} {API} {for} {JSON} {Binding}},
Type = {{JSR}},
Year = 2017}
@techreport{concurrencyee,
Author = {Anthony Lai},
Expand Down
Binary file modified spec.pdf
Binary file not shown.

0 comments on commit cfa1083

Please sign in to comment.