You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by leofprince <le...@gmail.com> on 2014/10/30 01:50:21 UTC

Camel rest-dsl sending 400(Client Error) Status code's

Hello Camel Users,
            I am developing REST services using camel
REST-DSL[http://camel.apache.org/rest-dsl.html]component.I am successful in
sending JSON request for happy path and get the response on the same using
(Rest-DSL and camel servlet) combination. Now as we move forward the client
may sent Rest Service request with not enough values or invalid valid
request ,now I am looking for ways to send 400 Responses from REST DSL in
case where request is not valid,Please advise on the way to achieve this.

I have added the same question in,
http://stackoverflow.com/questions/26631697/camel-rest-dsl-sending-400-status-codes


Thanks!



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-rest-dsl-sending-400-Client-Error-Status-code-s-tp5758320.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel rest-dsl sending 400(Client Error) Status code's

Posted by Dewitte P-Alban <de...@gmail.com>.
Hi,

I am assuming you are doing your check in a custom processor or something
similiar. If you want to send your an HTTP Error code just add the header
Exchange.HTTP_RESPONSE_CODE.

For example : exchange.getIn().setHeader(Exchange.HTTP_RESPONSE_CODE, 204);

Best regards

Pierre-Alban DEWITTE
@__pad__



On Thu, Oct 30, 2014 at 1:50 AM, leofprince <le...@gmail.com> wrote:

> Hello Camel Users,
>             I am developing REST services using camel
> REST-DSL[http://camel.apache.org/rest-dsl.html]component.I am successful
> in
> sending JSON request for happy path and get the response on the same using
> (Rest-DSL and camel servlet) combination. Now as we move forward the client
> may sent Rest Service request with not enough values or invalid valid
> request ,now I am looking for ways to send 400 Responses from REST DSL in
> case where request is not valid,Please advise on the way to achieve this.
>
> I have added the same question in,
>
> http://stackoverflow.com/questions/26631697/camel-rest-dsl-sending-400-status-codes
>
>
> Thanks!
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-rest-dsl-sending-400-Client-Error-Status-code-s-tp5758320.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>