Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.grails.web.util
[Groovy] Class WithCodecHelper

    java.lang.Object
      org.codehaus.groovy.grails.web.util.WithCodecHelper

    @groovy.transform.CompileStatic
    class WithCodecHelper
    extends java.lang.Object

Helper methods for withCodec feature.

Authors:
  Lari Hotari

Since:
  2.3

Field Summary
`static java.lang.String` | `ALL_CODECS_FALLBACK_KEY_NAME` all is the key to set all codecs at once
`static java.lang.String` | `OUT_AND_EXPRESSION_CODECS_FALLBACK_KEY_NAME` name is the key to set out and expression codecs at once

Method Summary
`static Builder` | `createOutputStackAttributesBuilder(java.lang.Object codecInfo, GrailsApplication grailsApplication)` Creates a builder for building a new GroovyPageOutputStackAttributes instance
`static Encoder` | `lookupEncoder(GrailsApplication grailsApplication, java.lang.String codecName)` Lookup encoder.
`static java.util.Map` | `makeSettingsCanonical(java.lang.Object codecInfo)`
`static java.util.Map` | `mergeSettingsAndMakeCanonical(java.lang.Object currentSettings, java.util.Map parentSettings)`
`static java.lang.Object` | `withCodec(GrailsApplication grailsApplication, java.lang.Object codecInfo, groovy.lang.Closure closure)` Executes closure with given codecs.

Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Field Detail

### ALL_CODECS_FALLBACK_KEY_NAME

    public static final java.lang.String ALL_CODECS_FALLBACK_KEY_NAME

  all is the key to set all codecs at once

### OUT_AND_EXPRESSION_CODECS_FALLBACK_KEY_NAME

    public static final java.lang.String OUT_AND_EXPRESSION_CODECS_FALLBACK_KEY_NAME

  name is the key to set out and expression codecs at once

Method Detail

### createOutputStackAttributesBuilder

    static Builder createOutputStackAttributesBuilder(java.lang.Object codecInfo, GrailsApplication grailsApplication)

  Creates a builder for building a new GroovyPageOutputStackAttributes instance
  Parameters:
    `codecInfo` - the codec info, see withCodec method for more info
    `grailsApplication` - the grails application
  Returns:
    the builder instance for building GroovyPageOutputStackAttributes instance

### lookupEncoder

    static Encoder lookupEncoder(GrailsApplication grailsApplication, java.lang.String codecName)

  Lookup encoder.
  Parameters:
    `grailsApplication` - the grailsApplication instance
    `codecName` - the codec name
  Returns:
    the encoder instance

### makeSettingsCanonical

    static java.util.Map makeSettingsCanonical(java.lang.Object codecInfo)

### mergeSettingsAndMakeCanonical

    static java.util.Map mergeSettingsAndMakeCanonical(java.lang.Object currentSettings, java.util.Map parentSettings)

### withCodec

    static java.lang.Object withCodec(GrailsApplication grailsApplication, java.lang.Object codecInfo, groovy.lang.Closure closure)

  Executes closure with given codecs. codecInfo parameter can be a single String value or a java.util.Map. When it's a single String value, "out", "expression" and "taglib" get set with the given codec When it's a java.util.Map, these keys get used:
  - out - escapes output from scriptlets to output (the codec attached to "out" writer instance in GSP scriptlets)
  - taglib - escapes output from taglibs to output (the codec attached to "out" writer instance in taglibs)
  - expression - escapes values inside ${} to output
  - static - escapes the static html parts coming from the GSP file to output
  These keys set several codecs at once:
  - all - sets out, taglib, expression and static
  - name - sets out, taglib and expression
  In addition there is
  - inherit (boolean) - defaults to true. Controls whether codecs should be inherited to deeper level (taglib calls)
  - replaceonly (boolean) - defaults to false. Codecs will be only replaced if the previous inherited codec is safe.
  Parameters:
    `grailsApplication` - the grailsApplication instance
    `codecInfo` - this parameter is explained above
    `closure` - the closure to execute
  Returns:
    the return value of the closure

Groovy Documentation