Hi Colm,
I found the reason why PrimitiveTextProvider wasn't matching with
"/state1/".
I have to set *@Produces({"text/plain"})*, by default it's "text/html"
if nothing is specified and in this case MediaType doesn't match.
@POST
@Path("/state1/")
@Produces({"text/plain"})
public int getStateBatchResultREST1(@QueryParam("uid") String
szIDDataSource);
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.TEXT_PLAIN)
public class PrimitiveTextProvider<T> extends AbstractConfigurableProvider
...
"/state0/" seems to match with StringTextProvider with all MediaType.
Criteria : return value String
It was an interesting journey :-)
Thanks,
Bertrand
Le 17/09/2018 à 11:23, Colm O hEigeartaigh a écrit :
Could you create a JIRA (https://issues.apache.org/jira/projects/CXF)
+ attach a sample test-case to reproduce the problem?
Colm.
On Fri, Sep 14, 2018 at 5:27 PM Bertrand TROLARD
<bertrand.trol...@erdil.fr <mailto:bertrand.trol...@erdil.fr>> wrote:
Hi,
For the problem with the runtime, Eclipse was configured to use
JVM 1.6 by default, it's Ok now with JVM 1.8.
The same function on the web-service but the return valeu is a
String instead of an int and it works.
@POST
@Path("/state0/")
public *String *getStateBatchResultREST(@QueryParam("uid")
String szIDDataSource);
>>> OK
@POST
@Path("/state1/")
public*int* getStateBatchResultREST1(@QueryParam("uid") String
szIDDataSource);
>>>> KO
Address:
http://localhost:8080/ErdilTestCXF/services2/asynchrone/state1?uid=45218725
Encoding: ISO-8859-1
Http-Method: POST
Content-Type:
Headers: {Accept=[text/html, image/gif, image/jpeg, *; q=.2, */*;
q=.2], connection=[keep-alive], Content-Type=[null],
host=[localhost:8080], user-agent=[Java/1.8.0_181]}
--------------------------------------
sept. 14, 2018 6:10:48 PM getStateBatchResult
sept. 14, 2018 6:10:48 PM org.apache.cxf.jaxrs.utils.JAXRSUtils
logMessageHandlerProblem
GRAVE: No message body writer has been found for class
java.lang.Integer, ContentType: text/html
I have the same result with CXF 3.2.6
Thanks,
Bertrand
Le 14/09/2018 à 17:34, Colm O hEigeartaigh a écrit :
Could you test it with one of the latest releases (CXF 3.2.6 / 3.1.16) in
case it's a bug that has been subsequently fixed?
Colm.
On Fri, Sep 14, 2018 at 3:06 PM Bertrand TROLARD<bertrand.trol...@erdil.fr>
<mailto:bertrand.trol...@erdil.fr>
wrote:
Hi,
I got a problem with a REST service when I use CXF 3.x, it's working
fine with CXF 2.7.
"No message body writer has been found for class java.lang.Integer"
Response-Code: 500
Content-Type: text/plain
Headers: {Content-Type=[plain/text], Date=[Fri, 14 Sep 2018 13:41:18 GMT]}
Payload: No message body writer has been found for class
java.lang.Integer, ContentType: plain/text
I got this error with this function :
@POST
@Path("/state/")
public int getStateBatchResult(@QueryParam("uid") String id);
I use SPRING to define the service
<jaxrs:server xmlns:tns="http://www.xxx/AnalyzeRESTService"
<http://www.xxx/AnalyzeRESTService>
id="restServer" address="/asynchrone" serviceName="tns:AnalyzeREST" >
<jaxrs:serviceBeans>
<ref bean="serviceImplCXF"/>
</jaxrs:serviceBeans>
<jaxrs:features>
<bean class="org.apache.cxf.feature.LoggingFeature" />
</jaxrs:features>
<jaxrs:dataBinding>
<bean class="org.apache.cxf.jaxb.JAXBDataBinding"/>
</jaxrs:dataBinding>
</jaxrs:server>
but we have no problem with this one :
@POST
@Path("/result/")
@Produces({"plain/text"})
public DataHandler getBatchResultDH(@QueryParam("uid") String id,
@QueryParam("comp") int typeCompression);
I test it with eclipse, Java 8, CXF 3.1.4 or 3.0.16
Do I miss some dependencies or something else ?
Thanks,
Bertrand
--
Cordialement,
_______________________________
Bertrand TROLARD
Tél. : (+33) (0)3 81 25 29 86
https://www.erdil.fr/ <https://www.erdil.fr>
https://twitter.com/erdil_sa <http://twitter.com/erdil_sa>
<https://www.erdil.fr/>
6, rue Sophie GERMAIN
25000 Besançon
_______________________________________________________________________________________________________________________________________________________________________
Conformément au RGPD
<https://eur-lex.europa.eu/legal-content/FR/TXT/?uri=CELEX:32016R0679>
et aux mentions légales ERDIL
<https://www.erdil.fr/terms-and-conditions>, vous pouvez exercer
vos droits (information, accès, rectification, suppression,
limitation, portabilité) concernant *vos données personnelles* sur
simple demande adressée à : *dpd.rgpd...@erdil.fr
<mailto:dpd.rgpd...@erdil.fr>*
_______________________________________________________________________________________________________________________________________________________________________
--
Colm O hEigeartaigh
Talend Community Coder
http://coders.talend.com
--
Cordialement,
_______________________________
Bertrand TROLARD
Tél. : (+33) (0)3 81 25 29 86
https://www.erdil.fr/ <https://www.erdil.fr>
https://twitter.com/erdil_sa <http://twitter.com/erdil_sa>
<https://www.erdil.fr/>
6, rue Sophie GERMAIN
25000 Besançon
_______________________________________________________________________________________________________________________________________________________________________
Conformément au RGPD
<https://eur-lex.europa.eu/legal-content/FR/TXT/?uri=CELEX:32016R0679>
et aux mentions légales ERDIL
<https://www.erdil.fr/terms-and-conditions>, vous pouvez exercer vos
droits (information, accès, rectification, suppression,
limitation, portabilité) concernant *vos données personnelles* sur
simple demande adressée à : *dpd.rgpd...@erdil.fr*
_______________________________________________________________________________________________________________________________________________________________________