public void configure(final WebSocketServletFactory factory) {
// create GSON serializer
final GsonBuilder gsonBuilder = new GsonBuilder()
.setPrettyPrinting()
.registerTypeAdapter(WebSocketMessage.class, new WebSocketDataGSONAdapter(config.getDefaultIdProperty(), config.getOutputNestingDepth()));
final boolean lenient = Boolean.parseBoolean(StructrApp.getConfigurationValue("json.lenient", "false"));
if (lenient) {
// Serializes NaN, -Infinity, Infinity, see http://code.google.com/p/google-gson/issues/detail?id=378
gsonBuilder.serializeSpecialFloatingPointValues();