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

Andres updated CAMEL-1760:
--------------------------

    Description: 
If consuming messsages from jetty endpoint there is no way to read *post* 
parameters from HttpServletRequest. 

In example  getting HttpServletRequest  from body :
HttpServletRequest req = exchange.getIn().getBody(HttpServletRequest.class);

req.getParameterMap() returns allways empty map

The problem is that jetty Request.extractParameters() method is trying  to read 
post parameters from Request.getInputStream().  But unfortunately someone 
strips the input stream before and req.getInputStream() returns allways 0 bytes

The workaround for me is to extend DefaultHttpBinding as described in:  
http://camel.apache.org/jetty.html

{code:title= MyHttpBinding .java|borderStyle=solid}
public class MyHttpBinding extends DefaultHttpBinding {
    
    public void readRequest(HttpServletRequest request, HttpMessage message) {
       request.getParameterMap();
       super.readRequest(request,message);
    }
}
{code}
calling  request.getParameterMap()  will cache parameters inside jetty Request 
and it's possible to query params later,  without having inputStream



  was:
If consuming messsages from jetty endpoint there is now way to read *post* 
parameters from HttpServletRequest. 

In example  getting HttpServletRequest  from body :
HttpServletRequest req = exchange.getIn().getBody(HttpServletRequest.class);

req.getParameterMap() returns allways empty map

The problem is that jetty Request.extractParameters() method is trying  to read 
post parameters from Request.getInputStream().  But unfortunately someone 
strips the input stream before and req.getInputStream() returns allways 0 bytes

The workaround for me is to extend DefaultHttpBinding as described in:  
http://camel.apache.org/jetty.html

{code:title= MyHttpBinding .java|borderStyle=solid}
public class MyHttpBinding extends DefaultHttpBinding {
    
    public void readRequest(HttpServletRequest request, HttpMessage message) {
       request.getParameterMap();
       super.readRequest(request,message);
    }
}
{code}
calling  request.getParameterMap()  will cache parameters inside jetty Request 
and it's possible to query params later,  without having inputStream




> Unable to read post params from request
> ---------------------------------------
>
>                 Key: CAMEL-1760
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1760
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-jetty
>    Affects Versions: 1.6.0
>            Reporter: Andres
>
> If consuming messsages from jetty endpoint there is no way to read *post* 
> parameters from HttpServletRequest. 
> In example  getting HttpServletRequest  from body :
> HttpServletRequest req = exchange.getIn().getBody(HttpServletRequest.class);
> req.getParameterMap() returns allways empty map
> The problem is that jetty Request.extractParameters() method is trying  to 
> read post parameters from Request.getInputStream().  But unfortunately 
> someone strips the input stream before and req.getInputStream() returns 
> allways 0 bytes
> The workaround for me is to extend DefaultHttpBinding as described in:  
> http://camel.apache.org/jetty.html
> {code:title= MyHttpBinding .java|borderStyle=solid}
> public class MyHttpBinding extends DefaultHttpBinding {
>     
>     public void readRequest(HttpServletRequest request, HttpMessage message) {
>        request.getParameterMap();
>        super.readRequest(request,message);
>     }
> }
> {code}
> calling  request.getParameterMap()  will cache parameters inside jetty 
> Request and it's possible to query params later,  without having inputStream

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to