dev@jsr311.java.net

Re: JSR311: URI based conneg

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 15 Apr 2008 14:45:31 +0200

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.

> best regards
> Stephan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jsr311.dev.java.net
> For additional commands, e-mail: dev-help_at_jsr311.dev.java.net
>

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109