org.apache.wicket.ThreadContext.get()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(104)

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

ThreadContext.get介绍

[英]INTERNAL METHOD
[中]内部方法

代码示例

代码示例来源:origin: apache/wicket

/**
 * @return {@link Application} bound to current thread
 */
public static Application getApplication()
{
  ThreadContext context = get(false);
  return context != null ? context.application : null;
}

代码示例来源:origin: apache/wicket

@Override
public Object deserialize(final byte[] data)
  ThreadContext old = ThreadContext.get(false);
  final ByteArrayInputStream in = new ByteArrayInputStream(data);
  ObjectInputStream ois = null;

代码示例来源:origin: org.apache.wicket/wicket-core

@Override
public Object deserialize(final byte[] data)
  ThreadContext old = ThreadContext.get(false);
  final ByteArrayInputStream in = new ByteArrayInputStream(data);
  ObjectInputStream ois = null;

代码示例来源:origin: apache/wicket

/**
 * @return {@link Session} bound to current thread
 */
public static Session getSession()
{
  ThreadContext context = get(false);
  return context != null ? context.session : null;
}

代码示例来源:origin: org.apache.wicket/wicket-core

/**
 * Binds the {@link RequestCycle} to current thread.
 * 
 * @param requestCycle
 */
public static void setRequestCycle(RequestCycle requestCycle)
{
  ThreadContext context = get(true);
  context.requestCycle = requestCycle;
}

代码示例来源:origin: apache/wicket

/**
 * Binds the session to current thread.
 * 
 * @param session
 */
public static void setSession(Session session)
{
  ThreadContext context = get(true);
  context.session = session;
}

代码示例来源:origin: org.apache.wicket/wicket-core

/**
 * @return {@link RequestCycle} bound to current thrad
 */
public static RequestCycle getRequestCycle()
{
  ThreadContext context = get(false);
  return context != null ? context.requestCycle : null;
}

代码示例来源:origin: org.apache.wicket/wicket-core

/**
 * @return {@link Session} bound to current thread
 */
public static Session getSession()
{
  ThreadContext context = get(false);
  return context != null ? context.session : null;
}

代码示例来源:origin: org.apache.wicket/wicket-core

/**
 * Checks if {@link ThreadContext} exists for the current thread
 * 
 * @return {@code true} if {@link ThreadContext} exists for the current thread
 */
public static boolean exists()
{
  return get(false) != null;
}

代码示例来源:origin: org.apache.wicket/wicket-core

/**
 * Binds the session to current thread.
 * 
 * @param session
 */
public static void setSession(Session session)
{
  ThreadContext context = get(true);
  context.session = session;
}

代码示例来源:origin: apache/wicket

/**
 * Checks if {@link ThreadContext} exists for the current thread
 * 
 * @return {@code true} if {@link ThreadContext} exists for the current thread
 */
public static boolean exists()
{
  return get(false) != null;
}

代码示例来源:origin: apache/wicket

/**
 * Binds the specified application to current thread.
 * 
 * @param application
 */
public static void setApplication(Application application)
{
  ThreadContext context = get(true);
  context.application = application;
}

代码示例来源:origin: org.apache.wicket/wicket-core

/**
 * @return {@link Application} bound to current thread
 */
public static Application getApplication()
{
  ThreadContext context = get(false);
  return context != null ? context.application : null;
}

代码示例来源:origin: org.apache.wicket/wicket-core

/**
 * Binds the specified application to current thread.
 * 
 * @param application
 */
public static void setApplication(Application application)
{
  ThreadContext context = get(true);
  context.application = application;
}

代码示例来源:origin: apache/wicket

/**
 * @return {@link RequestCycle} bound to current thrad
 */
public static RequestCycle getRequestCycle()
{
  ThreadContext context = get(false);
  return context != null ? context.requestCycle : null;
}

代码示例来源:origin: apache/wicket

/**
 * Binds the {@link RequestCycle} to current thread.
 * 
 * @param requestCycle
 */
public static void setRequestCycle(RequestCycle requestCycle)
{
  ThreadContext context = get(true);
  context.requestCycle = requestCycle;
}

代码示例来源:origin: org.apache.wicket/wicket-atmosphere

/**
 * Post an event to a single resource. This will invoke the event handlers on all components on
 * the page with the suspended connection. The resulting AJAX update (if any) is pushed to the
 * client.
 *
 * @param event
 * @param resource
 */
public void post(Object event, AtmosphereResource resource)
{
  ThreadContext oldContext = ThreadContext.get(false);
  try
  {
    postToSingleResource(event, resource);
  }
  finally
  {
    ThreadContext.restore(oldContext);
  }
}

代码示例来源:origin: org.apache.wicket.experimental.wicket8/wicket-atmosphere

/**
 * Post an event to a single resource. This will invoke the event handlers on all components on
 * the page with the suspended connection. The resulting AJAX update (if any) is pushed to the
 * client.
 *
 * @param event
 * @param resource
 */
public void post(Object event, AtmosphereResource resource)
{
  ThreadContext oldContext = ThreadContext.get(false);
  try
  {
    postToSingleResource(event, resource);
  }
  finally
  {
    ThreadContext.restore(oldContext);
  }
}

代码示例来源:origin: org.apache.wicket.experimental.wicket8/wicket-atmosphere

/**
 * Post an event to all pages that have a suspended connection. This will invoke the event
 * handlers on components, annotated with {@link Subscribe}. The resulting AJAX updates are
 * pushed to the clients.
 *
 * @param event
 */
public void post(Object event)
{
  ThreadContext oldContext = ThreadContext.get(false);
  try
  {
    for (AtmosphereResource resource : ImmutableList.copyOf(getBroadcaster().getAtmosphereResources()))
    {
      postToSingleResource(event, resource);
    }
  }
  finally
  {
    ThreadContext.restore(oldContext);
  }
}

代码示例来源:origin: org.apache.wicket/wicket-atmosphere

/**
 * Post an event to all pages that have a suspended connection. This will invoke the event
 * handlers on components, annotated with {@link Subscribe}. The resulting AJAX updates are
 * pushed to the clients.
 *
 * @param event
 */
public void post(Object event)
{
  ThreadContext oldContext = ThreadContext.get(false);
  try
  {
    for (AtmosphereResource resource : broadcaster.getAtmosphereResources())
    {
      postToSingleResource(event, resource);
    }
  }
  finally
  {
    ThreadContext.restore(oldContext);
  }
}

相关文章