users@jsr311.java.net

Re: Case-insensitive Response.getMetadata

From: Sergey Beryozkin <sberyozk_at_progress.com>
Date: Wed, 29 Apr 2009 10:00:43 +0100

Hi,

Would it make sense to actually allow for case-insentive Response.getMetadata() ?

It might make it simpler for MessageBodyWriter providers checking if a given header has been set earlier on in the application code,
without worrying about the case-sensitivity...

Cheers, Sergey


----- Original Message -----
From: "Marc Hadley" <Marc.Hadley_at_Sun.COM>
To: <users_at_jsr311.dev.java.net>
Sent: Tuesday, April 28, 2009 9:14 PM
Subject: Re: Case-insensitive Response.getMetadata


On Apr 28, 2009, at 2:48 PM, Sergey Beryozkin wrote:
>
> I’d like to confirm that MultivaluedMap<String, Object> instance returned by
> Response.getMetadata() is case-insensitive.
>
Its not required to be case-insensitive.

> Ex.
> MultivaluedMap<String, Object> headers = ResponseBuilder.ok().header(“Content-Type”, “text/ xml”).build().getMetadata();
> assertNotNull(headers.getFirst(“content-type”));
>
> Is it correct ?
>
No. Maybe you are assuming it is the same as the map you get from
HttpHeaders.getRequestHeaders which is case insensitive ?

> If yes, then given that Response.getMetadata() is modifiable, what is the value of content type after
>
> headers.putSingle(“content-type”, “application/xml”);
>
> is it
>
> assertEquals(“application/xml”, headers.getFirst(“content-type”));
> assertEquals(“application/xml”, headers.getFirst(“Content-Type”));
>
> ?
>
> Another question :
>
> ResponseBuilder.ok().header(“Content-Type”, “text/ xml”) .header(“content-type”, “text/plain”).build().get(“Content- Type”);
>
> Is it text/xml or text/plain or { text/xml , text/plain} ?
>
The builder isn't required to normalize case either, so I'd expect
text/xml and a malformed response with two content type headers.

Marc.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jsr311.dev.java.net
For additional commands, e-mail: users-help_at_jsr311.dev.java.net