Created
November 17, 2020 23:38
-
-
Save techforum-repo/f6d9f73fc7cc7b50260716cadaf5f563 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package com.example; | |
import java.io.ObjectInputFilter; | |
import java.io.ObjectInputFilter.FilterInfo; | |
public class CustomMethodFilter { | |
static ObjectInputFilter.Status classFilter(FilterInfo info) { | |
Class<?> serialClass = info.serialClass(); | |
if (serialClass != null) { | |
return !(serialClass.getName().equals("com.example.Employee")) //serialClass.getPackageName().equals("com.example") | |
? ObjectInputFilter.Status.ALLOWED | |
: ObjectInputFilter.Status.REJECTED; | |
} | |
return ObjectInputFilter.Status.UNDECIDED; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment