org.xwiki.context.Execution.setContext()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(167)

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

Execution.setContext介绍

暂无

代码示例

代码示例来源:origin: org.xwiki.commons/xwiki-commons-context

@Override
public void initialize(ExecutionContext context) throws ExecutionContextException
{
  // Make sure we set Execution Context in the Execution component before we call the initialization
  // so that we don't get any NPE if some initializer code asks to get the Execution Context. This
  // happens for example with the Velocity Execution Context initializer which in turns calls the Velocity
  // Context initializers and some of them look inside the Execution Context.
  //
  // Also, inherited values will be copied from the current context, if there is a current context.
  try {
    this.execution.setContext(context);
  } catch (RuntimeException e) {
    // If inheritance fails, we will get an unchecked exception here. So we'll wrap it in an
    // ExecutionContextException.
    throw new ExecutionContextException("Failed to set the execution context.", e);
  }
  runInitializers(context);
}

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

/**
 * Initialize execution context for the current thread.
 * 
 * @return the new execution context
 * @throws ExecutionContextException error when try to initialize execution context
 */
protected ExecutionContext initExecutionContext() throws ExecutionContextException
{
  ExecutionContextManager ecim = Utils.getComponent(ExecutionContextManager.class);
  Execution execution = Utils.getComponent(Execution.class);
  ExecutionContext ec = new ExecutionContext();
  ecim.initialize(ec);
  ec.setProperties(this.properties);
  execution.setContext(ec);
  return ec;
}

代码示例来源:origin: org.xwiki.platform/xwiki-core-observation-remote

/**
   * Make sure an ExecutionContext initialized for remote->local thread.
   */
  private void initiContext()
  {
    if (this.execution.getContext() == null) {
      ExecutionContext context = new ExecutionContext();

      try {
        this.executionContextManager.initialize(context);
      } catch (ExecutionContextException e) {
        getLogger().error("failed to initialize execution context", e);
      }

      this.execution.setContext(context);
    }
  }
}

代码示例来源:origin: com.xpn.xwiki.platform.plugins/xwiki-plugin-scheduler

execution.setContext(ec);
} catch (ExecutionContextException e) {
  throw new JobExecutionException("Fail to initialize execution context", e);

代码示例来源:origin: org.xwiki.commons/xwiki-commons-tests

public void initializeExecution() throws Exception
{
  // Initialize the Execution Context
  ExecutionContextManager ecm = getComponentManager().lookup(ExecutionContextManager.class);
  Execution execution = getComponentManager().lookup(Execution.class);
  ExecutionContext ec = new ExecutionContext();
  // Make sure we push this empty context in the Execution component before we call the initialization
  // so that we don't get any NPE if some initializer code asks to get the Execution Context. This
  // happens for example with the Velocity Execution Context initializer which in turns calls the Velocity
  // Context initializers and some of them look inside the Execution Context.
  execution.setContext(ec);
  ecm.initialize(ec);
}

代码示例来源:origin: org.xwiki.platform/xwiki-core-shared-tests

public void initializeExecution() throws Exception
{
  // Initialize the Execution Context
  ExecutionContextManager ecm = getComponentManager().lookup(ExecutionContextManager.class);
  Execution execution = getComponentManager().lookup(Execution.class);
  ExecutionContext ec = new ExecutionContext();
  // Make sure we push this empty context in the Execution component before we call the initialization
  // so that we don't get any NPE if some initializer code asks to get the Execution Context. This
  // happens for example with the Velocity Execution Context initializer which in turns calls the Velocity
  // Context initializers and some of them look inside the Execution Context.
  execution.setContext(ec);
  ecm.initialize(ec);
}

代码示例来源:origin: com.xpn.xwiki.platform.tools/xwiki-shared-tests

public void initialize() throws Exception
{
  // Initialize the Execution Context
  ExecutionContextManager ecm =
    (ExecutionContextManager) getComponentManager().lookup(ExecutionContextManager.ROLE);
  Execution execution = (Execution) getComponentManager().lookup(Execution.ROLE);
  ExecutionContext ec = new ExecutionContext();
  // Make sure we push this empty context in the Execution component before we call the initialization
  // so that we don't get any NPE if some initializer code asks to get the Execution Context. This 
  // happens for example with the Velocity Execution Context initializer which in turns calls the Velocity
  // Context initializers and some of them look inside the Execution Context.
  execution.setContext(ec);
  
  ecm.initialize(ec);
}

代码示例来源:origin: org.xwiki.platform/xwiki-core-container-portlet

public void initializeRequest(javax.portlet.PortletRequest portletRequest, Object xwikiContext)
  throws PortletContainerException
{
  // 1) Create an empty request. From this point forward request initializers can use the
  // Container object to get any data they want from the Request.
  this.container.setRequest(new PortletRequest(portletRequest));
  // 2) Create en empty Execution context so that the Container initializers can put things in the
  // execution context when they execute.
  this.execution.setContext(new ExecutionContext());
  // 3) Bridge with old code to play well with new components. Old code relies on the
  // XWikiContext object whereas new code uses the Container component.
  if (xwikiContext != null) {
    this.execution.getContext().setProperty("xwikicontext", xwikiContext);
  }
  // 4) Call the request initializers to populate the Request.
  // TODO: This is where the URL should be converted to a XWikiURL and the wiki, space,
  // document, skin and possibly other parameters are put in the Execution Context by proper
  // initializers.
  try {
    this.requestInitializerManager.initializeRequest(this.container.getRequest());
  } catch (RequestInitializerException e) {
    throw new PortletContainerException("Failed to initialize request", e);
  }
  // 5) Call Execution Context initializers to perform further Execution Context initializations
  try {
    this.executionContextManager.initialize(this.execution.getContext());
  } catch (ExecutionContextException e) {
    throw new PortletContainerException("Failed to initialize Execution Context", e);
  }
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-container-servlet

this.execution.setContext(new ExecutionContext());

相关文章