grails-plugins / grails-rest-client-builder

REST client plugin that uses Spring's RestTemplate
http://grails.org/plugin/rest-client-builder
Apache License 2.0
65 stars 32 forks source link

Custom Marshallers Disposed When Calling new RestBuilder() #34

Open ctoestreich opened 9 years ago

ctoestreich commented 9 years ago

When calling new RestBuilder from a controller, the custom json marshaling registered in the bootstrap are thrown disposed of and json marshalling returns to default state.

Bootstrap screen shot 2015-02-24 at 2 09 48 pm

Custom JSON Marshaler Registration screen shot 2015-02-24 at 2 10 04 pm

Controller Method screen shot 2015-02-24 at 2 07 59 pm

Json before calling controller method screen shot 2015-02-24 at 2 08 41 pm

Json after calling controller method screen shot 2015-02-24 at 2 08 58 pm

JVM: 1.7 Grails: 2.3.8 Plugin: 2.0.3

ctoestreich commented 9 years ago

The json response is coming from a controller with the following code

 def handleUserNotAuthenticated() {
        response.status = HttpStatus.SC_UNAUTHORIZED
        render createErrorViewModelFromException('User must be logged in.') as JSON
    }

The object generated ultimately has an enum like this

enum MessageType {
    CONFIRMATION,
    ERROR,
    INFORMATIONAL
}
ctoestreich commented 9 years ago

@graemerocher I added a test to the spec that illustrates this behavior and fails

https://github.com/Grails-Plugin-Consortium/grails-rest-client-builder

tcrossland commented 9 years ago

I think this is the same as https://jira.grails.org/browse/GRAILS-11801, which doesn't seem to have been migrated to a Github issue for some reason.

anielsen3 commented 8 years ago

A workaround: http://grails.1312388.n4.nabble.com/Marshallers-are-blowing-up-in-2-3-5-anyone-else-td4653954.html