Java 类javax.servlet.annotation.MultipartConfig 实例源码

项目:lams    文件:MultipartConfigElement.java   
/**
 * 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();
}
项目:lams    文件:ServletContextImpl.java   
@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;
}
项目:apache-tomcat-7.0.73-with-comment    文件:MultipartConfigElement.java   
public MultipartConfigElement(MultipartConfig annotation) {
    location = annotation.location();
    maxFileSize = annotation.maxFileSize();
    maxRequestSize = annotation.maxRequestSize();
    fileSizeThreshold = annotation.fileSizeThreshold();
}
项目:beyondj    文件:MultipartConfigElement.java   
/**
 * 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();
}
项目:rise    文件:RiseServer.java   
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());
}
项目:tomcat7    文件:MultipartConfigElement.java   
public MultipartConfigElement(MultipartConfig annotation) {
    location = annotation.location();
    maxFileSize = annotation.maxFileSize();
    maxRequestSize = annotation.maxRequestSize();
    fileSizeThreshold = annotation.fileSizeThreshold();
}
项目:lazycat    文件:MultipartConfigElement.java   
public MultipartConfigElement(MultipartConfig annotation) {
    location = annotation.location();
    maxFileSize = annotation.maxFileSize();
    maxRequestSize = annotation.maxRequestSize();
    fileSizeThreshold = annotation.fileSizeThreshold();
}
项目:class-guard    文件:MultipartConfigElement.java   
public MultipartConfigElement(MultipartConfig annotation) {
    location = annotation.location();
    maxFileSize = annotation.maxFileSize();
    maxRequestSize = annotation.maxRequestSize();
    fileSizeThreshold = annotation.fileSizeThreshold();
}
项目:apache-tomcat-7.0.57    文件:MultipartConfigElement.java   
public MultipartConfigElement(MultipartConfig annotation) {
    location = annotation.location();
    maxFileSize = annotation.maxFileSize();
    maxRequestSize = annotation.maxRequestSize();
    fileSizeThreshold = annotation.fileSizeThreshold();
}
项目:apache-tomcat-7.0.57    文件:MultipartConfigElement.java   
public MultipartConfigElement(MultipartConfig annotation) {
    location = annotation.location();
    maxFileSize = annotation.maxFileSize();
    maxRequestSize = annotation.maxRequestSize();
    fileSizeThreshold = annotation.fileSizeThreshold();
}
项目:WBSAirback    文件:MultipartConfigElement.java   
public MultipartConfigElement(MultipartConfig annotation) {
    location = annotation.location();
    maxFileSize = annotation.maxFileSize();
    maxRequestSize = annotation.maxRequestSize();
    fileSizeThreshold = annotation.fileSizeThreshold();
}