Package org.grails.encoder
Interface EncodingStateRegistry
- All Known Implementing Classes:
DefaultEncodingStateRegistry
public interface EncodingStateRegistry
EncodingStateRegistry keeps encoding state of CharSequence instances.
Encoding state information is required for the solution that prevents
double-encoding a value that is already encoded. In the current
implementation, a single EncodingStateRegistry instance is bound to a HTTP
request life cycle.
- Since:
- 2.3
-
Method Summary
Modifier and TypeMethodDescriptiongetEncodingStateFor(CharSequence string) Gets the current encoding state for a CharSequence.booleanisEncodedWith(Encoder encoder, CharSequence string) Checks if the CharSequence is encoded with encoder.voidregisterEncodedWith(Encoder encoder, CharSequence escaped) Registers that the CharSequence has been encoded with encoderbooleanshouldEncodeWith(Encoder encoderToApply, CharSequence string) Checks if a encoder should be applied to a CharSequence
-
Method Details
-
getEncodingStateFor
Gets the current encoding state for a CharSequence.- Parameters:
string- a CharSequence- Returns:
- the encoding state for the CharSequence
-
shouldEncodeWith
Checks if a encoder should be applied to a CharSequence- Parameters:
encoderToApply- the encoder to applystring- a CharSequence- Returns:
- true, if it should be applied
-
isEncodedWith
Checks if the CharSequence is encoded with encoder.- Parameters:
encoder- the encoderstring- a CharSequence- Returns:
- true, if it is encoded with encoder
-
registerEncodedWith
Registers that the CharSequence has been encoded with encoder- Parameters:
encoder- the encoderescaped- the CharSequence
-