Created
July 4, 2017 09:32
-
-
Save circlee/3a973c842476a5d198cccf1a31790db3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import com.fasterxml.jackson.core.JsonParser; | |
import com.fasterxml.jackson.core.JsonProcessingException; | |
import com.fasterxml.jackson.databind.DeserializationContext; | |
import com.fasterxml.jackson.databind.JsonDeserializer; | |
public class XssStringDeserializer extends JsonDeserializer<String> { | |
@Override | |
public String deserialize(JsonParser p, DeserializationContext ctxt) | |
throws IOException, JsonProcessingException { | |
// origin value | |
String origin = p.getValueAsString(); | |
// do something (ex: xss filtering) | |
String replaced = origin + " <- deserialized"; | |
return replaced; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment