开发者

How to get user name in session bean when redirected to error page?

开发者 https://www.devze.com 2023-04-09 22:22 出处:网络
Can anyone tell 开发者_JAVA技巧me how to get user name in session bean correctly? In our application we do it by calling this method:

Can anyone tell 开发者_JAVA技巧me how to get user name in session bean correctly? In our application we do it by calling this method:

@Resource
private EJBContext _context;

private String getUserName() {
    return _context.getCallerPrincipal().getName();
}

And this works fine till everything's fine. But when we get some 500 or 404 error and redirect user to corresponding page (which is set in web.xml) this method returns "WLS KERNEL" as user name. How to get correct user name in this case?

0

精彩评论

暂无评论...
验证码 换一张
取 消