- java.lang.Object
-
- io.helidon.media.jsonp.JsonpSupport
-
- All Implemented Interfaces:
MediaSupport
public final class JsonpSupport extends Object implements MediaSupport
Support for JSON Processing integration. For usage examples navigate toMediaSupport
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JsonpSupport.Builder
Fluent-API builder forJsonpSupport
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JsonpSupport.Builder
builder()
Fluent API builder to create instances of JSON-P.static JsonpSupport
create()
Provides a default instance for JSON-P readers and writers.static JsonpSupport
create(Map<String,?> jsonPConfig)
Create an instance with the provided JSON-P configuration.static MessageBodyStreamWriter<JsonStructure>
eventStreamWriter()
Return a default JSON-P entity event stream writer.static MessageBodyStreamWriter<JsonStructure>
eventStreamWriter(JsonWriterFactory writerFactory)
Create a new JSON-P entity stream writer based onJsonWriterFactory
instance.MessageBodyStreamWriter<JsonStructure>
eventStreamWriterInstance()
Return JSON-P stream writer.static MessageBodyStreamWriter<JsonStructure>
ndJsonStreamWriter()
Return a default JSON-P entity event stream writer.static MessageBodyStreamWriter<JsonStructure>
ndJsonStreamWriter(JsonWriterFactory writerFactory)
Create a new JSON-P entity stream writer based onJsonWriterFactory
instance.MessageBodyStreamWriter<JsonStructure>
ndJsonStreamWriterInstance()
Return JSON-P stream writer.static MessageBodyReader<JsonStructure>
reader()
Return a default JSON-P entity reader.static MessageBodyReader<JsonStructure>
reader(JsonReaderFactory readerFactory)
Create a new JSON-P entity reader based onJsonReaderFactory
.MessageBodyReader<JsonStructure>
readerInstance()
Return JSON-P reader instance.Collection<MessageBodyReader<?>>
readers()
Returns the collection of the readers which should be registered.static MessageBodyStreamWriter<JsonStructure>
streamWriter()
Return a default JSON-P entity stream writer.static MessageBodyStreamWriter<JsonStructure>
streamWriter(JsonWriterFactory writerFactory)
Create a new JSON-P entity stream writer based onJsonWriterFactory
.MessageBodyStreamWriter<JsonStructure>
streamWriterInstance()
Return JSON-P stream writer.Collection<MessageBodyStreamWriter<?>>
streamWriters()
Returns the collection of the stream writers which should be registered.static MessageBodyWriter<JsonStructure>
writer()
Return a default JSON-P entity writer.static MessageBodyWriter<JsonStructure>
writer(JsonWriterFactory writerFactory)
Create a new JSON-P entity writer based onJsonWriterFactory
.MessageBodyWriter<JsonStructure>
writerInstance()
Return JSON-P entity writer.Collection<MessageBodyWriter<?>>
writers()
Returns the collection of the writers which should be registered.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.helidon.media.common.MediaSupport
register, streamReaders
-
-
-
-
Method Detail
-
create
public static JsonpSupport create()
Provides a default instance for JSON-P readers and writers.- Returns:
- json processing with default configuration
-
create
public static JsonpSupport create(Map<String,?> jsonPConfig)
Create an instance with the provided JSON-P configuration.- Parameters:
jsonPConfig
- configuration of the processing library- Returns:
- a configured JSON-P instance
-
builder
public static JsonpSupport.Builder builder()
Fluent API builder to create instances of JSON-P.- Returns:
- a new builder instance
-
reader
public static MessageBodyReader<JsonStructure> reader()
Return a default JSON-P entity reader.- Returns:
- default JSON-P body reader instance
-
reader
public static MessageBodyReader<JsonStructure> reader(JsonReaderFactory readerFactory)
Create a new JSON-P entity reader based onJsonReaderFactory
.- Parameters:
readerFactory
- json reader factory- Returns:
- new JSON-P body reader instance
-
writer
public static MessageBodyWriter<JsonStructure> writer()
Return a default JSON-P entity writer.- Returns:
- default JSON-P body writer instance
-
writer
public static MessageBodyWriter<JsonStructure> writer(JsonWriterFactory writerFactory)
Create a new JSON-P entity writer based onJsonWriterFactory
.- Parameters:
writerFactory
- json writer factory- Returns:
- new JSON-P body writer instance
-
streamWriter
public static MessageBodyStreamWriter<JsonStructure> streamWriter()
Return a default JSON-P entity stream writer.- Returns:
- default JSON-P body stream writer instance
-
streamWriter
public static MessageBodyStreamWriter<JsonStructure> streamWriter(JsonWriterFactory writerFactory)
Create a new JSON-P entity stream writer based onJsonWriterFactory
.- Parameters:
writerFactory
- json writer factory- Returns:
- new JSON-P stream body writer instance
-
eventStreamWriter
public static MessageBodyStreamWriter<JsonStructure> eventStreamWriter()
Return a default JSON-P entity event stream writer. This writer is forMediaType.TEXT_EVENT_STREAM
content type.- Returns:
- new JSON-P body stream writer instance
-
eventStreamWriter
public static MessageBodyStreamWriter<JsonStructure> eventStreamWriter(JsonWriterFactory writerFactory)
Create a new JSON-P entity stream writer based onJsonWriterFactory
instance. This writer is forMediaType.TEXT_EVENT_STREAM
content type.- Parameters:
writerFactory
- json writer factory- Returns:
- new JSON-P body stream writer instance
-
ndJsonStreamWriter
public static MessageBodyStreamWriter<JsonStructure> ndJsonStreamWriter()
Return a default JSON-P entity event stream writer. This writer is forMediaType.APPLICATION_X_NDJSON
content type.- Returns:
- new JSON-P body stream writer instance
-
ndJsonStreamWriter
public static MessageBodyStreamWriter<JsonStructure> ndJsonStreamWriter(JsonWriterFactory writerFactory)
Create a new JSON-P entity stream writer based onJsonWriterFactory
instance. This writer is forMediaType.APPLICATION_X_NDJSON
content type.- Parameters:
writerFactory
- json writer factory- Returns:
- new JSON-P body stream writer instance
-
readerInstance
public MessageBodyReader<JsonStructure> readerInstance()
Return JSON-P reader instance.- Returns:
- JSON-P reader instance
-
writerInstance
public MessageBodyWriter<JsonStructure> writerInstance()
Return JSON-P entity writer.- Returns:
- JSON-P writer instance
-
streamWriterInstance
public MessageBodyStreamWriter<JsonStructure> streamWriterInstance()
Return JSON-P stream writer.This stream writer supports
publishers
ofJsonStructure
(such asJsonObject
), writing them as an array of JSONs.- Returns:
- JSON processing stream writer.
-
eventStreamWriterInstance
public MessageBodyStreamWriter<JsonStructure> eventStreamWriterInstance()
Return JSON-P stream writer.This stream writer supports
publishers
ofJsonStructure
(such asJsonObject
), writing them as separate entries in the following format:
This writer is fordata: {"json":"data"}\n \n data: {"json2":"data2"}\n \n
MediaType.TEXT_EVENT_STREAM
content type.- Returns:
- JSON processing stream writer.
-
ndJsonStreamWriterInstance
public MessageBodyStreamWriter<JsonStructure> ndJsonStreamWriterInstance()
Return JSON-P stream writer.This stream writer supports
publishers
ofJsonStructure
(such asJsonObject
), writing them as separate entries in the following format:
This writer is for{"json":"data"}\n {"json2":"data2"}
MediaType.APPLICATION_X_NDJSON
content type.- Returns:
- JSON processing stream writer.
-
readers
public Collection<MessageBodyReader<?>> readers()
Description copied from interface:MediaSupport
Returns the collection of the readers which should be registered.- Specified by:
readers
in interfaceMediaSupport
- Returns:
- readers
-
writers
public Collection<MessageBodyWriter<?>> writers()
Description copied from interface:MediaSupport
Returns the collection of the writers which should be registered.- Specified by:
writers
in interfaceMediaSupport
- Returns:
- writers
-
streamWriters
public Collection<MessageBodyStreamWriter<?>> streamWriters()
Description copied from interface:MediaSupport
Returns the collection of the stream writers which should be registered.- Specified by:
streamWriters
in interfaceMediaSupport
- Returns:
- stream writers
-
-