Class StandardJavaScriptSerializer
- java.lang.Object
-
- org.thymeleaf.standard.serializer.StandardJavaScriptSerializer
-
- All Implemented Interfaces:
IStandardJavaScriptSerializer
public final class StandardJavaScriptSerializer extends java.lang.Object implements IStandardJavaScriptSerializer
Default implementation of the
IStandardJavaScriptSerializer.This implementation will delegate serialization to the Jackson JSON processor library if it is found in the classpath. If not, it will default to a custom implementation that produces similar results (but is less flexible).
If a Thymeleaf application uses JavaScript template processing in a significant amount of templates or situations, the use of Jackson (2.6+) is recommended.
Note that, even if Jackson is present in the classpath, its usage can be prevented by means of the
useJacksonIfAvailableconstructor flag.- Since:
- 3.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classStandardJavaScriptSerializer.DefaultStandardJavaScriptSerializerprivate static classStandardJavaScriptSerializer.JacksonStandardJavaScriptSerializerprivate static classStandardJavaScriptSerializer.JacksonThymeleafCharacterEscapesprivate static classStandardJavaScriptSerializer.JacksonThymeleafISO8601DateFormat
-
Field Summary
Fields Modifier and Type Field Description private IStandardJavaScriptSerializerdelegateprivate static org.slf4j.Loggerlogger
-
Constructor Summary
Constructors Constructor Description StandardJavaScriptSerializer(boolean useJacksonIfAvailable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.StringcomputeJacksonPackageNameIfPresent()private voidhandleErrorLoggingOnJacksonInitialization(java.lang.Throwable e)voidserializeValue(java.lang.Object object, java.io.Writer writer)
-
-
-
Field Detail
-
logger
private static final org.slf4j.Logger logger
-
delegate
private final IStandardJavaScriptSerializer delegate
-
-
Method Detail
-
computeJacksonPackageNameIfPresent
private java.lang.String computeJacksonPackageNameIfPresent()
-
serializeValue
public void serializeValue(java.lang.Object object, java.io.Writer writer)- Specified by:
serializeValuein interfaceIStandardJavaScriptSerializer
-
handleErrorLoggingOnJacksonInitialization
private void handleErrorLoggingOnJacksonInitialization(java.lang.Throwable e)
-
-