當前位置: 首頁>>代碼示例>>Java>>正文


Java MultipartConfig類代碼示例

本文整理匯總了Java中javax.servlet.annotation.MultipartConfig的典型用法代碼示例。如果您正苦於以下問題:Java MultipartConfig類的具體用法?Java MultipartConfig怎麽用?Java MultipartConfig使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MultipartConfig類屬於javax.servlet.annotation包,在下文中一共展示了MultipartConfig類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: MultipartConfigElement

import javax.servlet.annotation.MultipartConfig; //導入依賴的package包/類
/**
 * Constructs an instance from a {@link MultipartConfig} annotation value.
 *
 * @param annotation the annotation value
 */
public MultipartConfigElement(MultipartConfig annotation) {
    this.location = annotation.location();
    this.fileSizeThreshold = annotation.fileSizeThreshold();
    this.maxFileSize = annotation.maxFileSize();
    this.maxRequestSize = annotation.maxRequestSize();
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:12,代碼來源:MultipartConfigElement.java

示例2: run

import javax.servlet.annotation.MultipartConfig; //導入依賴的package包/類
@Override
public Void run() {
    final ServletSecurity security = servletInfo.getServletClass().getAnnotation(ServletSecurity.class);
    if (security != null) {

        ServletSecurityInfo servletSecurityInfo = new ServletSecurityInfo()
                .setEmptyRoleSemantic(security.value().value() == ServletSecurity.EmptyRoleSemantic.DENY ? SecurityInfo.EmptyRoleSemantic.DENY : SecurityInfo.EmptyRoleSemantic.PERMIT)
                .setTransportGuaranteeType(security.value().transportGuarantee() == ServletSecurity.TransportGuarantee.CONFIDENTIAL ? TransportGuaranteeType.CONFIDENTIAL : TransportGuaranteeType.NONE)
                .addRolesAllowed(security.value().rolesAllowed());
        for (HttpMethodConstraint constraint : security.httpMethodConstraints()) {
            servletSecurityInfo.addHttpMethodSecurityInfo(new HttpMethodSecurityInfo()
                    .setMethod(constraint.value()))
                    .setEmptyRoleSemantic(constraint.emptyRoleSemantic() == ServletSecurity.EmptyRoleSemantic.DENY ? SecurityInfo.EmptyRoleSemantic.DENY : SecurityInfo.EmptyRoleSemantic.PERMIT)
                    .setTransportGuaranteeType(constraint.transportGuarantee() == ServletSecurity.TransportGuarantee.CONFIDENTIAL ? TransportGuaranteeType.CONFIDENTIAL : TransportGuaranteeType.NONE)
                    .addRolesAllowed(constraint.rolesAllowed());
        }
        servletInfo.setServletSecurityInfo(servletSecurityInfo);
    }
    final MultipartConfig multipartConfig = servletInfo.getServletClass().getAnnotation(MultipartConfig.class);
    if (multipartConfig != null) {
        servletInfo.setMultipartConfig(new MultipartConfigElement(multipartConfig.location(), multipartConfig.maxFileSize(), multipartConfig.maxRequestSize(), multipartConfig.fileSizeThreshold()));
    }
    final RunAs runAs = servletInfo.getServletClass().getAnnotation(RunAs.class);
    if (runAs != null) {
        servletInfo.setRunAs(runAs.value());
    }
    final DeclareRoles declareRoles = servletInfo.getServletClass().getAnnotation(DeclareRoles.class);
    if (declareRoles != null) {
        deploymentInfo.addSecurityRoles(declareRoles.value());
    }
    return null;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:33,代碼來源:ServletContextImpl.java

示例3: MultipartConfigElement

import javax.servlet.annotation.MultipartConfig; //導入依賴的package包/類
public MultipartConfigElement(MultipartConfig annotation) {
    location = annotation.location();
    maxFileSize = annotation.maxFileSize();
    maxRequestSize = annotation.maxRequestSize();
    fileSizeThreshold = annotation.fileSizeThreshold();
}
 
開發者ID:sunmingshuai,項目名稱:apache-tomcat-7.0.73-with-comment,代碼行數:7,代碼來源:MultipartConfigElement.java

示例4: startImpl

import javax.servlet.annotation.MultipartConfig; //導入依賴的package包/類
protected String startImpl(ServletHolder holder, int port) throws Exception {
    holder.setInitOrder(0);

    {
        MultipartConfig multipartConfig = frontServletClass.getAnnotation(MultipartConfig.class);
        if (multipartConfig != null)

            holder.getRegistration().setMultipartConfig(new MultipartConfigElement(multipartConfig));
        else
            holder.getRegistration().setMultipartConfig(new MultipartConfigElement(""));
    }

    ServletContextHandler ctx = new ServletContextHandler(ServletContextHandler.SESSIONS);
    ctx.setContextPath("");
    ctx.addServlet(holder, "/*");

    ctx.setResourceBase(Paths.get("").toString());

    server = new Server();
    ServerConnector connector = new ServerConnector(server);
    connector.setPort(port);
    server.setConnectors(new Connector[] { connector });

    GzipHandler gzip = new GzipHandler();
    gzip.setHandler(ctx);
    server.setHandler(gzip);
    server.start();

    this.servlet = (FrontServletBase) holder.getServlet();

    String host = connector.getHost();
    if (host == null) {
        host = "localhost";
    }
    return String.format("http://%s:%d", host, connector.getLocalPort());
}
 
開發者ID:ruediste,項目名稱:rise,代碼行數:37,代碼來源:RiseServer.java

示例5: MultipartConfigElement

import javax.servlet.annotation.MultipartConfig; //導入依賴的package包/類
public MultipartConfigElement(MultipartConfig annotation) {
	location = annotation.location();
	maxFileSize = annotation.maxFileSize();
	maxRequestSize = annotation.maxRequestSize();
	fileSizeThreshold = annotation.fileSizeThreshold();
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:7,代碼來源:MultipartConfigElement.java


注:本文中的javax.servlet.annotation.MultipartConfig類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。