JavaScriptEncoder (Grails 2.3.8)
Date: 2014-04-24

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

## org.codehaus.groovy.grails.plugins.codecs
[Java] Class JavaScriptEncoder

    java.lang.Object
      org.codehaus.groovy.grails.plugins.codecs.AbstractCharReplacementEncoder
          org.codehaus.groovy.grails.plugins.codecs.JavaScriptEncoder

    public class JavaScriptEncoder
    extends AbstractCharReplacementEncoder

Used for making strings safe to be included in a SCRIPT tag besides normal Javascript escaping, possibly "unsafe" characters are escaped too so that it's safe to include an escaped string in a HTML SCRIPT tag.

Authors:
  Lari Hotari

Since:
  2.3

Field Summary
`static CodecIdentifier` | `JAVASCRIPT_CODEC_IDENTIFIER`

Fields inherited from class AbstractCharReplacementEncoder
codecIdentifier

Constructor Summary
`JavaScriptEncoder()`

Method Summary
`protected java.lang.String` | `escapeCharacter(char ch, char previousChar)`
`boolean` | `isApplyToSafelyEncoded()`

Methods inherited from class AbstractCharReplacementEncoder
convertToString, doCharReplacementEncoding, encode, encodeToStream, encodeToWriter, escapeCharSequence, escapeCharacter, getCodecIdentifier, isApplyToSafelyEncoded, isSafe, markEncoded

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

### JAVASCRIPT_CODEC_IDENTIFIER

    public static final CodecIdentifier JAVASCRIPT_CODEC_IDENTIFIER

Constructor Detail

### JavaScriptEncoder

    public JavaScriptEncoder()

Method Detail

### escapeCharacter

    @java.lang.Override
    protected java.lang.String escapeCharacter(char ch, char previousChar)

### isApplyToSafelyEncoded

    @java.lang.Override
    public boolean isApplyToSafelyEncoded()

Groovy Documentation