You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by David White <da...@mindreef.com> on 2008/03/07 01:36:47 UTC

Jetty component response code/status line

Hi,

I'm a Camel newbie, but from what I've seen so far it looks like a fantastic
framework and a great addition to the old toolbox!  I've been trying to
create a simple flow between a Jetty consumer endpoint and a Http producer
endpoint to provide a rudimentary proxying capability.  I setup a simple
flow like this:

from("jetty:http://...").to("http://...")

This works, but I've seen that the response code that comes back from Jetty
is always 200 even if what comes back from the Http producer is something
else (i.e. 500, 404, etc.).  In looking at the source it looks like
HttpBinding.writeResponse could call setStatus and/or sendError to send back
non 200 Ok responses.  The status code (I think) could be checked with the
http.responseCode header if present.  Similarly, could the HttpProducer also
set StatusLine information (i.e. httpVersion, statusCode, reasonPhrase)
headers so that the HttpBinding could set these in the response?

Any insight on this would be great.  Also, thanks again for such a great
framework!

Dave
--

Re: Jetty component response code/status line

Posted by James Strachan <ja...@gmail.com>.
On 07/03/2008, dtabwhite <da...@mindreef.com> wrote:
>
>  I'll take a crack at it...

Awesome! :)

>
>
>
>  James.Strachan wrote:
>  >
>  > On 07/03/2008, David White <da...@mindreef.com> wrote:
>  >> Hi,
>  >>
>  >>  I'm a Camel newbie, but from what I've seen so far it looks like a
>  >> fantastic
>  >>  framework and a great addition to the old toolbox!  I've been trying to
>  >>  create a simple flow between a Jetty consumer endpoint and a Http
>  >> producer
>  >>  endpoint to provide a rudimentary proxying capability.  I setup a simple
>  >>  flow like this:
>  >>
>  >>  from("jetty:http://...").to("http://...")
>  >>
>  >>  This works, but I've seen that the response code that comes back from
>  >> Jetty
>  >>  is always 200 even if what comes back from the Http producer is
>  >> something
>  >>  else (i.e. 500, 404, etc.).  In looking at the source it looks like
>  >>  HttpBinding.writeResponse could call setStatus and/or sendError to send
>  >> back
>  >>  non 200 Ok responses.  The status code (I think) could be checked with
>  >> the
>  >>  http.responseCode header if present.  Similarly, could the HttpProducer
>  >> also
>  >>  set StatusLine information (i.e. httpVersion, statusCode, reasonPhrase)
>  >>  headers so that the HttpBinding could set these in the response?
>  >
>  > Definitely, thats a great idea. It'd also mean that the routing rules
>  > could customize the status codes too if you wanted to change what the
>  > http endpoint returns.
>  >
>  > We love contributions:
>  > http://activemq.apache.org/camel/contributing.html
>  >
>  > do you fancy taking a stab at a patch to fix this use case?
>  >
>  >
>  >>  Any insight on this would be great.  Also, thanks again for such a great
>  >>  framework!
>  >
>  > You're most welcome! :)
>  >
>  > --
>  > James
>  > -------
>  > http://macstrac.blogspot.com/
>  >
>  > Open Source Integration
>  > http://open.iona.com
>  >
>  >
>
>
> --
>  View this message in context: http://www.nabble.com/Jetty-component-response-code-status-line-tp15887687s22882p15903938.html
>  Sent from the Camel - Users mailing list archive at Nabble.com.
>
>


-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Re: Jetty component response code/status line

Posted by dtabwhite <da...@mindreef.com>.
I'll take a crack at it...


James.Strachan wrote:
> 
> On 07/03/2008, David White <da...@mindreef.com> wrote:
>> Hi,
>>
>>  I'm a Camel newbie, but from what I've seen so far it looks like a
>> fantastic
>>  framework and a great addition to the old toolbox!  I've been trying to
>>  create a simple flow between a Jetty consumer endpoint and a Http
>> producer
>>  endpoint to provide a rudimentary proxying capability.  I setup a simple
>>  flow like this:
>>
>>  from("jetty:http://...").to("http://...")
>>
>>  This works, but I've seen that the response code that comes back from
>> Jetty
>>  is always 200 even if what comes back from the Http producer is
>> something
>>  else (i.e. 500, 404, etc.).  In looking at the source it looks like
>>  HttpBinding.writeResponse could call setStatus and/or sendError to send
>> back
>>  non 200 Ok responses.  The status code (I think) could be checked with
>> the
>>  http.responseCode header if present.  Similarly, could the HttpProducer
>> also
>>  set StatusLine information (i.e. httpVersion, statusCode, reasonPhrase)
>>  headers so that the HttpBinding could set these in the response?
> 
> Definitely, thats a great idea. It'd also mean that the routing rules
> could customize the status codes too if you wanted to change what the
> http endpoint returns.
> 
> We love contributions:
> http://activemq.apache.org/camel/contributing.html
> 
> do you fancy taking a stab at a patch to fix this use case?
> 
> 
>>  Any insight on this would be great.  Also, thanks again for such a great
>>  framework!
> 
> You're most welcome! :)
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://open.iona.com
> 
> 

-- 
View this message in context: http://www.nabble.com/Jetty-component-response-code-status-line-tp15887687s22882p15903938.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Jetty component response code/status line

Posted by James Strachan <ja...@gmail.com>.
On 07/03/2008, David White <da...@mindreef.com> wrote:
> Hi,
>
>  I'm a Camel newbie, but from what I've seen so far it looks like a fantastic
>  framework and a great addition to the old toolbox!  I've been trying to
>  create a simple flow between a Jetty consumer endpoint and a Http producer
>  endpoint to provide a rudimentary proxying capability.  I setup a simple
>  flow like this:
>
>  from("jetty:http://...").to("http://...")
>
>  This works, but I've seen that the response code that comes back from Jetty
>  is always 200 even if what comes back from the Http producer is something
>  else (i.e. 500, 404, etc.).  In looking at the source it looks like
>  HttpBinding.writeResponse could call setStatus and/or sendError to send back
>  non 200 Ok responses.  The status code (I think) could be checked with the
>  http.responseCode header if present.  Similarly, could the HttpProducer also
>  set StatusLine information (i.e. httpVersion, statusCode, reasonPhrase)
>  headers so that the HttpBinding could set these in the response?

Definitely, thats a great idea. It'd also mean that the routing rules
could customize the status codes too if you wanted to change what the
http endpoint returns.

We love contributions:
http://activemq.apache.org/camel/contributing.html

do you fancy taking a stab at a patch to fix this use case?


>  Any insight on this would be great.  Also, thanks again for such a great
>  framework!

You're most welcome! :)

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com