gpt4 book ai didi

org.directwebremoting.WebContext.getSession()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 12:49:05 27 4
gpt4 key购买 nike

本文整理了Java中org.directwebremoting.WebContext.getSession()方法的一些代码示例,展示了WebContext.getSession()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebContext.getSession()方法的具体详情如下:
包路径:org.directwebremoting.WebContext
类名称:WebContext
方法名:getSession

WebContext.getSession介绍

[英]Returns the current session associated with this request, or if the request does not have a session, creates one.
[中]返回与此请求关联的当前会话,如果请求没有会话,则创建一个会话。

代码示例

代码示例来源:origin: org.directwebremoting/dwr

public Object getInstance() throws InstantiationException
{
  // fills for the first time the moduleConfig
  ActionForm formInstance = (ActionForm) WebContextFactory.get().getSession().getAttribute(formBean);
  if (formInstance == null)
  {
    throw new InstantiationException("Can't find formInstance  for " + formBean);
  }
  return formInstance;
}

代码示例来源:origin: org.directwebremoting/dwr

@Override
public HttpSession get()
{
  return WebContextFactory.get().getSession();
}

代码示例来源:origin: org.directwebremoting/dwr

public HttpSession get()
{
  WebContext webcx = WebContextFactory.get();
  return webcx.getSession();
}

代码示例来源:origin: org.directwebremoting/dwr

/**
 * Internal method to find or create a StoreProvider for a given user.
 */
@Override
protected StoreProvider<T> getStoreProvider()
{
  HttpSession session = WebContextFactory.get().getSession(true);
  @SuppressWarnings("unchecked")
  StoreProvider<T> storeProvider = (StoreProvider<T>) session.getAttribute(attributeName);
  if (storeProvider == null)
  {
    storeProvider = factory.create(session);
    session.setAttribute(attributeName, storeProvider);
  }
  return storeProvider;
}

代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core

/**
 * Method responsible for generating form for reporting errors.
 * @param elementId
 * @return
 */
public Map<String, Object> getForm(String elementId) {
  Map<String, Object> result = new HashMap<String, Object>();
  try {
    Map<String, Object> model = new HashMap<String, Object>();
    WebContext context = WebContextFactory.get();
    String captchaId = captchaIdGenerator.getId(context.getSession().getId());
    model.put("captchaId", captchaId);
    model.put("extId", elementId);
    model.put("logged", false);
    model.put("timestamp", (new Date()).getTime());
    context.getHttpServletRequest().setAttribute("viewModel", model);
    String html = context.forwardToString(forcedViewName);
    result.put(DWRConstants.CONTENT, html);
  } catch (Exception e) {
    log.warn("Exception occurred when rendering DWR error form for element "
        + elementId, e);
    result.put(DWRConstants.ERROR, messageSource.getMessage(
        MessageConstants.DWR_NO_DATA, null,
        LocaleContextHolder.getLocale()));
  }
  return result;
}

代码示例来源:origin: infiniteautomation/ma-core-public

@SuppressWarnings("unchecked")
private List<LongPollData> getLongPollData() {
  HttpSession session = WebContextFactory.get().getSession();

代码示例来源:origin: org.directwebremoting/dwr

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;
}

代码示例来源:origin: org.directwebremoting/dwr

object = webcx.getSession().getAttribute(name);
  webcx.getSession().setAttribute(name, object);

代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core

try {
  String cid = captchaIdGenerator.getId(
      context.getSession().getId());
  model.put("captchaId", cid);
  model.put("extId", elementId);

代码示例来源:origin: org.directwebremoting/dwr

HttpSession httpSession = webCtx.getSession(false);
String httpSessionId = (httpSession != null ? httpSession.getId() : null);

代码示例来源:origin: org.apache.geronimo.plugins/console-base-portlets

public DynamicServerInfo getJavaVMStatistics() {
    HttpSession session = WebContextFactory.get().getSession(true);
    ManagementHelper helper = PortletManager.getManagementHelper(session);
    J2EEDomain[] domains = helper.getDomains();
    J2EEServer[] servers = domains[0].getServerInstances();
    JVM[] jvms = helper.getJavaVMs(servers[0]);
    long elapsed = System.currentTimeMillis() - jvms[0].getKernelBootTime().getTime();
    if(jvms[0].isStatisticsProvider()) {
      JVMStats stats = (JVMStats) ((StatisticsProvider)jvms[0]).getStats();
      BoundedRangeStatistic heap = stats.getHeapSize();
      return new DynamicServerInfo(heap.getCurrent(), heap.getHighWaterMark(), heap.getUpperBound(), elapsed);
    } else {
      return new DynamicServerInfo(elapsed);
    }
  }
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com