本文整理汇总了Java中org.directwebremoting.WebContext.getSession方法的典型用法代码示例。如果您正苦于以下问题:Java WebContext.getSession方法的具体用法?Java WebContext.getSession怎么用?Java WebContext.getSession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.directwebremoting.WebContext
的用法示例。
在下文中一共展示了WebContext.getSession方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertInbound
import org.directwebremoting.WebContext; //导入方法依赖的package包/类
public Object convertInbound(Class paramType, InboundVariable iv, InboundContext inctx)
{
WebContext webcx = WebContextFactory.get();
if (HttpServletRequest.class.isAssignableFrom(paramType))
{
return webcx.getHttpServletRequest();
}
if (HttpServletResponse.class.isAssignableFrom(paramType))
{
return webcx.getHttpServletResponse();
}
if (ServletConfig.class.isAssignableFrom(paramType))
{
return webcx.getServletConfig();
}
if (ServletContext.class.isAssignableFrom(paramType))
{
return webcx.getServletContext();
}
if (HttpSession.class.isAssignableFrom(paramType))
{
return webcx.getSession(true);
}
return null;
}
示例2: execute
import org.directwebremoting.WebContext; //导入方法依赖的package包/类
@Override
public Replies execute(Calls calls) {
WebContext webContext=WebContextFactory.get();
String uri = webContext.getHttpServletRequest().getRequestURI();
if(uri.indexOf("__System.pageLoaded")>-1||uri.indexOf("LoginService.adminLogin")>-1
||uri.indexOf("LoginService.merUserLogin")>-1){
return super.execute(calls);
}
HttpSession session = webContext.getSession(false);
// String page=webContext.getCurrentPage();
if (session == null) {
logOut();
return super.execute(new Calls());
}
return super.execute(calls);
}
示例3: convertInbound
import org.directwebremoting.WebContext; //导入方法依赖的package包/类
public Object convertInbound(Class<?> paramType, InboundVariable data)
{
WebContext webcx = WebContextFactory.get();
if (HttpServletRequest.class.isAssignableFrom(paramType))
{
return webcx.getHttpServletRequest();
}
if (HttpServletResponse.class.isAssignableFrom(paramType))
{
return webcx.getHttpServletResponse();
}
if (ServletConfig.class.isAssignableFrom(paramType))
{
return webcx.getServletConfig();
}
if (ServletContext.class.isAssignableFrom(paramType))
{
return webcx.getServletContext();
}
if (HttpSession.class.isAssignableFrom(paramType))
{
return webcx.getSession(true);
}
return null;
}
示例4: querySql4Special
import org.directwebremoting.WebContext; //导入方法依赖的package包/类
/**
* 判断是否为管理员
* @return
*/
public String querySql4Special() {
String sql = "select * from hlog where ";
WebContext wc = WebContextFactory.get();
HttpSession hs = wc.getSession();
String loginMid =hs.getAttribute(WebConstants.SESSION_LOGGED_ON_MID).toString();
if (!"1".equals(loginMid)) {
sql += " mid = '" + loginMid + "' and ";
}
return sql;
}
示例5: getLoginUser
import org.directwebremoting.WebContext; //导入方法依赖的package包/类
public LoginUser getLoginUser() {
try {
WebContext context = WebContextFactory.get();
if(context == null)
return null;
HttpSession session = context.getSession();
LoginUser user = (LoginUser)session.getAttribute(WebConstants.SESSION_LOGGED_ON_USER);
return user;
} catch (Exception e) {
logger.error(e.getMessage());
return null;
}
}
示例6: get
import org.directwebremoting.WebContext; //导入方法依赖的package包/类
public HttpSession get()
{
WebContext webcx = WebContextFactory.get();
return webcx.getSession();
}