mirror of
https://gitee.com/arthas/arthas.git
synced 2024-12-02 04:08:34 +08:00
ognl express support get private field. fix #336
This commit is contained in:
parent
e057bc549b
commit
e85e952896
@ -5,6 +5,7 @@ import com.taobao.middleware.logger.Logger;
|
|||||||
|
|
||||||
import ognl.ClassResolver;
|
import ognl.ClassResolver;
|
||||||
import ognl.DefaultMemberAccess;
|
import ognl.DefaultMemberAccess;
|
||||||
|
import ognl.MemberAccess;
|
||||||
import ognl.Ognl;
|
import ognl.Ognl;
|
||||||
import ognl.OgnlContext;
|
import ognl.OgnlContext;
|
||||||
|
|
||||||
@ -13,7 +14,7 @@ import ognl.OgnlContext;
|
|||||||
* @author hengyunabc 2018-10-18
|
* @author hengyunabc 2018-10-18
|
||||||
*/
|
*/
|
||||||
public class OgnlExpress implements Express {
|
public class OgnlExpress implements Express {
|
||||||
|
private static final MemberAccess MEMBER_ACCESS = new DefaultMemberAccess(true);
|
||||||
Logger logger = LogUtil.getArthasLogger();
|
Logger logger = LogUtil.getArthasLogger();
|
||||||
|
|
||||||
private Object bindObject;
|
private Object bindObject;
|
||||||
@ -27,7 +28,7 @@ public class OgnlExpress implements Express {
|
|||||||
context = new OgnlContext();
|
context = new OgnlContext();
|
||||||
context.setClassResolver(classResolver);
|
context.setClassResolver(classResolver);
|
||||||
// allow private field access
|
// allow private field access
|
||||||
context.setMemberAccess(new DefaultMemberAccess(true));
|
context.setMemberAccess(MEMBER_ACCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -62,6 +63,8 @@ public class OgnlExpress implements Express {
|
|||||||
public Express reset() {
|
public Express reset() {
|
||||||
context.clear();
|
context.clear();
|
||||||
context.setClassResolver(CustomClassResolver.customClassResolver);
|
context.setClassResolver(CustomClassResolver.customClassResolver);
|
||||||
|
// allow private field access
|
||||||
|
context.setMemberAccess(MEMBER_ACCESS);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user