Home How to disable XML data binding in Grails 2.5.6
Reply: 0

How to disable XML data binding in Grails 2.5.6

E. Andrews
1#
E. Andrews Published in 2018-02-06 10:02:45Z

Say I have a REST controller that takes in a simple domain object, i.e.,

class UserController {
   def save(User user) {
      // do something with user
      user.save()
   }
}

class User {
   Long id
   String email
   String password
}

I can use this endpoint by POSTing it either a JSON body

{
   "email": "me@me.com",
   "password": "password"
}

or I can post it a XML body

<user>
   <email>me@me.com</email>
   <password>password</password>
</user>

Is there anyway to disable the latter so that XML will not be parsed and binded?

I have tried removing the entry xml from grails.mime.types in Config.groovy without luck.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.295248 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO