javax.servlet.annotation.MultipartConfig Java Examples
The following examples show how to use
javax.servlet.annotation.MultipartConfig.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ServletContextImpl.java From quarkus-http with Apache License 2.0 | 5 votes |
@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; }
Example #2
Source File: AnnotationScanInitializer.java From piranha with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Is this a web annotation. * * @param annotation the annotation. * @return true if it is, false otherwise. */ private boolean isWebAnnotation(Annotation annotation) { return annotation instanceof WebServlet || annotation instanceof WebListener || annotation instanceof WebInitParam || annotation instanceof WebFilter || annotation instanceof ServletSecurity || annotation instanceof MultipartConfig; }
Example #3
Source File: MultipartConfigElement.java From piranha with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Constructor. * * @param annotation the annotation value */ public MultipartConfigElement(MultipartConfig annotation) { this.fileSizeThreshold = annotation.fileSizeThreshold(); this.location = annotation.location(); this.maxFileSize = annotation.maxFileSize(); this.maxRequestSize = annotation.maxRequestSize(); }
Example #4
Source File: MultipartConfigElementTest.java From piranha with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Test getMaxRequestSize method. */ @Test public void testGetMaxRequestSize2() { MultipartConfigElement element = new MultipartConfigElement(new MultipartConfig() { @Override public int fileSizeThreshold() { return 1000; } @Override public String location() { return ""; } @Override public long maxFileSize() { return 1000; } @Override public long maxRequestSize() { return 1000; } @Override public Class<? extends Annotation> annotationType() { throw new UnsupportedOperationException("Not supported yet."); } }); assertEquals(element.getMaxRequestSize(), 1000); }
Example #5
Source File: MultipartConfigElement.java From lams with GNU General Public License v2.0 | 5 votes |
/** * 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(); }
Example #6
Source File: ServletContextImpl.java From lams with GNU General Public License v2.0 | 5 votes |
@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; }
Example #7
Source File: MultipartConfigElement.java From Tomcat8-Source-Read with MIT License | 4 votes |
public MultipartConfigElement(MultipartConfig annotation) { location = annotation.location(); maxFileSize = annotation.maxFileSize(); maxRequestSize = annotation.maxRequestSize(); fileSizeThreshold = annotation.fileSizeThreshold(); }
Example #8
Source File: MultipartConfigElement.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
public MultipartConfigElement(MultipartConfig annotation) { location = annotation.location(); maxFileSize = annotation.maxFileSize(); maxRequestSize = annotation.maxRequestSize(); fileSizeThreshold = annotation.fileSizeThreshold(); }
Example #9
Source File: MultipartConfigElement.java From tomcatsrc with Apache License 2.0 | 4 votes |
public MultipartConfigElement(MultipartConfig annotation) { location = annotation.location(); maxFileSize = annotation.maxFileSize(); maxRequestSize = annotation.maxRequestSize(); fileSizeThreshold = annotation.fileSizeThreshold(); }