Need to agree on what Request.selectVariant() should do
-------------------------------------------------------

                 Key: WINK-107
                 URL: https://issues.apache.org/jira/browse/WINK-107
             Project: Wink
          Issue Type: Bug
          Components: Server
    Affects Versions: 0.1
            Reporter: Bryant Luk


I would like to discuss what Request.selectVariant() is suppose to do and use 
this issue as a fix if necessary. Originally, the IBM implementation of 
Request.selectVariant() was implemented very similar to the way that Wink 
currently has now.  However, I later changed the implementation to be "a big 
mess".

For the current implementation in SVN, I don't understand why you would iterate 
over the List<Variant> when you could just easily create the Request version of 
the variant (Content-Type, Content-Language, etc.) by doing new Variant() and 
using the HttpHeaders interface to fill in the constructor parameters.

A better use of selectVariant() is to choose the best possible response Variant 
IMO.  Also, the method is suppose to modify the Vary header after being called 
according to JavaDoc and when I look at the Vary header in specs, it always 
mentions adding the Accept* headers.

Basically, I tried implementing a selectVariant() method that would choose the 
best variant based on the incoming request's Accept* headers (given a list of 
possible *response* variants),  A somewhat simple use case in my variation is 
that you have a @Produces("*/*") on the method and your output can be in XML, 
plain text with either English or Spanish in the response content (so 4 
variants would be built and passed into selectVariants).  The incoming request 
prefers Spanish and plain text as designated by the Accept-Language and Accept 
header respectively. 

After selectVariant() is called, the application developer can then call 
Variant.getMediaType() to find out which media type is preferred to send back 
and more importantly language and encoding.

I tried looking at Apache CXF but they return null.  Also, discussed this with 
Mike before he left and I think that's why he got all confused with Accept* 
headers.  :)

In short, I was wondering what the use case was for Request.selectVariant() 
would be, and if necessary change this implementation since this would affect 
application code before 0.1 goes out.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to