If it's not already picked up then I'll have a look at this issue at weekends.

Many thanks for posting a proposal on how to fix it. I'll look after the tests 
too

Cheers, Sergey

----- Original Message ----- 
From: "Barry Fitzgerald" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, February 01, 2008 3:54 PM
Subject: Jax-RS Accept headers


> Hi,
> 
> I'm pretty new to this so bear with me.
> 
> I think there is a bug handling Jax-RS accept headers in the latest trunk
> code. When a request is passed in with a comma separated list of accept
> headers these are not parsed correctly.
> 
> eg. A request with accept headers of *
> "text/xml,application/xml,application/xhtml+xml"* will not match a produce
> Mime of *"text/xml"*
> 
> A similar problem was fixed by this commit r615303:
> 
> http://svn.apache.org/viewvc?rev=615303&view=rev
> 
> However a similar fix need to added to
> org.apache.cxf.jaxrs.JAXRSUtils.matchMimeTypes()
> 
> Line 261-268 needs to replaced with:
> 
> +        List<String> types = new ArrayList<String>();
>         if (acceptContentType != null) {
> +            while (acceptContentType.length() > 0) {
> +                String tp = acceptContentType;
> +                if (acceptContentType.contains(",")) {
> +                    tp = acceptContentType.substring(0,
> acceptContentType.indexOf(','));
> +                    acceptContentType = acceptContentType
> +                        .substring(acceptContentType.indexOf(',') + 
> 1).trim();
> +                } else {
> +                    acceptContentType = "";
> +                }
> +                try {
> +                    MimeType mt = new MimeType(tp);
> +                    types.add(mt.getBaseType());
> +                } catch (MimeTypeParseException e) {
> +                    // ignore
> +                }
> 
> And the resulting array passed into intersectMimeTypes()
> 
> Sorry I didn't do a patch for this but I need to persuade my employer it's
> worth me spending time on this.
> 
> Regards,
> 
> Barry
>

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Reply via email to