Controller render method examples with converter?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Controller render method examples with converter?

a.shneyderman
I am looking at the docs of controller render method and trying to
decipher what description of converter parameter means exactly:

"converter (as single non-named first parameter) - A Converter that
should be rendered as Response"

Is there any example of its use?


Basically I am using this in my conotrller code:

render(template: 'tmplText', model: [...])

tmplText in most of the cases has to contain \r\n for all the text
output. I wanted to make sure that there is a decorator of some
sorts that will do this for me. I thought converter would be one
logical path to achieve this but I have no clue what it is supposed
to be. So a sample somewhere would be very useful ...

Cheers,
Alex.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Controller render method examples with converter?

Nathan Wells
Alex,

Here are some docs on Converters: http://grails.org/Converters+Reference

Given the remainder of your email, it doesn't sound like Converters are what you want. However, I'm not sure I understand what you do want to accomplish. If you want to convert '\r\n' to '<br>', I've had good luck using the Encoders API for this: http://grails.org/doc/latest/guide/single.html#codecs

HTH
Nathan Wells


On Mon, Oct 29, 2012 at 3:39 AM, Alex Shneyderman <[hidden email]> wrote:
I am looking at the docs of controller render method and trying to
decipher what description of converter parameter means exactly:

"converter (as single non-named first parameter) - A Converter that
should be rendered as Response"

Is there any example of its use?


Basically I am using this in my conotrller code:

render(template: 'tmplText', model: [...])

tmplText in most of the cases has to contain \r\n for all the text
output. I wanted to make sure that there is a decorator of some
sorts that will do this for me. I thought converter would be one
logical path to achieve this but I have no clue what it is supposed
to be. So a sample somewhere would be very useful ...

Cheers,
Alex.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email