Problem with camel producer and multiple set-cookie headers

954 views
Skip to first unread message

Lauri

unread,
Jan 7, 2011, 8:11:18 AM1/7/11
to Akka User List
Hi,

I have a service (A) that integrates to another service (B) using
camel producer. Http is used between the services. When B sends a
response to A, it might set a couple of cookies using set-cookie
header. However, A is only able to see at most one of the set-cookie
headers and the rest of them are being lost.

Akka.camel.Message has header map, which maps one header to one value.
So, using this interface it is impossible to have multiple values for
a header. Looks like Camel also has the same limitation in
org.apace.camel.Message. So, I cannot come up with any easy workaround
for this issue. Does anyone else have any ideas what could be done?

Best,
Lauri

Martin Krasser

unread,
Jan 7, 2011, 9:01:29 AM1/7/11
to akka...@googlegroups.com
Hi Lauri,

please ask your question on the Camel mailing list.

The akka-camel module doesn't do anything special regarding cookie
handling. I'm also not sure if setting multiple cookies in the HTTP
response is currently possible with the Camel Jetty component (at least
I couldn't find special cookie handling code when looking at the Camel
sources).

Should it be possible with Camel (either now or after a fix in the Camel
Jetty component) then it will work out-of-the box with akka-camel.

Am 07.01.11 14:11, schrieb Lauri:

--
Martin Krasser

blog: http://krasserm.blogspot.com
code: http://github.com/krasserm
twitter: http://twitter.com/mrt1nz

Lauri Fjällström

unread,
Jan 7, 2011, 9:17:44 AM1/7/11
to akka...@googlegroups.com
Hi Martin,

Thanks for the reply. I'll ask this in Camel mailing lists.

The service B does not use Camel Jetty. It is just an external web server that correctly sets multiple cookies. The headers will get lost somewhere in serviceA.

Lauri



--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.


Martin Krasser

unread,
Jan 7, 2011, 10:51:57 AM1/7/11
to akka...@googlegroups.com
Ah ok. Anyway, Camel should support this on the server-side with the Jetty component and on the client-side with the HTTP component.

Cheers,
Martin

Am 07.01.11 15:17, schrieb Lauri Fjällström:

Lauri Fjällström

unread,
Jan 8, 2011, 8:15:15 AM1/8/11
to akka...@googlegroups.com
Hi,

There is actually a limitation in current version of Camel: http://camel.465427.n5.nabble.com/Camel-http-and-multiple-Set-Cookie-headers-td3332393.html

Regards,
Lauri

Martin Krasser

unread,
Jan 9, 2011, 3:29:20 AM1/9/11
to akka...@googlegroups.com
Until this issue is fixed in Camel you can subclass org.apache.camel.component.http.DefaultHttpBinding, override doWriteResponse (or a related method) and add the headers you want on the HttpServletResponse (e.g. by reading multiple cookies from a Camel message header of your choice and process them in that subclass). You can configure camel-http to use your custom HTTP binding class either on endpoint-level or on component-level (see httpBinding option in http://camel.apache.org/http.html)

Am 08.01.11 14:15, schrieb Lauri Fjällström:
Reply all
Reply to author
Forward
0 new messages