We need to create a Custom Data Format for our Java application.

In the documentation for serving data in another format than html, seems easy in C# application, but in our Java / Spring application we don't know where to add our Custom Formatter

Sdl.Web.Mvc.Formats.DataFormatters.Add("FORMATNAME", new MySite.Formatters.MyCustomerFormatter());

Our DXA version is 2.0 and SDL 8.5

  • Welcome to Tridion StackExchange, Please can you share the Tridion Version and also the DXA version
    – Anand NS
    Dec 9 '20 at 15:36
  • Please refer to github.com/sdl/dxa-web-application-java/blob/…
    – Anand NS
    Dec 9 '20 at 17:01
  • Yes, I see that I have to extend BaseFormatter.java but the problem is that in PageController.java (github.com/sdl/dxa-web-application-java/blob/…) the @Autowired private DataFormatter dataFormatters; doesnt have the mine Dec 9 '20 at 17:08
  • Frankly, custom data formatters never got much attention during DXA system testing, so it could be that it just doesn't work properly in DXA Java at the moment. What is your use case for a custom data formatter? Note that DXA comes with JSON, RSS and Atom formatters OOTB. Dec 10 '20 at 7:10
  • Our use case is implement a RSS format for yandex, i'ts a mix of RSS and custom html tags yandex.com/dev/turbo/doc/rss/markup.html Dec 10 '20 at 8:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.