[Geoserver-devel] [jira] Created: (GEOS-4888) REST AbstractResource handling of MediaType.ALL causing NPE on GET requests

REST AbstractResource handling of MediaType.ALL causing NPE on GET requests
---------------------------------------------------------------------------

                 Key: GEOS-4888
                 URL: https://jira.codehaus.org/browse/GEOS-4888
             Project: GeoServer
          Issue Type: Bug
          Components: REST
    Affects Versions: 2.1.2, 2.1.x, 2.2.x
         Environment: Internet Explorer 8 on Windows 7
            Reporter: Steve Ikeoka
            Assignee: Andrea Aime
            Priority: Minor
             Fix For: 2.2.x
         Attachments: AbstractResource.java.patch

The getFormatGet() method in org.geoserver.rest.AbstractResource isn't correctly handling MediaType.ALL (i.e., */*) in the Accepts field of the HTTP request headers. Attempting to get any of the GeoServer REST resources in Internet Explorer without putting an extension in the URL (e.g., geoserver/rest or geoserver/rest/workspaces) returns an HTTP 500 error caused by a NullPointerException. The current code in getFormatGet() only handles MediaType.ALL correctly when it is the only thing in the Accepts field but Internet Explorer 8 on Windows 7 puts this in the Accepts field which causes getFormatGet() to return null:
application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*

I've attached a patch that fixes the problem.

Some useful links:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
http://www.gethifi.com/blog/browser-rest-http-accept-headers

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira