annotations.add(annotationMD); MultipartConfigMetaData multipartConfig = new MultipartConfigMetaData(); AnnotationValue locationValue = annotation.value("location"); if (locationValue != null && locationValue.asString().length() > 0) { multipartConfig.setLocation(locationValue.asString()); multipartConfig.setMaxFileSize(maxFileSizeValue.asLong()); multipartConfig.setMaxRequestSize(maxRequestSizeValue.asLong()); multipartConfig.setFileSizeThreshold(fileSizeThresholdValue.asInt());
s.setMultipartConfig(Servlets.multipartConfig(mp.getLocation(), mp.getMaxFileSize(), mp.getMaxRequestSize(), mp.getFileSizeThreshold()));
if (dest.getLocation() == null) { dest.setLocation(webFragmentMetaData.getLocation()); } else if (webFragmentMetaData.getLocation() != null) { if (!resolveConflicts && !dest.getLocation().equals(webFragmentMetaData.getLocation()) && (webMetaData == null || webMetaData.getLocation() == null)) { throw new IllegalStateException("Unresolved conflict on location: " + dest.getLocation()); if (!dest.getMaxFileSizeSet()) { if (webFragmentMetaData.getMaxFileSizeSet()) { dest.setMaxFileSize(webFragmentMetaData.getMaxFileSize()); if (!resolveConflicts && webFragmentMetaData.getMaxFileSizeSet() && (dest.getMaxFileSize() != webFragmentMetaData.getMaxFileSize()) && (webMetaData == null || !webMetaData.getMaxFileSizeSet())) { throw new IllegalStateException("Unresolved conflict on max file size"); if (!dest.getMaxRequestSizeSet()) { if (webFragmentMetaData.getMaxRequestSizeSet()) { dest.setMaxRequestSize(webFragmentMetaData.getMaxRequestSize()); if (!resolveConflicts && webFragmentMetaData.getMaxRequestSizeSet() && (dest.getMaxRequestSize() != webFragmentMetaData.getMaxRequestSize()) && (webMetaData == null || !webMetaData.getMaxRequestSizeSet())) { throw new IllegalStateException("Unresolved conflict on max request size"); if (!dest.getFileSizeThresholdSet()) { if (webFragmentMetaData.getFileSizeThresholdSet()) { dest.setFileSizeThreshold(webFragmentMetaData.getFileSizeThreshold());
public void augment(MultipartConfigMetaData webFragmentMetaData, MultipartConfigMetaData webMetaData, boolean resolveConflicts) if (getLocation() == null) setLocation(webFragmentMetaData.getLocation()); else if (webFragmentMetaData.getLocation() != null) if (!resolveConflicts && !getLocation().equals(webFragmentMetaData.getLocation()) && (webMetaData == null || webMetaData.getLocation() == null)) throw new IllegalStateException("Unresolved conflict on location: " + getLocation()); setMaxFileSize(webFragmentMetaData.getMaxFileSize()); && (getMaxFileSize() != webFragmentMetaData.getMaxFileSize()) && (webMetaData == null || !webMetaData.maxFileSizeSet)) setMaxRequestSize(webFragmentMetaData.getMaxRequestSize()); && (getMaxRequestSize() != webFragmentMetaData.getMaxRequestSize()) && (webMetaData == null || !webMetaData.maxRequestSizeSet)) setFileSizeThreshold(webFragmentMetaData.getFileSizeThreshold()); && (getFileSizeThreshold() != webFragmentMetaData.getFileSizeThreshold()) && (webMetaData == null || !webMetaData.fileSizeThresholdSet))
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); WarMetaData metaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY); if(JsfVersionMarker.isJsfDisabled(deploymentUnit)) { return; } if(metaData == null || metaData.getMergedJBossWebMetaData() == null || metaData.getMergedJBossWebMetaData().getServlets() == null) { return; } JBossServletMetaData jsf = null; for(JBossServletMetaData servlet : metaData.getMergedJBossWebMetaData().getServlets()) { if(JAVAX_FACES_WEBAPP_FACES_SERVLET.equals(servlet.getServletClass())) { jsf = servlet; } } if(jsf != null) { if(jsf.getMultipartConfig() == null) { //WFLY-2329 File upload doesn't work jsf.setMultipartConfig(new MultipartConfigMetaData()); } } if (disallowDoctypeDecl != null) { // Add the disallowDoctypeDecl context param if it's not already present setContextParameterIfAbsent(metaData.getMergedJBossWebMetaData(), DISALLOW_DOCTYPE_DECL, disallowDoctypeDecl.toString()); } }
MultipartConfigMetaData multipartConfig = new MultipartConfigMetaData(); multipartConfig.augment(annotation.getMultipartConfig(), null, true); servlet.setMultipartConfig(multipartConfig);
MultipartConfigMetaData multipartConfig = new MultipartConfigMetaData(); MultipartConfigMetaData webFragmentMetaData = annotation.getMultipartConfig(); multipartConfig.setLocation(webFragmentMetaData.getLocation()); if (webFragmentMetaData.getMaxFileSizeSet()) { multipartConfig.setMaxFileSize(webFragmentMetaData.getMaxFileSize()); if (webFragmentMetaData.getMaxRequestSizeSet()) { multipartConfig.setMaxRequestSize(webFragmentMetaData.getMaxRequestSize()); if (webFragmentMetaData.getFileSizeThresholdSet()) { multipartConfig.setFileSizeThreshold(webFragmentMetaData.getFileSizeThreshold());
public MultipartConfigMetaData create(Class<?> element) { MultipartConfig multipartConfig = finder.getAnnotation(element, MultipartConfig.class); if(multipartConfig == null) return null; MultipartConfigMetaData metaData = new MultipartConfigMetaData(); if (!"".equals(multipartConfig.location())) metaData.setLocation(multipartConfig.location()); if (multipartConfig.maxFileSize() != -1L) metaData.setMaxFileSize(multipartConfig.maxFileSize()); if (multipartConfig.maxRequestSize() != -1L) metaData.setMaxRequestSize(multipartConfig.maxRequestSize()); if (multipartConfig.fileSizeThreshold() != 0) metaData.setFileSizeThreshold(multipartConfig.fileSizeThreshold()); return metaData; }
multipartConfig.setLocation(multipartConfigMetaData.getLocation()); multipartConfig.setMaxRequestSize(multipartConfigMetaData.getMaxRequestSize()); multipartConfig.setMaxFileSize(multipartConfigMetaData.getMaxFileSize()); multipartConfig.setFileSizeThreshold(multipartConfigMetaData.getFileSizeThreshold()); wrapper.setMultipartConfig(multipartConfig);
public static MultipartConfigMetaData parse(XMLStreamReader reader, final PropertyReplacer propertyReplacer) throws XMLStreamException { MultipartConfigMetaData multipartConfig = new MultipartConfigMetaData(); switch (attribute) { case ID: { multipartConfig.setId(value); break; switch (element) { case LOCATION: multipartConfig.setLocation(getElementText(reader, propertyReplacer)); break; case MAX_FILE_SIZE: try { multipartConfig.setMaxFileSize(Long.valueOf(getElementText(reader, propertyReplacer))); } catch (NumberFormatException e) { throw unexpectedValue(reader, e); case MAX_REQUEST_SIZE: try { multipartConfig.setMaxRequestSize(Long.valueOf(getElementText(reader, propertyReplacer))); } catch (NumberFormatException e) { throw unexpectedValue(reader, e); case FILE_SIZE_THRESHOLD: try { multipartConfig.setFileSizeThreshold(Integer.valueOf(getElementText(reader, propertyReplacer))); } catch (NumberFormatException e) { throw unexpectedValue(reader, e);
s.setMultipartConfig(Servlets.multipartConfig(mp.getLocation(), mp.getMaxFileSize(), mp.getMaxRequestSize(), mp.getFileSizeThreshold()));
annotations.add(annotationMD); MultipartConfigMetaData multipartConfig = new MultipartConfigMetaData(); AnnotationValue locationValue = annotation.value("location"); if (locationValue != null && locationValue.asString().length() > 0) { multipartConfig.setLocation(locationValue.asString()); multipartConfig.setMaxFileSize(maxFileSizeValue.asLong()); multipartConfig.setMaxRequestSize(maxRequestSizeValue.asLong()); multipartConfig.setFileSizeThreshold(fileSizeThresholdValue.asInt());
s.setMultipartConfig(Servlets.multipartConfig(mp.getLocation(), mp.getMaxFileSize(), mp.getMaxRequestSize(), mp.getFileSizeThreshold()));
annotations.add(annotationMD); MultipartConfigMetaData multipartConfig = new MultipartConfigMetaData(); AnnotationValue locationValue = annotation.value("location"); if (locationValue != null && locationValue.asString().length() > 0) { multipartConfig.setLocation(locationValue.asString()); multipartConfig.setMaxFileSize(maxFileSizeValue.asLong()); multipartConfig.setMaxRequestSize(maxRequestSizeValue.asLong()); multipartConfig.setFileSizeThreshold(fileSizeThresholdValue.asInt());
multipartConfig.setLocation(multipartConfigMetaData.getLocation()); multipartConfig.setMaxRequestSize(multipartConfigMetaData.getMaxRequestSize()); multipartConfig.setMaxFileSize(multipartConfigMetaData.getMaxFileSize()); multipartConfig.setFileSizeThreshold(multipartConfigMetaData.getFileSizeThreshold()); wrapper.setMultipartConfig(multipartConfig);