You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "alaa.abuzaghleh" <al...@eastbay.com> on 2017/01/19 18:16:02 UTC

Validation Empty Body Request In Rest DSL

Hi , 
I am trying to unmarshal JSON request to object I have, everything work fine
if I provide the JSON but I got org.apache.camel.InvalidPayloadException: No
body available of type: java.io.InputStream when I provide empty request
body. Is there anyway in REST DSL allow me to validate the empty request
body before i do the unmarshal and provide the user with suitable error
message.
thank you very much for you help 



--
View this message in context: http://camel.465427.n5.nabble.com/Validation-Empty-Body-Request-In-Rest-DSL-tp5792825.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Validation Empty Body Request In Rest DSL

Posted by souciance <so...@gmail.com>.
Can't you convert the stream to a string and then check? Alternatively does
it not have an available() method to see if there is data to read?

On Thu, Jan 19, 2017 at 9:45 PM, alaa.abuzaghleh [via Camel] <
ml-node+s465427n5792835h48@n5.nabble.com> wrote:

> Thanks for you response, our body type is NettyChannelBufferStreamCache
> (it is a stream) not simple string
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/Validation-Empty-Body-
> Request-In-Rest-DSL-tp5792825p5792835.html
> To start a new topic under Camel - Users, email
> ml-node+s465427n465428h31@n5.nabble.com
> To unsubscribe from Camel - Users, click here
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=c291Y2lhbmNlLmVxZGFtLnJhc2h0aUBnbWFpbC5jb218NDY1NDI4fDE1MzI5MTE2NTY=>
> .
> NAML
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://camel.465427.n5.nabble.com/Validation-Empty-Body-Request-In-Rest-DSL-tp5792825p5792836.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Validation Empty Body Request In Rest DSL

Posted by "alaa.abuzaghleh" <al...@eastbay.com>.
Thanks for you response, our body type is NettyChannelBufferStreamCache (it
is a stream) not simple string



--
View this message in context: http://camel.465427.n5.nabble.com/Validation-Empty-Body-Request-In-Rest-DSL-tp5792825p5792835.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Validation Empty Body Request In Rest DSL

Posted by souciance <so...@gmail.com>.
.when().body().isEqualsTo(")...something like that.

On Thu, Jan 19, 2017 at 7:16 PM, alaa.abuzaghleh [via Camel] <
ml-node+s465427n5792825h38@n5.nabble.com> wrote:

> Hi ,
> I am trying to unmarshal JSON request to object I have, everything work
> fine if I provide the JSON but I got org.apache.camel.InvalidPayloadException:
> No body available of type: java.io.InputStream when I provide empty request
> body. Is there anyway in REST DSL allow me to validate the empty request
> body before i do the unmarshal and provide the user with suitable error
> message.
> thank you very much for you help
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/Validation-Empty-Body-
> Request-In-Rest-DSL-tp5792825.html
> To start a new topic under Camel - Users, email
> ml-node+s465427n465428h31@n5.nabble.com
> To unsubscribe from Camel - Users, click here
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=c291Y2lhbmNlLmVxZGFtLnJhc2h0aUBnbWFpbC5jb218NDY1NDI4fDE1MzI5MTE2NTY=>
> .
> NAML
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://camel.465427.n5.nabble.com/Validation-Empty-Body-Request-In-Rest-DSL-tp5792825p5792832.html
Sent from the Camel - Users mailing list archive at Nabble.com.