camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pauleftis <p...@eftis.com>
Subject Very odd......is this a bug with camel rest servlet???
Date Sat, 20 Aug 2016 22:05:51 GMT
I am using camel rest (camel version 2.15.0, running on tomcat 7) with the
camel servlet component to implement a number of rest services.  The GET
implementations which have no request body/all parameters passed in url are
working perfect.  However, when I add the below two POST/PUT based rest
services, which each take a different request body object specified within
the .type(...), the camel rest servlet passes in the SAME request body for
both requests even though the requests have two different body objects???
Below is the route, which specifies that PUT /v2.0/compensation/intenttofile
takes an IntentToFileRequest object as input from the http request body, and
POST /v2.0/compensation/5103waiver takes a VeteranTraits object.  Both
routes just go to RestSubmitRequestTransformer which just dumps the input
camel exchange message (the dumps are below).  The message dumps show that
when I call either of the two services, the camel rest servlet is mistakenly
setting the input object as a VeteranTraits in both cases (i.e. when I call
the /intenttofile with an IntentToFile json object set on the body, camel
rest servlet has a VeteranTraits object on the body of the exchange in
message)????  Even stranger, if I reverse the order of the two (i.e. the
/5103waiver is first and the /intenttofile is second, the same thing
happens, but in this case, I get an IntentToFileRequest object on the body
of both of the exchange in messages (seems like whatever is the very last
one in the route is what is set on all).
        
public class ClaimsSubmissionRoute extends RouteBuilder  {	
    @Override
    public void configure(){
       
restConfiguration().component(SERVLET).bindingMode(RestBindingMode.json)
                .dataFormatProperty(PRETTYPRINT, TRUE);
        
        rest("/v2.0/compensation")
           .consumes(JSON).produces(JSON)
           .put("/intenttofile")
                .enableCORS(true)
                .type(IntentToFileRequest.class)
                .to("direct:submitprocessor")
           .post("/5103waiver")
                .enableCORS(true)
                .type(VeteranTraits.class)
                .to("direct:submitprocessor");
        
        from("direct:submitprocessor")
            .bean(new RestSubmitRequestTransformer());
    }
}

2016-08-20 17:58:52,156 [http-apr-8080-exec-12] INFO 
gov.va.evss.dataservice.common.transform.request.RestSubmitRequestTransformer
- RestSubmitRequestTransformer process in exchange dump=<message
exchangeId="ID-DESKTOP-J68JI09-65218-1471730290197-0-2">
  <headers>
    <header key="CamelHttpMethod" type="java.lang.String">PUT</header>
    <header key="CamelHttpPath" type="java.lang.String"></header>
    <header key="CamelHttpQuery"></header>
    <header key="CamelHttpServletRequest"
type="org.apache.catalina.connector.RequestFacade">org.apache.catalina.connector.RequestFacade@ab35a9d</header>
    <header key="CamelHttpServletResponse"
type="org.apache.catalina.connector.ResponseFacade">org.apache.catalina.connector.ResponseFacade@562c162c</header>
    <header key="CamelHttpUri"
type="java.lang.String">/evss/dataservice/v2.0/compensation/intenttofile</header>
    <header key="CamelHttpUrl"
type="java.lang.String">http://localhost:8080/evss/dataservice/v2.0/compensation/intenttofile</header>
    <header key="CamelServletContextPath"
type="java.lang.String">/v2.0/compensation/intenttofile</header>
    <header key="Content-Type"
type="java.lang.String">application/json</header>
    <header key="accept" type="java.lang.String">application/json</header>
    <header key="accept-encoding" type="java.lang.String">gzip,
deflate</header>
    <header key="accept-language"
type="java.lang.String">en-US,en;q=0.5</header>
    <header key="breadcrumbId"
type="java.lang.String">ID-DESKTOP-J68JI09-65218-1471730290197-0-1</header>
    <header key="connection" type="java.lang.String">keep-alive</header>
    <header key="content-length" type="java.lang.String">83</header>
    <header key="cookie"
type="java.lang.String">JSESSIONID=4A9192EBB43769F0BEFB95FC0B1667FE;
JSESSIONID=DF186703371576FC602B3DC259DE2FE8</header>
    <header key="host" type="java.lang.String">localhost:8080</header>
    <header key="referer"
type="java.lang.String">http://localhost:8080/evss/evss-docs/</header>
    <header key="user-agent" type="java.lang.String">Mozilla/5.0 (Windows NT
10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0</header>
  </headers>
  <body
type="gov.va.evss.dataservice.model.request.VeteranTraits">gov.va.evss.dataservice.model.request.VeteranTraits@11df2dd2</body>
</message>

2016-08-20 18:00:57,403 [http-apr-8080-exec-25] INFO 
gov.va.evss.dataservice.common.transform.request.RestSubmitRequestTransformer
- RestSubmitRequestTransformer process in exchange dump=<message
exchangeId="ID-DESKTOP-J68JI09-65218-1471730290197-0-4">
  <headers>
    <header key="CamelHttpMethod" type="java.lang.String">POST</header>
    <header key="CamelHttpPath" type="java.lang.String"></header>
    <header key="CamelHttpQuery"></header>
    <header key="CamelHttpServletRequest"
type="org.apache.catalina.connector.RequestFacade">org.apache.catalina.connector.RequestFacade@2e6a2120</header>
    <header key="CamelHttpServletResponse"
type="org.apache.catalina.connector.ResponseFacade">org.apache.catalina.connector.ResponseFacade@49d77fa5</header>
    <header key="CamelHttpUri"
type="java.lang.String">/evss/dataservice/v2.0/compensation/5103waiver</header>
    <header key="CamelHttpUrl"
type="java.lang.String">http://localhost:8080/evss/dataservice/v2.0/compensation/5103waiver</header>
    <header key="CamelServletContextPath"
type="java.lang.String">/v2.0/compensation/5103waiver</header>
    <header key="Content-Type"
type="java.lang.String">application/json</header>
    <header key="accept" type="java.lang.String">application/json</header>
    <header key="accept-encoding" type="java.lang.String">gzip,
deflate</header>
    <header key="accept-language"
type="java.lang.String">en-US,en;q=0.5</header>
    <header key="breadcrumbId"
type="java.lang.String">ID-DESKTOP-J68JI09-65218-1471730290197-0-3</header>
    <header key="connection" type="java.lang.String">keep-alive</header>
    <header key="content-length" type="java.lang.String">193</header>
    <header key="cookie"
type="java.lang.String">JSESSIONID=4A9192EBB43769F0BEFB95FC0B1667FE;
JSESSIONID=DF186703371576FC602B3DC259DE2FE8</header>
    <header key="host" type="java.lang.String">localhost:8080</header>
    <header key="referer"
type="java.lang.String">http://localhost:8080/evss/evss-docs/</header>
    <header key="user-agent" type="java.lang.String">Mozilla/5.0 (Windows NT
10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0</header>
  </headers>
  <body
type="gov.va.evss.dataservice.model.request.VeteranTraits">gov.va.evss.dataservice.model.request.VeteranTraits@6c2671b9</body>
</message>

Has anyone ever seen this before or have any idea what the issue
is.......perhaps a bug???



--
View this message in context: http://camel.465427.n5.nabble.com/Very-odd-is-this-a-bug-with-camel-rest-servlet-tp5786677.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message