本文整理汇总了Java中org.springframework.web.multipart.support.StandardServletMultipartResolver类的典型用法代码示例。如果您正苦于以下问题:Java StandardServletMultipartResolver类的具体用法?Java StandardServletMultipartResolver怎么用?Java StandardServletMultipartResolver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StandardServletMultipartResolver类属于org.springframework.web.multipart.support包,在下文中一共展示了StandardServletMultipartResolver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: multipartResolver
import org.springframework.web.multipart.support.StandardServletMultipartResolver; //导入依赖的package包/类
@Bean
public MultipartResolver multipartResolver() {
return new StandardServletMultipartResolver() {
@Override
public boolean isMultipart(HttpServletRequest request) {
String method = request.getMethod().toLowerCase();
// By default, only POST is allowed. Since this is an 'update'
// we should accept PUT.
if (!Arrays.asList("put", "post").contains(method)) {
return false;
}
String contentType = request.getContentType();
return (contentType != null && contentType.toLowerCase().startsWith("multipart/"));
}
};
}
示例2: containerWithAutomatedMultipartUndertowConfiguration
import org.springframework.web.multipart.support.StandardServletMultipartResolver; //导入依赖的package包/类
@Test
public void containerWithAutomatedMultipartUndertowConfiguration() {
this.context = new AnnotationConfigEmbeddedWebApplicationContext(
ContainerWithEverythingUndertow.class, BaseConfiguration.class);
this.context.getBean(MultipartConfigElement.class);
verifyServletWorks();
assertSame(this.context.getBean(DispatcherServlet.class).getMultipartResolver(),
this.context.getBean(StandardServletMultipartResolver.class));
}
示例3: containerWithNothing
import org.springframework.web.multipart.support.StandardServletMultipartResolver; //导入依赖的package包/类
@Test
public void containerWithNothing() throws Exception {
this.context = new AnnotationConfigEmbeddedWebApplicationContext(
ContainerWithNothing.class, BaseConfiguration.class);
DispatcherServlet servlet = this.context.getBean(DispatcherServlet.class);
verify404();
assertThat(servlet.getMultipartResolver()).isNotNull();
assertThat(this.context.getBeansOfType(StandardServletMultipartResolver.class))
.hasSize(1);
assertThat(this.context.getBeansOfType(MultipartResolver.class)).hasSize(1);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:MultipartAutoConfigurationTests.java
示例4: containerWithNoMultipartJettyConfiguration
import org.springframework.web.multipart.support.StandardServletMultipartResolver; //导入依赖的package包/类
@Test
public void containerWithNoMultipartJettyConfiguration() {
this.context = new AnnotationConfigEmbeddedWebApplicationContext(
ContainerWithNoMultipartJetty.class, BaseConfiguration.class);
DispatcherServlet servlet = this.context.getBean(DispatcherServlet.class);
assertThat(servlet.getMultipartResolver()).isNotNull();
assertThat(this.context.getBeansOfType(StandardServletMultipartResolver.class))
.hasSize(1);
assertThat(this.context.getBeansOfType(MultipartResolver.class)).hasSize(1);
verifyServletWorks();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:MultipartAutoConfigurationTests.java
示例5: containerWithNoMultipartUndertowConfiguration
import org.springframework.web.multipart.support.StandardServletMultipartResolver; //导入依赖的package包/类
@Test
public void containerWithNoMultipartUndertowConfiguration() {
this.context = new AnnotationConfigEmbeddedWebApplicationContext(
ContainerWithNoMultipartUndertow.class, BaseConfiguration.class);
DispatcherServlet servlet = this.context.getBean(DispatcherServlet.class);
verifyServletWorks();
assertThat(servlet.getMultipartResolver()).isNotNull();
assertThat(this.context.getBeansOfType(StandardServletMultipartResolver.class))
.hasSize(1);
assertThat(this.context.getBeansOfType(MultipartResolver.class)).hasSize(1);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:MultipartAutoConfigurationTests.java
示例6: containerWithNoMultipartTomcatConfiguration
import org.springframework.web.multipart.support.StandardServletMultipartResolver; //导入依赖的package包/类
@Test
public void containerWithNoMultipartTomcatConfiguration() {
this.context = new AnnotationConfigEmbeddedWebApplicationContext(
ContainerWithNoMultipartTomcat.class, BaseConfiguration.class);
DispatcherServlet servlet = this.context.getBean(DispatcherServlet.class);
assertThat(servlet.getMultipartResolver()).isNull();
assertThat(this.context.getBeansOfType(StandardServletMultipartResolver.class))
.hasSize(1);
assertThat(this.context.getBeansOfType(MultipartResolver.class)).hasSize(1);
verifyServletWorks();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:MultipartAutoConfigurationTests.java
示例7: containerWithAutomatedMultipartJettyConfiguration
import org.springframework.web.multipart.support.StandardServletMultipartResolver; //导入依赖的package包/类
@Test
public void containerWithAutomatedMultipartJettyConfiguration() {
this.context = new AnnotationConfigEmbeddedWebApplicationContext(
ContainerWithEverythingJetty.class, BaseConfiguration.class);
this.context.getBean(MultipartConfigElement.class);
assertThat(this.context.getBean(StandardServletMultipartResolver.class)).isSameAs(
this.context.getBean(DispatcherServlet.class).getMultipartResolver());
verifyServletWorks();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:MultipartAutoConfigurationTests.java
示例8: containerWithAutomatedMultipartTomcatConfiguration
import org.springframework.web.multipart.support.StandardServletMultipartResolver; //导入依赖的package包/类
@Test
public void containerWithAutomatedMultipartTomcatConfiguration() throws Exception {
this.context = new AnnotationConfigEmbeddedWebApplicationContext(
ContainerWithEverythingTomcat.class, BaseConfiguration.class);
new RestTemplate().getForObject("http://localhost:"
+ this.context.getEmbeddedServletContainer().getPort() + "/",
String.class);
this.context.getBean(MultipartConfigElement.class);
assertThat(this.context.getBean(StandardServletMultipartResolver.class)).isSameAs(
this.context.getBean(DispatcherServlet.class).getMultipartResolver());
verifyServletWorks();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:MultipartAutoConfigurationTests.java
示例9: containerWithAutomatedMultipartUndertowConfiguration
import org.springframework.web.multipart.support.StandardServletMultipartResolver; //导入依赖的package包/类
@Test
public void containerWithAutomatedMultipartUndertowConfiguration() {
this.context = new AnnotationConfigEmbeddedWebApplicationContext(
ContainerWithEverythingUndertow.class, BaseConfiguration.class);
this.context.getBean(MultipartConfigElement.class);
verifyServletWorks();
assertThat(this.context.getBean(StandardServletMultipartResolver.class)).isSameAs(
this.context.getBean(DispatcherServlet.class).getMultipartResolver());
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:MultipartAutoConfigurationTests.java
示例10: containerWithCustomMultipartResolver
import org.springframework.web.multipart.support.StandardServletMultipartResolver; //导入依赖的package包/类
@Test
public void containerWithCustomMultipartResolver() throws Exception {
this.context = new AnnotationConfigEmbeddedWebApplicationContext(
ContainerWithCustomMultipartResolver.class, BaseConfiguration.class);
MultipartResolver multipartResolver = this.context
.getBean(MultipartResolver.class);
assertThat(multipartResolver)
.isNotInstanceOf(StandardServletMultipartResolver.class);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:MultipartAutoConfigurationTests.java
示例11: multipartResolver
import org.springframework.web.multipart.support.StandardServletMultipartResolver; //导入依赖的package包/类
@Bean(name = DispatcherServlet.MULTIPART_RESOLVER_BEAN_NAME)
@ConditionalOnMissingBean(MultipartResolver.class)
public StandardServletMultipartResolver multipartResolver() {
return new StandardServletMultipartResolver();
}
示例12: containerWithNothing
import org.springframework.web.multipart.support.StandardServletMultipartResolver; //导入依赖的package包/类
@Test
public void containerWithNothing() throws Exception {
this.context = new AnnotationConfigEmbeddedWebApplicationContext(
ContainerWithNothing.class, BaseConfiguration.class);
DispatcherServlet servlet = this.context.getBean(DispatcherServlet.class);
verify404();
assertNotNull(servlet.getMultipartResolver());
assertThat(this.context.getBeansOfType(StandardServletMultipartResolver.class)
.size(), equalTo(1));
assertThat(this.context.getBeansOfType(MultipartResolver.class).size(),
equalTo(1));
}
示例13: containerWithNoMultipartJettyConfiguration
import org.springframework.web.multipart.support.StandardServletMultipartResolver; //导入依赖的package包/类
@Test
public void containerWithNoMultipartJettyConfiguration() {
this.context = new AnnotationConfigEmbeddedWebApplicationContext(
ContainerWithNoMultipartJetty.class, BaseConfiguration.class);
DispatcherServlet servlet = this.context.getBean(DispatcherServlet.class);
assertNotNull(servlet.getMultipartResolver());
assertThat(this.context.getBeansOfType(StandardServletMultipartResolver.class)
.size(), equalTo(1));
assertThat(this.context.getBeansOfType(MultipartResolver.class).size(),
equalTo(1));
verifyServletWorks();
}
示例14: containerWithNoMultipartUndertowConfiguration
import org.springframework.web.multipart.support.StandardServletMultipartResolver; //导入依赖的package包/类
@Test
public void containerWithNoMultipartUndertowConfiguration() {
this.context = new AnnotationConfigEmbeddedWebApplicationContext(
ContainerWithNoMultipartUndertow.class, BaseConfiguration.class);
DispatcherServlet servlet = this.context.getBean(DispatcherServlet.class);
verifyServletWorks();
assertNotNull(servlet.getMultipartResolver());
assertThat(this.context.getBeansOfType(StandardServletMultipartResolver.class)
.size(), equalTo(1));
assertThat(this.context.getBeansOfType(MultipartResolver.class).size(),
equalTo(1));
}
示例15: containerWithNoMultipartTomcatConfiguration
import org.springframework.web.multipart.support.StandardServletMultipartResolver; //导入依赖的package包/类
@Test
public void containerWithNoMultipartTomcatConfiguration() {
this.context = new AnnotationConfigEmbeddedWebApplicationContext(
ContainerWithNoMultipartTomcat.class, BaseConfiguration.class);
DispatcherServlet servlet = this.context.getBean(DispatcherServlet.class);
assertNull(servlet.getMultipartResolver());
assertThat(this.context.getBeansOfType(StandardServletMultipartResolver.class)
.size(), equalTo(1));
assertThat(this.context.getBeansOfType(MultipartResolver.class).size(),
equalTo(1));
verifyServletWorks();
}