本文整理汇总了Java中net.customware.gwt.dispatch.server.ExecutionContext类的典型用法代码示例。如果您正苦于以下问题:Java ExecutionContext类的具体用法?Java ExecutionContext怎么用?Java ExecutionContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExecutionContext类属于net.customware.gwt.dispatch.server包,在下文中一共展示了ExecutionContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: exec
import net.customware.gwt.dispatch.server.ExecutionContext; //导入依赖的package包/类
public LoginResult exec(LoginAction in, ExecutionContext context) throws ActionException {
final String login = in.getLogin();
final String passwd = in.getPasswd();
com.gbourquet.yaph.serveur.metier.generated.Account account = null;
LoginService service = (LoginService) BeanFactory.getInstance().getService("loginService");
try {
account = service.login(login, passwd);
} catch (ServiceException e) {
throw new ActionException(e.getMessage());
}
session().setAttribute("account", account);
String token = generateToken();
session().setAttribute("token", token);
return new LoginResult(account, token);
}
示例2: exec
import net.customware.gwt.dispatch.server.ExecutionContext; //导入依赖的package包/类
public AllFieldResult exec(AllFieldAction in, ExecutionContext context) throws ActionException {
final Account account = (Account) session().getAttribute("account");
final PasswordCard password = in.getPassword();
List<PasswordField> out;
PasswordService service = (PasswordService) BeanFactory.getInstance().getService("passwordService");
try {
out = service.getFields(password,account);
} catch (ServiceException e) {
throw new ActionException(e.getMessage());
}
return new AllFieldResult(out);
}
示例3: exec
import net.customware.gwt.dispatch.server.ExecutionContext; //导入依赖的package包/类
public SyncPasswordResult exec(SyncPasswordAction in, ExecutionContext context) throws ActionException {
final List<PasswordCard> passwordToDelete = in.getPasswordsToDelete();
final HashMap<PasswordCard, List<PasswordField>> dataToUpdate = in.getDataToUpdate();
final Account account = in.getAccount();
HashMap<PasswordCard, List<PasswordField>> outData;
PasswordService service = (PasswordService) BeanFactory.getInstance().getService("passwordService");
try {
outData = service.sync(account,passwordToDelete, dataToUpdate);
} catch (ServiceException e) {
throw new ActionException(e.getMessage());
}
return new SyncPasswordResult(outData);
}
示例4: execute
import net.customware.gwt.dispatch.server.ExecutionContext; //导入依赖的package包/类
public final R execute(A action, ExecutionContext context) throws ActionException {
// TODO : Gestion des droits
// HttpSession session = session();
// String token = (String) session.getAttribute("token");
/*
* if (token != null && !token.equals(action.getToken())) throw new
* IllegalUserException();
*/
boolean present = true; // à modifier - tout le monde a tous les droits
// pour le moment
if (!present)
throw new IllegalUserException();
return exec(action, context);
}
示例5: doExecute
import net.customware.gwt.dispatch.server.ExecutionContext; //导入依赖的package包/类
@Override
protected GenericActionResult doExecute(LangChangeAction action, ExecutionContext context)
throws AuthenticationException,
DispatchException {
if (action.getCurrentState()) {
moduleDao.removeLang(action.getLangId(), action.getModuleId());
} else {
SessionScopedAuthStat stat = authProv.get();
Long userId;
synchronized (stat) {
userId = stat.getUserId();
}
moduleDao.addLang(action.getLangId(), action.getModuleId(), userId);
}
return new GenericActionResult();
}
示例6: doExecute
import net.customware.gwt.dispatch.server.ExecutionContext; //导入依赖的package包/类
@Override
protected CaptchaInfoResult doExecute(CaptchaInfoAction action, ExecutionContext context)
throws AuthenticationException,
DispatchException {
switch (action.getType()) {
case 0:
LoginCaptchaInfo loginInfo = loginCaptchaInfoProvider.get();
synchronized (loginInfo) {
return new CaptchaInfoResult(loginInfo.needCaptcha());
}
case 1:
RegistrationCaptchaInfo regInfo = regCaptchaInfoProvider.get();
synchronized (regInfo) {
return new CaptchaInfoResult(regInfo.needCaptcha());
}
default:
return new CaptchaInfoResult(false);
}
}
示例7: execute
import net.customware.gwt.dispatch.server.ExecutionContext; //导入依赖的package包/类
@Override
public AddUserResult execute(AddUserAction action, ExecutionContext context)
throws DispatchException {
LOGGER.debug(">>AddUserActionHandler.execute");
// add an user
ClassroomUser user = new ClassroomUser();
user.setUserName(action.getUserName());
user.setPic(action.getPic());
userService.createUser(user);
// get all users by executing another action or by the user service
GetAllUsersResult allUsersRlt = context
.execute(new GetAllUsersAction());
AddUserResult rlt = new AddUserResult();
rlt.getAllUsers().addAll(allUsersRlt.getAllUsers());
return rlt;
}
示例8: execute
import net.customware.gwt.dispatch.server.ExecutionContext; //导入依赖的package包/类
@Override
public ListUploadsResult execute(ListUploadsAction action,
ExecutionContext context) throws DispatchException {
LOGGER.debug(">>ListUploadsActionHandler.execute");
// get all uploads
ListUploadsResult rlt = new ListUploadsResult();
String catalinaBase = System.getenv(IConstants.ENV_CATALINA_BASE);
if (catalinaBase == null || catalinaBase.trim().length() == 0) {
LOGGER.error("{} is not set properly", IConstants.ENV_CATALINA_BASE);
throw new ActionException("CATALINA_BASE is not set properly");
}
File f = new File(catalinaBase + IConstants.UPLOADS_FOLDER);
LOGGER.info("list all files from=" + f.getAbsolutePath());
for (String strName : f.list()) {
UploadItem item = new UploadItem();
item.setFilename(strName);
rlt.getAllItems().add(item);
}
return rlt;
}
示例9: execute
import net.customware.gwt.dispatch.server.ExecutionContext; //导入依赖的package包/类
@Override
public AddUserResult execute(AddUserAction action, ExecutionContext context)
throws DispatchException {
LOGGER.debug(">>AddUserActionHandler.execute");
// add an user
HappyUser user = new HappyUser();
user.setUserName(action.getUserName());
user.setPic(action.getPic());
userService.createUser(user);
// get all users by executing another action or by the user service
GetAllUsersResult allUsersRlt = context.execute(new GetAllUsersAction());
AddUserResult rlt = new AddUserResult();
rlt.getAllUsers().addAll(allUsersRlt.getAllUsers());
return rlt;
}
示例10: exec
import net.customware.gwt.dispatch.server.ExecutionContext; //导入依赖的package包/类
public AllPasswordResult exec(AllPasswordAction in, ExecutionContext context) throws ActionException {
final Account account = in.getAccount();
HashMap<PasswordCard, List<PasswordField>> outData = null;
PasswordService service = (PasswordService) BeanFactory.getInstance().getService("passwordService");
try {
outData = service.getPasswords(account);
} catch (ServiceException e) {
throw new ActionException(e.getMessage());
}
return new AllPasswordResult(outData);
}
示例11: exec
import net.customware.gwt.dispatch.server.ExecutionContext; //导入依赖的package包/类
public DeletePasswordResult exec(DeletePasswordAction in, ExecutionContext context) throws ActionException {
final Account account = (Account) session().getAttribute("account");
final PasswordCard password = in.getPasswordCard();
PasswordService service = (PasswordService) BeanFactory.getInstance().getService("passwordService");
try {
service.delete(password,account);
} catch (ServiceException e) {
throw new ActionException(e.getMessage());
}
return new DeletePasswordResult();
}
示例12: doExecute
import net.customware.gwt.dispatch.server.ExecutionContext; //导入依赖的package包/类
@Override
protected ObjectManipulationActionResult doExecute(RegAction action, ExecutionContext context)
throws AuthenticationException,
DispatchException {
if (action == null || action.getRegKvo() == null)
return createFailResult("Invalid action!");
ObjectManipulationActionResult res = checkRegistrationReq(action.getRegKvo());
if (res != null)
return res;
return doRegistration(action.getRegKvo());
}
示例13: doExecute
import net.customware.gwt.dispatch.server.ExecutionContext; //导入依赖的package包/类
@Override
protected TestLangChangeResult doExecute(TestLangChangeAction action, ExecutionContext context)
throws AuthenticationException,
DispatchException {
Object[] nums = dao.countForLangAndModule(action.getLangId(), action.getModuleId());
TestLangChangeResult res = new TestLangChangeResult();
res.setWillBeDeletedWithEmpty(nums[0] == null ? 0 : ((Number) nums[0]).longValue());
res.setWillBeDeletedWithText(nums[1] == null ? 0 : ((Number) nums[1]).longValue());
return res;
}
示例14: doExecute
import net.customware.gwt.dispatch.server.ExecutionContext; //导入依赖的package包/类
@Override
protected PingResult doExecute(PingAction action, ExecutionContext context)
throws AuthenticationException,
DispatchException {
SessionScopedAuthStat authStat = authStatProvider.get();
PingResult pingResult = new PingResult();
synchronized (authStat) {
AuthStatusResultBase result = authStat.getAuthStatusResultBase();
pingResult.setSessionAlive(result != null && result.getUserId() != null);
}
return pingResult;
}
示例15: doExecute
import net.customware.gwt.dispatch.server.ExecutionContext; //导入依赖的package包/类
@Override
protected
GetTimeZoneNamesResult
doExecute(GetTimeZoneNamesAction action, ExecutionContext context)
throws AuthenticationException,
DispatchException {
return new GetTimeZoneNamesResult(TimeZoneEnum.getValueRange());
}