[
https://issues.jboss.org/browse/WFLY-10616?page=com.atlassian.jira.plugin...
]
R Searls commented on WFLY-10616:
---------------------------------
There was a code change between wfly-12 and wfly-13 in order to be compliant
with the jax-rs 2.1 specification. *This is not a bug*. Resteasy provides
a means to designate use of Jackson in liu of JSON-P.
Here is the documentation provided in the Resteasy's doc, chapter, "JAX-RS 2.1
Additions".
{code:java}
RESTEasy supports both JSON-B and JSON-P. In accordance with the specification,
entity providers for JSON-B take precedence over those for JSON-P for all types
except JsonValue and its sub-types.
The support for JSON-B is provided by the JsonBindingProvider from
resteasy-json-binding-provider module.
To satisfy JAX-RS 2.1 requirements, JsonBindingProvider takes precedence over the other
providers for dealing with JSON payloads,
in particular the Jackson one. The JSON outputs (for the same input) from Jackson and
JSON-B reference implementation can be slightly
different. As a consequence, in order to allow retaining backward compatibility, RESTEasy
offers a resteasy.preferJacksonOverJsonB context property that can be set to true to
disable JsonBindingProvider for the current deloyment.
WildFly 14 supports specifying the default value for the resteasy.preferJacksonOverJsonB
context property by setting a system property with the same name. Moreover, if no value is
set for the context and system properties, it scans JAX-RS deployments
for Jackson annotations and sets the property to true if any of those annotations is
found.
{code}
I used the following cmd to set the flag
{code:java}
./bin/standalone.sh -Dresteasy.preferJacksonOverJsonB=true
{code}
Alternatively you can provide a web.xml file with the flag.
{code:java}
<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<context-param>
<param-name>resteasy.preferJacksonOverJsonB</param-name>
<param-value>true</param-value>
</context-param>
</web-app>
{code}
ContextResolver doesn't work
----------------------------
Key: WFLY-10616
URL:
https://issues.jboss.org/browse/WFLY-10616
Project: WildFly
Issue Type: Bug
Components: REST
Affects Versions: 13.0.0.Final
Reporter: George Trudeau
Assignee: R Searls
Fix For: 14.0.0.CR1
Attachments: test.war
I have a simple ContextResolver to set Date serialization format for my JAX-RS service,
it works on 12.0.0.Final but it doesn't anymore on 13.0.0.Final :
{code:java}
@Provider
public class DateResolver implements ContextResolver<ObjectMapper>
{
private final ObjectMapper mapper;
public DateResolver()
{
mapper = new ObjectMapper();
mapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd"));
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
}
@Override
public ObjectMapper getContext(Class<?> type) { return mapper; }
}
{code}
The {{getContext}} method isn't called on 13.0.0.Final.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)