Home Grails filter Error occurred initializing command object
Reply: 0

Grails filter Error occurred initializing command object

user1017
1#
user1017 Published in June 20, 2018, 12:09 am

Grails 2.5.6.

I use a filter class to validate all my requests for XSS attacks. If a parameter might be harmful we simply do not forward the request to the desired interface.

This workflow works fine except for cases where there is a command object used as a interface argument. The variable is simply empty and without any params.

if (paramsValid) {
    chain.doFilter(request, response)
}else {
    println("ERROR");
    response.setContentType("application/json");
    response.setCharacterEncoding("utf-8");
    PrintWriter out = response.getWriter();
    response.setStatus(400);
    out.print('{"success": false, "data": "Error validating request parameters"}');
    out.flush();
    return;
}

Then inside a conttroller interface:

def save(MappingCmd mapping) {

    println(mapping);

The mappingCmd class members are always empty. The functionally works fine without the filter. How can I make this work?

You need to login account before you can post.

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

© 2016 Powered by mzan.com design MATCHINFO