本文整理汇总了Java中org.apache.tapestry5.EventConstants类的典型用法代码示例。如果您正苦于以下问题:Java EventConstants类的具体用法?Java EventConstants怎么用?Java EventConstants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EventConstants类属于org.apache.tapestry5包,在下文中一共展示了EventConstants类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validation
import org.apache.tapestry5.EventConstants; //导入依赖的package包/类
@Log
@OnEvent(value = EventConstants.VALIDATE, component = "loginForm")
public void validation()
{
if (!loginForm.isValid()) {
return;
}
//LOG.debug("onValidateLoginForm [" + username + "] ");
try {
Subject subject = SecurityUtils.getSubject();
if (!subject.isAuthenticated()) {
// http://shiro.apache.org/static/1.2.2/apidocs/org/apache/shiro/authc/UsernamePasswordToken.html
UsernamePasswordToken token = new UsernamePasswordToken(username, password);
//token.setRememberMe(rememberMe);
subject.login(token);
token.clear();
LOG.debug("User [" + subject.getPrincipal() + "] logged in successfully.");
} else {
LOG.debug("User [" + subject.getPrincipal() + "] failed to log.");
}
} catch (Exception e) {
loginForm.recordError("Error " + e.getMessage());
}
}
示例2: submit
import org.apache.tapestry5.EventConstants; //导入依赖的package包/类
@OnEvent(EventConstants.SUCCESS)
public Object submit() {
Subject currentUser = securityService.getSubject();
if (currentUser == null) {
throw new IllegalStateException("Subject can`t be null");
}
UsernamePasswordToken token = new UsernamePasswordToken(username, password);
try {
currentUser.login(token);
} catch (Exception e) {
alertManager.error("Authentication Error");
return null;
}
return "Index";
}
示例3: loggingSuccess
import org.apache.tapestry5.EventConstants; //导入依赖的package包/类
@Log
@OnEvent(value = EventConstants.SUCCESS, component = "loginForm")
public void loggingSuccess()
{
String successPage = loginContextService.getSuccessPage();
try{
loginContextService.redirectToSavedRequest(successPage);
}
catch (IOException e) {
e.printStackTrace();
}
}