【发布时间】:2016-07-14 22:53:44
【问题描述】:
我正在尝试为我的 GWT/GWTP 应用程序实现 RPC 授权服务,但我遇到了一些问题。 Intellij IDEA 将在服务器端使用 Subject 类视为错误:
Class 'javax.security.auth.Subject' is not present in JRE Emulation Library so it cannot be used in client mode
这里是sn-p的代码:
import javax.security.auth.Subject;
public class LoginServiceImpl extends RemoteServiceServlet implements LoginService {
public void loginUser(String login, String password) {
Subject subject = UserContext.createSubject(connection, login, password, null);
}
}
当我尝试在服务器端使用此类时,为什么它会提到“客户端模式”? 它并没有抱怨:
public class LoginServiceImpl extends RemoteServiceServlet implements LoginService {
public void loginUser(String login, String password) {
UserContext.get().pushSubject(
UserContext.createSubject(connection, login, password, null)
);
}
}
为什么 IDEA 将前者视为错误,但不抱怨后者?
【问题讨论】:
-
据我了解,GWT 的 JRE EL 是来自 Java 的 JRE 的一组有限的类,因此您看到的错误是类 SUBJECT 在 CLIENT 端不可用 - 您是否正在检查客户方有任何机会吗?
标签: java gwt intellij-idea rpc gwt-platform