Skip to content

Support ProblemDetail serialization to XML with Jackson #29927

Closed
@osiegmar

Description

@osiegmar

Affects: 6.0.4

During the analysis of #29588 it was discovered that the XML version of Problem Details document is invalid (per RFC 7807).

curl -H "Accept: application/problem+xml, application/xml" -i http://localhost:8080/foo
HTTP/1.1 404
Content-Type: application/problem+xml
Transfer-Encoding: chunked
Date: Fri, 03 Feb 2023 21:16:53 GMT

<ProblemDetail><type>about:blank</type><title>Not Found</title><status>404</status><detail>No endpoint GET /foo.</detail><instance>/foo</instance></ProblemDetail>

The root node has to be <problem xmlns="urn:ietf:rfc:7807"> per Appendix A of RFC 7807. Also a <?xml version="1.0" encoding="UTF-8"?> header is prepended in the RFC example.

For the sake of compleness, this is my applicaton.properties:

spring.mvc.problemdetails.enabled=true
spring.mvc.throw-exception-if-no-handler-found=true
spring.web.resources.add-mappings=false

The Java code is pretty uninteresting as this example requests a non-existing resource (404) anyway.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions