camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From " Ramu kakarla (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CAMEL-11622) Rest-dsl doesn't support post() endpoints with different request body types
Date Wed, 02 Aug 2017 05:38:00 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-11622?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16110291#comment-16110291
] 

 Ramu kakarla edited comment on CAMEL-11622 at 8/2/17 5:37 AM:
---------------------------------------------------------------

looking into it,could you please add a simple test case 


was (Author: kramu.k7):
looking into it

> Rest-dsl doesn't support post() endpoints with different request body types
> ---------------------------------------------------------------------------
>
>                 Key: CAMEL-11622
>                 URL: https://issues.apache.org/jira/browse/CAMEL-11622
>             Project: Camel
>          Issue Type: Bug
>          Components: rest
>    Affects Versions: 2.18.1
>         Environment: Spring-Boot with Tomcat8 container
>            Reporter: Balazs Szeti
>
> The rest-dsl doesn't support two post() endpoints with different request body types.
> {code:java}
> restConfiguration()
>   .component("servlet")
>   .contextPath("/api")
>   .bindingMode(RestBindingMode.json)
> ;
> rest("/user")
>   .post("/").type(UserPojo.class)
>       .route()
>       .log("Name: ${body.name}")
>       .endRest()
> ;
> rest("/country")
>   .post("/").type(CountryPojo.class)
>       .route()
>       .log("Name: ${body.country}")
>       .endRest()
> ;
> {code}
> Both endpoints (/api/user, /api/country) tries to unmarshal the post body to CountryPojo
and a JsonProcessingException is thrown when a UserPojo json is sent to /user.
> The problem is that they share one JascksonDataFormat instance registered with name "json-jackson"
and the RestDefinition.type() sets the JascksonDataFormat.unmarshalType so at the end both
post() endpoints will try to unmarshal to the same class.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message