camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jay mann (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CAMEL-9611) Restlet GET request should not trying to stringify the exchange body
Date Wed, 17 Feb 2016 14:29:18 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-9611?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jay mann updated CAMEL-9611:
----------------------------
    Description: 
When sending a restlet GET request, the body should not be looked at at all.  

Currently In my exchange i have a java object in the body, and i send a restlet GET request,
i expect the restlet response to replace whatever is in the body.  But i get a type conversion
error because it is trying to stringify the java object before sending the get request.

I think the body should only be used in PUT and POST request.

Here is the fix in org.apache.camel.component.restlet.DefaultRestletBinding.java:

   public void populateRestletRequestFromExchange(Request request, Exchange exchange) {
        request.setReferrerRef("camel-restlet");
        String body = null;
        if(request.getMethod() == Method.POST || request.getMethod() == Method.PUT)
        {
        	body = exchange.getIn().getBody(String.class);
    	}
        Form form = new Form();
        // add the body as the key in the form with null value
        form.add(body, null);


  was:
When sending a restlet GET request, the body should not be looked at at all.  

Currently In my code i have a java object in the body, and i send a GET request, i expect
the restlet response to replace whatever is in the body.  But i get a type conversion error
because it is trying to stringify the java object before sending the get request.

I think the body should only be used in PUT and POST request.

Here is the fix in org.apache.camel.component.restlet.DefaultRestletBinding.java:

   public void populateRestletRequestFromExchange(Request request, Exchange exchange) {
        request.setReferrerRef("camel-restlet");
        String body = null;
        if(request.getMethod() == Method.POST || request.getMethod() == Method.PUT)
        {
        	body = exchange.getIn().getBody(String.class);
    	}
        Form form = new Form();
        // add the body as the key in the form with null value
        form.add(body, null);



> Restlet GET request should not trying to stringify the exchange body
> --------------------------------------------------------------------
>
>                 Key: CAMEL-9611
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9611
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-restlet
>    Affects Versions: 2.16.2
>            Reporter: Jay mann
>            Priority: Minor
>
> When sending a restlet GET request, the body should not be looked at at all.  
> Currently In my exchange i have a java object in the body, and i send a restlet GET request,
i expect the restlet response to replace whatever is in the body.  But i get a type conversion
error because it is trying to stringify the java object before sending the get request.
> I think the body should only be used in PUT and POST request.
> Here is the fix in org.apache.camel.component.restlet.DefaultRestletBinding.java:
>    public void populateRestletRequestFromExchange(Request request, Exchange exchange)
{
>         request.setReferrerRef("camel-restlet");
>         String body = null;
>         if(request.getMethod() == Method.POST || request.getMethod() == Method.PUT)
>         {
>         	body = exchange.getIn().getBody(String.class);
>     	}
>         Form form = new Form();
>         // add the body as the key in the form with null value
>         form.add(body, null);



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message