On Nov 24, 2009, at 9:19 PM, Jeanfrancois Arcand wrote:
> Salut,
>
> Paul Sandoz wrote:
>> Hi,
>> Anyone know if Grizzly (adapter and servlet) preserves the order of
>> headers that are added so that they occur on the wire in the same
>> order as they were added?
>
> Yes, it does. Do you see something different?
No. I just verified with curl and it is fine. Looks like
HttpURLConnection is not preserving the order at least when obtaining
the map of headers, so in-bound response logging using the Jersey
client shows headers out of order :-(
> Why do you need the exact order?
>
I am placing trace headers in the response e.g.:
< HTTP/1.1 200 OK
< server: grizzly/1.9.8
< X-Jersey-Trace-001: Root resource classes rule: /helloworld null
< X-Jersey-Trace-002: Right hand path rule: /helloworld null
< X-Jersey-Trace-003: Resource class rule: null
< X-Jersey-Trace-004: HTTP Method rule:
com.sun.jersey.samples.helloworld.resources.HelloWorldResource_at_ddbf6e
< Content-Type: text/plain
< Transfer-Encoding: chunked
< Date: Wed, 25 Nov 2009 08:19:17 GMT
So it is easier to debug the application if something has gone wrong
e.g. why the heck am i getting a 404 instead of a match on my resource
class?
The messages in the above need to be finessed.
I believe such information would be very useful in Atmosphere as well
even for broadcasting (the trace messages do not have to be placed in
the response but could be logged instead for such cases).
Paul.