📄 commandrequest.java
字号:
package com.hongsoft.res.dispatcher;
import javax.servlet.http.HttpServletRequest;
import com.hongsoft.res.formbean.UserSessionBean;
import com.hongsoft.res.util.ParameterUtil;
public class CommandRequest {
private HttpServletRequest request;
public CommandRequest(HttpServletRequest request){
this.request = request;
}
/**
* @return Command名称,参见pmes_command.map
*/
public String getCommandName(){
String name = getParameter(BaseParamName.COMMAND_NAME);
if(name==null)
name = (String)getAttribute(BaseParamName.COMMAND_NAME);
return name;
}
/**
* @return Command类型,不同的Command的类型意义有所不同
*/
public String getCommandType(){
String type = getParameter(BaseParamName.COMMAND_TYPE);
if(type==null)
type = (String)getAttribute(BaseParamName.COMMAND_TYPE);
return type;
}
/**
* 获取session中保存的相关用户信息
* @return UserSessionBean对象
*/
public UserSessionBean getUserSessionBean() {
return (UserSessionBean)request.getSession().getAttribute(BaseParamName.SESSION_USER);
}
public void setUserSessionBean(UserSessionBean user){
request.getSession(true).setAttribute(BaseParamName.SESSION_USER,user);
}
/**
* @return 返回视图的Url,参见pmes_view.map
*/
public String getReturnView(){
String view = getParameter(BaseParamName.RETURN_VIEW);
if(view==null)
view = (String)getAttribute(BaseParamName.RETURN_VIEW);
return view;
}
public HttpServletRequest getRequest() {
return request;
}
/**
* Gets a parameter as a string.
* @param name The name of the parameter you want to get
* @return The value of the parameter or null if the parameter was not
* found.
*/
public String getParameter(String name){
return ParameterUtil.getParameter(request, name);
}
/**
* Gets a parameter as a string.
* @param name The name of the parameter you want to get
* @return The value of the parameter or null if the parameter was not
* found.
*/
public Object getAttribute(String name) {
return request.getAttribute(name);
}
/**
* 设置Attribute
* @param name The name of the Attribute you want to get
* @param value The value of the Attribute.
*/
public void setAttribute(String name,Object value){
request.setAttribute(name,value);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -