You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "sharath p (Created) (JIRA)" <ji...@apache.org> on 2012/04/17 21:13:17 UTC

[jira] [Created] (CXF-4243) RequestImpl.selectVariant() using wrong headers

RequestImpl.selectVariant() using wrong headers
-----------------------------------------------

                 Key: CXF-4243
                 URL: https://issues.apache.org/jira/browse/CXF-4243
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS
    Affects Versions: 2.3.1
         Environment: cxf-rt-frontend-jaxrs-2.3.1
            Reporter: sharath p
            Priority: Minor


org.apache.cxf.jaxrs.impl.RequestImpl
******
public Variant selectVariant(List<Variant> vars) throws IllegalArgumentException {
        if (vars == null || vars.isEmpty()) {
            throw new IllegalArgumentException("List of Variants is either null or empty");
        }
        MediaType inMediaType = headers.getMediaType();
        Locale inLang = headers.getLanguage();
        String inEnc = headers.getRequestHeaders().getFirst(HttpHeaders.CONTENT_ENCODING);
.....
}
******

In order to select the correct variant (conneg), Accept-* headers should be used, therefore headers.getAcceptableMediaTypes(), headers.getAcceptableLanguages() and headers.getRequestHeaders().getFirst(ACCEPT_ENCODING) should be used instead of headers.getMediaType(), headers.getLanguage() and headers.getRequestHeaders().getFirst(HttpHeaders.CONTENT_ENCODING).





--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (CXF-4243) RequestImpl.selectVariant() using wrong headers

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4243?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-4243.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.3.11
                   2.4.8
                   2.5.4
                   2.6.1
         Assignee: Sergey Beryozkin
    
> RequestImpl.selectVariant() using wrong headers
> -----------------------------------------------
>
>                 Key: CXF-4243
>                 URL: https://issues.apache.org/jira/browse/CXF-4243
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.3.1
>         Environment: cxf-rt-frontend-jaxrs-2.3.1
>            Reporter: sharath p
>            Assignee: Sergey Beryozkin
>            Priority: Minor
>              Labels: conneg, cxf-frontend
>             Fix For: 2.6.1, 2.5.4, 2.4.8, 2.3.11
>
>
> org.apache.cxf.jaxrs.impl.RequestImpl
> ******
> public Variant selectVariant(List<Variant> vars) throws IllegalArgumentException {
>         if (vars == null || vars.isEmpty()) {
>             throw new IllegalArgumentException("List of Variants is either null or empty");
>         }
>         MediaType inMediaType = headers.getMediaType();
>         Locale inLang = headers.getLanguage();
>         String inEnc = headers.getRequestHeaders().getFirst(HttpHeaders.CONTENT_ENCODING);
> .....
> }
> ******
> In order to select the correct variant (conneg), Accept-* headers should be used, therefore headers.getAcceptableMediaTypes(), headers.getAcceptableLanguages() and headers.getRequestHeaders().getFirst(ACCEPT_ENCODING) should be used instead of headers.getMediaType(), headers.getLanguage() and headers.getRequestHeaders().getFirst(HttpHeaders.CONTENT_ENCODING).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira