gpt4 book ai didi

org.springframework.web.context.support.WebApplicationObjectSupport.getServletContext()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-26 07:25:05 25 4
gpt4 key购买 nike

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

WebApplicationObjectSupport.getServletContext介绍

[英]Return the current ServletContext.
[中]返回当前ServletContext。

代码示例

代码示例来源:origin: spring-projects/spring-framework

/**
 * Return the temporary directory for the current web application,
 * as provided by the servlet container.
 * @return the File representing the temporary directory
 * @throws IllegalStateException if not running within a ServletContext
 * @see org.springframework.web.util.WebUtils#getTempDir(javax.servlet.ServletContext)
 */
protected final File getTempDir() throws IllegalStateException {
  ServletContext servletContext = getServletContext();
  Assert.state(servletContext != null, "ServletContext is required");
  return WebUtils.getTempDir(servletContext);
}

代码示例来源:origin: org.springframework/spring-web

/**
 * Return the temporary directory for the current web application,
 * as provided by the servlet container.
 * @return the File representing the temporary directory
 * @throws IllegalStateException if not running within a ServletContext
 * @see org.springframework.web.util.WebUtils#getTempDir(javax.servlet.ServletContext)
 */
protected final File getTempDir() throws IllegalStateException {
  ServletContext servletContext = getServletContext();
  Assert.state(servletContext != null, "ServletContext is required");
  return WebUtils.getTempDir(servletContext);
}

代码示例来源:origin: spring-projects/spring-framework

@Test
@SuppressWarnings("resource")
public void testWebApplicationObjectSupport() {
  StaticWebApplicationContext wac = new StaticWebApplicationContext();
  wac.setServletContext(new MockServletContext());
  File tempDir = new File("");
  wac.getServletContext().setAttribute(WebUtils.TEMP_DIR_CONTEXT_ATTRIBUTE, tempDir);
  wac.registerBeanDefinition("test", new RootBeanDefinition(TestWebApplicationObject.class));
  wac.refresh();
  WebApplicationObjectSupport wao = (WebApplicationObjectSupport) wac.getBean("test");
  assertEquals(wao.getServletContext(), wac.getServletContext());
  assertEquals(wao.getTempDir(), tempDir);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-web

/**
 * Return the temporary directory for the current web application,
 * as provided by the servlet container.
 * @return the File representing the temporary directory
 * @throws IllegalStateException if not running within a ServletContext
 * @see org.springframework.web.util.WebUtils#getTempDir(javax.servlet.ServletContext)
 */
protected final File getTempDir() throws IllegalStateException {
  ServletContext servletContext = getServletContext();
  Assert.state(servletContext != null, "ServletContext is required");
  return WebUtils.getTempDir(servletContext);
}

代码示例来源:origin: springframework/spring-web

/**
 * Return the temporary directory for the current web application,
 * as provided by the servlet container.
 * @return the File representing the temporary directory
 * @throws IllegalStateException if not running in a WebApplicationContext
 */
protected final File getTempDir() {
  return WebUtils.getTempDir(getServletContext());
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Return the temporary directory for the current web application,
 * as provided by the servlet container.
 * @return the File representing the temporary directory
 * @throws IllegalStateException if not running within a ServletContext
 * @see org.springframework.web.util.WebUtils#getTempDir(javax.servlet.ServletContext)
 */
protected final File getTempDir() throws IllegalStateException {
  ServletContext servletContext = getServletContext();
  Assert.state(servletContext != null, "ServletContext is required");
  return WebUtils.getTempDir(servletContext);
}

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