本文整理汇总了Java中org.apache.catalina.Wrapper.setMultipartConfigElement方法的典型用法代码示例。如果您正苦于以下问题:Java Wrapper.setMultipartConfigElement方法的具体用法?Java Wrapper.setMultipartConfigElement怎么用?Java Wrapper.setMultipartConfigElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.catalina.Wrapper
的用法示例。
在下文中一共展示了Wrapper.setMultipartConfigElement方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.apache.catalina.Wrapper; //导入方法依赖的package包/类
private synchronized void init() throws Exception {
if (init) return;
Tomcat tomcat = getTomcatInstance();
context = tomcat.addContext("", TEMP_DIR);
Tomcat.addServlet(context, "regular", new Bug49711Servlet());
Wrapper w = Tomcat.addServlet(context, "multipart", new Bug49711Servlet_multipart());
// Tomcat.addServlet does not respect annotations, so we have
// to set our own MultipartConfigElement.
w.setMultipartConfigElement(new MultipartConfigElement(""));
context.addServletMapping("/regular", "regular");
context.addServletMapping("/multipart", "multipart");
tomcat.start();
setPort(tomcat.getConnector().getLocalPort());
init = true;
}
示例2: init
import org.apache.catalina.Wrapper; //导入方法依赖的package包/类
private synchronized void init(boolean limited, boolean swallow)
throws Exception {
if (init)
return;
Tomcat tomcat = getTomcatInstance();
context = tomcat.addContext("", TEMP_DIR);
Wrapper w;
w = Tomcat.addServlet(context, servletName,
new AbortedUploadServlet());
// Tomcat.addServlet does not respect annotations, so we have
// to set our own MultipartConfigElement.
// Choose upload file size limit.
if (limited) {
w.setMultipartConfigElement(new MultipartConfigElement("",
limitSize, -1, -1));
} else {
w.setMultipartConfigElement(new MultipartConfigElement(""));
}
context.addServletMapping(URI, servletName);
context.setSwallowAbortedUploads(swallow);
tomcat.start();
setPort(tomcat.getConnector().getLocalPort());
init = true;
}
示例3: makeContext
import org.apache.catalina.Wrapper; //导入方法依赖的package包/类
private void makeContext(Tomcat tomcat, Path noSuchBaseDir) throws IOException {
Path contextPath = noSuchBaseDir.resolve("context");
Files.createDirectories(contextPath);
context = tomcat.addContext(contextPathURIBase, contextPath.toAbsolutePath().toString());
context.setWebappVersion("3.1");
context.setName("Oryx");
context.addWelcomeFile("index.html");
addErrorPages(context);
// OryxApplication only needs one config value, so just pass it
context.addParameter(OryxApplication.class.getName() + ".packages", appResourcesPackages);
// ModelManagerListener will need whole config
String serializedConfig = ConfigUtils.serialize(config);
context.addParameter(ConfigUtils.class.getName() + ".serialized", serializedConfig);
Wrapper wrapper =
Tomcat.addServlet(context, "Jersey", "org.glassfish.jersey.servlet.ServletContainer");
wrapper.addInitParameter("javax.ws.rs.Application", OryxApplication.class.getName());
//wrapper.addInitParameter(OryxApplication.class.getName() + ".packages", appResourcesPackage);
wrapper.addMapping("/*");
wrapper.setLoadOnStartup(1);
wrapper.setMultipartConfigElement(new MultipartConfigElement(""));
if (!doNotInitTopics) { // Only for tests
context.addApplicationListener(ModelManagerListener.class.getName());
}
// Better way to configure JASPIC?
AuthConfigFactory.setFactory(new AuthConfigFactoryImpl());
boolean needHTTPS = keystoreFile != null;
boolean needAuthentication = userName != null;
if (needHTTPS || needAuthentication) {
SecurityCollection securityCollection = new SecurityCollection();
securityCollection.addPattern("/*");
SecurityConstraint securityConstraint = new SecurityConstraint();
securityConstraint.addCollection(securityCollection);
if (needHTTPS) {
securityConstraint.setUserConstraint("CONFIDENTIAL");
}
if (needAuthentication) {
LoginConfig loginConfig = new LoginConfig();
loginConfig.setAuthMethod("DIGEST");
loginConfig.setRealmName(InMemoryRealm.NAME);
context.setLoginConfig(loginConfig);
securityConstraint.addAuthRole(InMemoryRealm.AUTH_ROLE);
context.addSecurityRole(InMemoryRealm.AUTH_ROLE);
DigestAuthenticator authenticator = new DigestAuthenticator();
authenticator.setNonceValidity(10 * 1000L); // Shorten from 5 minutes to 10 seconds
authenticator.setNonceCacheSize(20000); // Increase from 1000 to 20000
context.getPipeline().addValve(authenticator);
}
context.addConstraint(securityConstraint);
}
context.setCookies(false);
}