dev@jsr311.java.net

Re: JSR311: URI based conneg

From: Stephan Koops <Stephan.Koops_at_web.de>
Date: Tue, 15 Apr 2008 15:48:19 +0200

+1

but little bug on point 4: set Accept-LANGUAGE

Stephan

Paul Sandoz schrieb:
> Stephan Koops wrote:
>> Hi,
>>
>> at the beginning of the idea, I though the idea of mapping
>> ../foo.en.bar.xml to ../foo.bar Accept: application/xml and
>> Accept-Language: en good.
>> But now I think it is useful to start at the end with mapping and
>> stop with extension mapping, if no corresponding entry in the
>> language and media type Maps was found.
>>
>> If I remember right, Paul thought the same.
>>
>
> Yes. It is a little bit more complicated but we could do something
> like this:
>
> 1) Obtain the list of extensions in the last path segment of the request
>
> 2) Iterate from right to left through the list of extensions
>
> 2.1) If both the media type (see 2.2) and lang (see 2.3) are set
> goto 3).
>
> 2.2) Otherwise, if the media type has not been set and the
> current extension is a member of the configured media type
> extensions, then the media type is set from the extensions,
> goto 2)
>
> 2.3) Otherwise, if the lang has not been set and the current
> extension is a member of the configured lang extensions, then
> the lang is set from the extensions,
> goto 2)
>
> 2.4) Otherwise, if the current extension is not a member of the
> configured media type or lang extensions goto 3.
>
> 3) If the media type is set remove the corresponding extension from
> the path. Set the Accept header.
>
> 4) If the lang type is set remove the corresponding extension from
> the path. Set the Accept-Charset header.
>
> Paul.