It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How do you register @XmlAnyElement property in Confluence DTOs without UnrecognizedPropertyException Edited

Annotation 2019-11-07 114905.png

I have an Atlassian Rest endpoint which accepts class A and correctly maps JSON properties to class properties as expected from a JSON POST from a Restful AUI table. Annotation 2019-11-07 114905.png

Now I need to add extra, unknown, fields like "FriendsWithNate" to the POST request and have access to these properties within the Rest endpoint without specifically including these unknown properties in the class definition and without triggering an exception: Unrecognized field [FriendsWithNate]

I want the properties that I have mapped already to continue to work as normal, but if there are extra fields in the JSON request I would like those to be available to me in the endpoint as well. The endpoint body will know about the names of fields to look for as they are stored in plugin settings, but class A will just need to be able to handle those extra fields somehow so the class can actually reach the endpoint without causing an exception.


Forums have suggested this Catch-all XmlAnyElement annotation which aggregates unknown fields into a list as explained in the documentation below.

Annotation 2019-11-07 114905.png


I am not sure if the XmlAnyElement solution works, because my request hasn't arrived at the endpoint yet due to the exception at the top of this question. Unrecognized Field. Now to add this JsonIgnoreProperties to hopefully suppress the Exception. Nothing ChangedDidn't Work. Still An Exception.


I would like to maintain the current signature of this endpoint, because it has XML/JSON reading built in. I understand the ease of changing the endpoint to accept a HttpServletRequest instead and get req.getParameter() all the properties I need, but it defeats the XML/JSON request requirement.

Let me know if you have any suggestions and would prefer some more detailed information (code) in an email or other medium.




0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Confluence

What project did you transition or start on Confluence with the shift to remote work?

It’s been great to hear from fellow users over the last few weeks about the best tips and fun moments you’ve had working on Confluence since the transition to working remote. I’d love to keep the c...

159 views 3 8
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you