...
The following example shows how to define a provider with a prototype lifecycle.
Code Block | ||||
---|---|---|---|---|
| ||||
@Scope(ScopeType.PROTOTYPE)
@Provider
public class MyProvider implements MessageBodyReader<String>{
...
}
|
...
The following example shows how to define a provider with a singleton lifecycle.
Code Block | ||||
---|---|---|---|---|
| ||||
@Scope(ScopeType.SINGELTON)
@Provider
public class MyProvider implements MessageBodyReader<String>{
...
}
|
...
The following example shows that when the @Scope annotation is not used, the provider will be a singleton, as per the JAX-RS specification.
Code Block | ||||
---|---|---|---|---|
| ||||
@Provider
public class MyProvider implements MessageBodyReader<String>{
...
}
|
...
| Supported | Media Types | Entity |
---|---|---|---|
Read | No | N/A | N/A |
Write | Yes | application/json , application/javascript | JAXB object, |
JsonSyndEntryProvider
...
Apache Wink provides a special provider that is responsible for reading and writing Asset objects.
Info | ||
---|---|---|
| ||
Refer to chapter 5 TBD for more information on Assets. |
AssetProvider
| Supported | Media Types | Entity |
---|---|---|---|
Read | No | / | POJOs annotated with @Asset annotation. |
Write | Yes | / | POJOs annotated with @Asset annotation.>> |
HTML Providers
Apache Wink provides a set of providers that are capable of serializing a number of data models (SyndEntry, SyndFeed and HtmlDescriptor) as HTML. The following tables list these providers.
HtmlProvider
| Supported | Media Types | Entity |
---|---|---|---|
Read | No | N/A | N/A |
Write | Yes | text/html | HtmlDescriptor |
HtmlSyndEntryProvider
| Supported | Media Types | Entity |
---|---|---|---|
Read | No | N/A | N/A |
Write | Yes | text/html | SyndEntry |
HtmlSyndFeedProvid
| Supported | Media Types | Entity |
---|---|---|---|
Read | No | N/A | N/A |
Write | Yes | text/html | SyndFeed |
CSV Providers
Apache Wink supports the serializing and de-serializing of data as a CSV.
Info | ||
---|---|---|
| ||
Refer to chapter 9, section 9.6 TBD for more information on Comma Separated Values. |
The following tables list the providers that provide this functionality.
CsvSerializerProvider
| Supported | Media Types | Entity |
---|---|---|---|
Read | No | N/A | N/A |
Write | Yes | text/csv | CsvSerializer |
CsvDeserializerProvider
| Supported | Media Types | Entity |
---|---|---|---|
Read | Yes | text/csv | CsvDeserializer |
Write | No | N/A | N/A |