Not out in the field yet but I'm thinking that user agent strings may
not be the only "helpful" header.

Performance wise, this shouldn't be a penalty as I believe the request
headers are cached after reading once so calling HttpHeaders for the
User-Agent repeatedly in the methods shouldn't hurt.

On Thu, Sep 24, 2009 at 3:34 AM, Baram, Eliezer <[email protected]> wrote:
> Sounds good, it makes it more generic. I'm curious did you run into a use 
> case that need this?
>
> -----Original Message-----
> From: Bryant Luk [mailto:[email protected]]
> Sent: Thursday, September 24, 2009 5:33 AM
> To: [email protected]
> Subject: [DISCUSS] MediaTypeMapper changes
>
> Hi,
>
> I would like to propose changes to MediaTypeMapper.
>
> First, I think we should make it externally configurable as right now,
> it's internal.
>
> Second, I was hoping to change the interface slightly for determining
> if there's a match.  Basically, allow the media type mapper to work
> with any incoming request headers instead of just user-agents.
>
> In MediaTypeMapper:
>
> public MediaType mapOutputMediaType(MediaType responseMediaType,
> String userAgent)
>
> would change to:
>
> public MediaType mapOutputMediaType(MediaType responseMediaType,
> HttpHeaders requestHeaders)
>
> and:
>
> In MappingRecord:
>        boolean match(String userAgent, MediaType responseMediaType);
> would change to:
>        boolean match(HttpHeaders requestHeaders, MediaType responseMediaType);
>
> I imagine a future use case may be that the user agent header may not
> be the only header that has to be taken into consideration and maybe a
> user agent match can't be done with just a starting with.
>
> Thoughts?
>
> --
>
> - Bryant Luk
>



-- 

- Bryant Luk

Reply via email to