本文整理匯總了Java中com.opensymphony.xwork2.ActionContext.getContext方法的典型用法代碼示例。如果您正苦於以下問題:Java ActionContext.getContext方法的具體用法?Java ActionContext.getContext怎麽用?Java ActionContext.getContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.opensymphony.xwork2.ActionContext
的用法示例。
在下文中一共展示了ActionContext.getContext方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: execute
import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String execute() throws Exception {
ActionContext actionContext = ActionContext.getContext();
int result = userManager.validLogin(getUser());
if (result == LOGIN_SUCCESS) {
ExpManager expManager = ExpManager.getInstance(userManager.getUserByAccount(user.getAccount()),
userManager);
if (!expManager.isLoginToday())
user = expManager.addExp(ExpManager.LOGIN);
user = userManager.updateLoginDate(userManager.getUserByAccount(user.getAccount()));
actionContext.getSession().put(WebConstant.USER, userManager.getUserBeanByAccount(user.getAccount()));
actionContext.getSession().put(WebConstant.AUTHORITY,
userManager.getAuthorityBeanByAccount(user.getAccount()));
actionContext.getSession().put(WebConstant.AUTHORITY_TABLE, userManager.getAllAuthorities());
return SUCCESS;
} else {
actionContext.getSession().put(WebConstant.INTERCEPT, "Wrong account or password");
return ERROR;
}
}
示例2: execute
import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String execute() throws Exception {
ActionContext actionContext = ActionContext.getContext();
int result = userManager.validRegist(getUser());
if (result == REGIST_SUCCESS) {
ExpManager expManager = ExpManager.getInstance(userManager.getUserByAccount(user.getAccount()),
userManager);
if (!expManager.isLoginToday())
user = expManager.addExp(ExpManager.LOGIN);
user = userManager.updateLoginDate(userManager.getUserByAccount(user.getAccount()));
actionContext.getSession().put(WebConstant.VERIFY, user);
return SEND_MAIL;
} else {
actionContext.getSession().put(WebConstant.INTERCEPT, "Account is existed");
return ERROR;
}
}
示例3: execute
import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String execute() throws Exception {
ActionContext actionContext = ActionContext.getContext();
User user = userManager.getUserByAccount(getOldAccount());
user.setPassword(getVerifyPassword());
int result = userManager.validLogin(user);
if (result == LOGIN_SUCCESS) {
user.setPassword(getVerifyPassword());
user = userManager.updateAccount(user, getNewAccount());
if (user != null) {
user = userManager.updateMailVerifyState(user, false);
actionContext.getSession().put(WebConstant.USER, userManager.getUserBeanByAccount(user.getAccount()));
actionContext.getSession().put(WebConstant.AUTHORITY,
userManager.getAuthorityBeanByAccount(user.getAccount()));
return SUCCESS;
} else {
actionContext.getSession().put(WebConstant.INTERCEPT_1, "Account is existed");
return ERROR;
}
} else {
actionContext.getSession().put(WebConstant.INTERCEPT_1, "Wrong Current Password");
return ERROR;
}
}
示例4: execute
import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String execute() throws Exception {
ActionContext actionContext = ActionContext.getContext();
User user = userManager.getUserByAccount(getAccount());
user.setPassword(getOldPassword());
int result = userManager.validLogin(user);
if (result == LOGIN_SUCCESS) {
user = userManager.updatePassword(user, getNewPassword());
actionContext.getSession().put(WebConstant.USER, userManager.getUserBeanByAccount(user.getAccount()));
actionContext.getSession().put(WebConstant.AUTHORITY,
userManager.getAuthorityBeanByAccount(user.getAccount()));
return SUCCESS;
} else {
actionContext.getSession().put(WebConstant.INTERCEPT_2, "Wrong Current Password");
return ERROR;
}
}
示例5: lookupExtension
import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
protected String lookupExtension(String extension) {
if (extension == null) {
// Look for the current extension, if available
ActionContext context = ActionContext.getContext();
if (context != null) {
ActionMapping orig = (ActionMapping) context.get(ServletActionContext.ACTION_MAPPING);
if (orig != null) {
extension = orig.getExtension();
}
}
if (extension == null) {
extension = getDefaultExtension();
}
}
return extension;
}
示例6: execute
import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
public String execute() throws Exception {
ActionContext previous = ActionContext.getContext();
ActionContext.setContext(invocation.getInvocationContext());
try {
// This is for the new API:
// return RequestContextImpl.callInContext(invocation, new Callable<String>() {
// public String call() throws Exception {
// return invocation.invoke();
// }
// });
// 源碼解析: ActionInvocation調用
return invocation.invoke();
} finally {
if (cleanupContext)
ActionContext.setContext(previous);
}
}
示例7: createNewTopic
import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
public String createNewTopic(){
ActionContext actionContext = ActionContext.getContext();
Map session = actionContext.getSession();
AcctUser user=(AcctUser)session.get("user");
if(user==null){
return "login";
}
List filters = new ArrayList();
PropertyFilter filter = new PropertyFilter("EQL_section.id", SECTIONID);
filters.add(filter);
nodes = bbsManager.findAllNodesByFitler(filters);
for(Node n:nodes){
System.out.println(n.getName());
}
return "createNewTopic";
}
示例8: execute
import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String execute() throws Exception {
ActionContext actionContext = ActionContext.getContext();
if (actionContext.getSession().get(WebConstant.USER) != null) {
actionContext.getSession().put(WebConstant.USER, null);
actionContext.getSession().put(WebConstant.AUTHORITY, null);
actionContext.getSession().put(WebConstant.AUTHORITY_TABLE, null);
return SUCCESS;
} else {
actionContext.getSession().put(WebConstant.INTERCEPT, "You haven't signed in.");
return ERROR;
}
}
示例9: execute
import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String execute() throws Exception {
ActionContext actionContext = ActionContext.getContext();
User user = (User) actionContext.getSession().get(WebConstant.RESET_PASS);
if (user != null) {
userManager.updatePassword(user, getPassword());
actionContext.getSession().put(WebConstant.RESET_PASS, null);
return LOGIN;
} else {
actionContext.getSession().put(WebConstant.INTERCEPT, "No account was required to reset password");
return ERROR;
}
}
示例10: execute
import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String execute() throws Exception {
ActionContext actionContext = ActionContext.getContext();
User user = null;
if ((user = (User) actionContext.getSession().get(WebConstant.VERIFY)) != null) {
if (getCode().equalsIgnoreCase(MailManager.VerifyCode.getVerifyCode())) {
user = userManager.updateMailVerifyState(user, true);
actionContext.getSession().put(WebConstant.VERIFY, null);
actionContext.getSession().put(WebConstant.USER, userManager.getUserBeanByAccount(user.getAccount()));
actionContext.getSession().put(WebConstant.AUTHORITY,
userManager.getAuthorityBeanByAccount(user.getAccount()));
actionContext.getSession().put(WebConstant.AUTHORITY_TABLE, userManager.getAllAuthorities());
return SUCCESS;
} else {
actionContext.getSession().put(WebConstant.INTERCEPT, "Wrong verification code");
return ERROR;
}
} else if ((user = (User) actionContext.getSession().get(WebConstant.RESET_PASS)) != null) {
if (getCode().equalsIgnoreCase(MailManager.VerifyCode.getVerifyCode())) {
user = userManager.updateMailVerifyState(user, true);
return RESET_PASS;
} else {
actionContext.getSession().put(WebConstant.INTERCEPT, "Wrong verification code");
return ERROR;
}
} else {
actionContext.getSession().put(WebConstant.INTERCEPT, "No account was required to verify");
return ERROR;
}
}
示例11: execute
import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String execute() throws Exception {
ActionContext actionContext = ActionContext.getContext();
if (account == null)
return ERROR;
if (userManager.isUserExist(getAccount())) {
actionContext.getSession().put(WebConstant.RESET_PASS, userManager.getUserByAccount(account));
return SEND_MAIL;
} else {
actionContext.getSession().put(WebConstant.INTERCEPT, "Account not exist");
return ERROR;
}
}
示例12: execute
import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String execute() throws Exception {
ActionContext actionContext = ActionContext.getContext();
User user = userManager.getUserByAccount(getAccount());
if (user != null) {
userManager.deleteAccount(user);
return SUCCESS;
} else {
actionContext.getSession().put(WebConstant.INTERCEPT, "Error in deleting account");
return ERROR;
}
}
示例13: execute
import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String execute() throws Exception {
ActionContext actionContext = ActionContext.getContext();
User user = userManager.getUserByAccount(account);
if (user != null) {
actionContext.getSession().put(WebConstant.VERIFY, user);
return SEND_MAIL;
} else {
actionContext.getSession().put(WebConstant.INTERCEPT, "No account was required to verify");
return ERROR;
}
}
示例14: execute
import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String execute() throws Exception {
ActionContext actionContext = ActionContext.getContext();
User user = userManager.updateUserInfo(getUserBean());
if (user != null) {
actionContext.getSession().put(WebConstant.USER, userManager.getUserBeanByAccount(user.getAccount()));
actionContext.getSession().put(WebConstant.AUTHORITY, userManager.getAuthorityBeanByAccount(user.getAccount()));
return SUCCESS;
} else {
actionContext.getSession().put(WebConstant.INTERCEPT, "Error in update");
return ERROR;
}
}
示例15: intercept
import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String intercept(ActionInvocation invocation) throws Exception {
ActionContext actionContext = ActionContext.getContext();
UserBean user = (UserBean) actionContext.getSession().get(WebConstant.USER);
AuthorityBean authority = (AuthorityBean) actionContext.getSession().get(WebConstant.AUTHORITY);
if (user == null || authority == null) {
actionContext.getSession().put(WebConstant.INTERCEPT, "Please login first");
return Action.LOGIN;
} else if (authority.getId() < 4) {
actionContext.getSession().put(WebConstant.INTERCEPT, "Permission denied");
return WebConstant.PERMISSION_DENIED;
} else {
return invocation.invoke();
}
}