opengeospatial / NamingAuthority

Primary repo for the OGC Naming Authority
6 stars 12 forks source link

OpenGIS EPSG results are not relating a Media Type #70

Open nicholascar opened 3 years ago

nicholascar commented 3 years ago

e.g. http://www.opengis.net/def/crs/EPSG/0/4326 (WGS 84) returns XML but provides no Media Type in the Content-Type header to let the client know this. Full response headers are:

HTTP/1.1 200 OK
Date: Mon, 04 Jan 2021 11:32:53 GMT
Server: nginx/1.19.1
Content-Length: 2045
X-Hostname: (null)
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
ghobona commented 3 years ago

@pebau Please see the enhancement suggested above.

pebau commented 3 years ago

I see the point. We will phase it into our stack as soon as possible, but: Are the EPSG resolver and the Australian tool doing the same thing? We might want to stay in sync.

ghobona commented 11 months ago

@pebau The server at Jacobs University is indeed returning a content-type header.

JU_Screenshot 2023-10-03 at 13 08 40

However, the media type for GML is application/gml+xml but the server is returning text/xml;charset=utf-8. Please see the IANA registration at https://www.iana.org/assignments/media-types/application/gml+xml


@RogerLott The IOGP server is not returning any content-type headers. Please see the screenshot below.

IOGP_Screenshot 2023-10-03 at 13 08 54
pebau commented 11 months ago

ok, will have a look.

bangph commented 11 months ago

@pebau @ghobona @nicholascar

If you wanted to set setContentType to application/gml+xml then when you access CRS URL on a web browser, it will download the content in a file and you have to open it to view the content, instead of displaying it like https://crs.rasdaman.com/def/crs/OGC/0/CRS84. Is that what you really wanted?

ghobona commented 11 months ago

@bangph I think what we really need is to apply content negotiation. Specifically the Accept header as specified in RFC 7231.

Would it be possible to set the content type using the following logic, described below in pseudocode?

if (request.getHeader("Accept").equals("application/gml+xml")) then{
     response.setContentType("application/gml+xml");
}
else {
  response.setContentType("text/xml;charset=utf-8");
}
bangph commented 11 months ago

@ghobona yes it is possible for the way which you suggested. Default it returns text/xml and if a client requests with request header application/gml+xml then it returns application/gml+xml for it.

ghobona commented 11 months ago

@bangph Thanks for confirming that it is possible. Please proceed with the modification.

bangph commented 11 months ago

@ghobona I updated SECORE on our server. Now it works like you suggested (you could close the issue after checking)

default request:

curl -I 'https://crs.rasdaman.com/def/crs/OGC/0/CRS84'
HTTP/1.1 200 
Date: Wed, 04 Oct 2023 09:06:42 GMT
Server: Apache/2.4.41 (Ubuntu)
Vary: Origin,Access-Control-Request-Method,Access-Control-Request-Headers
Content-Type: text/xml;charset=utf-8

and with request header:

curl -H 'Accept: application/gml+xml' -I 'https://crs.rasdaman.com/def/crs/OGC/0/CRS84'
HTTP/1.1 200 
Date: Wed, 04 Oct 2023 09:06:57 GMT
Server: Apache/2.4.41 (Ubuntu)
Vary: Origin,Access-Control-Request-Method,Access-Control-Request-Headers
Content-Type: application/gml+xml
ghobona commented 11 months ago

Thanks @bangph . I have verified the modification. No further action is required on the Jacobs University server.

application/gml+xml media type example below:

Jacobs_University_CRS_Resolver_GML_handling_1

default media type example below:

Jacobs_University_CRS_Resolver_GML_handling_2

I will close the GitHub Issue after discussing with the maintainers of the IOGP server.