use of org.jboss.as.web.common.WarMetaData in project wildfly by wildfly.
the class JSFManagedBeanProcessor method getConfigurationFiles.
public Set<VirtualFile> getConfigurationFiles(DeploymentUnit deploymentUnit) {
final Set<VirtualFile> ret = new HashSet<VirtualFile>();
final List<ResourceRoot> resourceRoots = DeploymentUtils.allResourceRoots(deploymentUnit);
for (final ResourceRoot resourceRoot : resourceRoots) {
final VirtualFile webInfFacesConfig = resourceRoot.getRoot().getChild(WEB_INF_FACES_CONFIG);
if (webInfFacesConfig.exists()) {
ret.add(webInfFacesConfig);
}
//look for files that end in .faces-config.xml
final VirtualFile metaInf = resourceRoot.getRoot().getChild("META-INF");
if (metaInf.exists() && metaInf.isDirectory()) {
for (final VirtualFile file : metaInf.getChildren()) {
if (file.getName().equals("faces-config.xml") || file.getName().endsWith(".faces-config.xml")) {
ret.add(file);
}
}
}
}
String configFiles = null;
//now look for files in the javax.faces.CONFIG_FILES context param
final WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
if (warMetaData != null) {
final WebMetaData webMetaData = warMetaData.getWebMetaData();
if (webMetaData != null) {
final List<ParamValueMetaData> contextParams = webMetaData.getContextParams();
if (contextParams != null) {
for (final ParamValueMetaData param : contextParams) {
if (param.getParamName().equals(CONFIG_FILES)) {
configFiles = param.getParamValue();
break;
}
}
}
}
}
if (configFiles != null) {
final String[] files = configFiles.split(",");
final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
if (deploymentRoot != null) {
for (final String file : files) {
final VirtualFile configFile = deploymentRoot.getRoot().getChild(file);
if (configFile.exists()) {
ret.add(configFile);
}
}
}
}
return ret;
}
use of org.jboss.as.web.common.WarMetaData in project wildfly by wildfly.
the class EntityProviderService method configureWarMetadata.
private void configureWarMetadata(DeploymentUnit deploymentUnit) {
WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
warMetaData.getMergedJBossWebMetaData().setSecurityDomain(this.getConfiguration().getSecurityDomain());
}
use of org.jboss.as.web.common.WarMetaData in project wildfly by wildfly.
the class JSFComponentProcessor method getConfigurationFiles.
public Set<VirtualFile> getConfigurationFiles(DeploymentUnit deploymentUnit) {
final Set<VirtualFile> ret = new HashSet<VirtualFile>();
final List<ResourceRoot> resourceRoots = DeploymentUtils.allResourceRoots(deploymentUnit);
for (final ResourceRoot resourceRoot : resourceRoots) {
final VirtualFile webInfFacesConfig = resourceRoot.getRoot().getChild(WEB_INF_FACES_CONFIG);
if (webInfFacesConfig.exists()) {
ret.add(webInfFacesConfig);
}
// look for files that end in .faces-config.xml
final VirtualFile metaInf = resourceRoot.getRoot().getChild("META-INF");
if (metaInf.exists() && metaInf.isDirectory()) {
for (final VirtualFile file : metaInf.getChildren()) {
if (file.getName().equals("faces-config.xml") || file.getName().endsWith(".faces-config.xml")) {
ret.add(file);
}
}
}
}
String configFiles = null;
// now look for files in the javax.faces.CONFIG_FILES context param
final WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
if (warMetaData != null) {
final WebMetaData webMetaData = warMetaData.getWebMetaData();
if (webMetaData != null) {
final List<ParamValueMetaData> contextParams = webMetaData.getContextParams();
if (contextParams != null) {
for (final ParamValueMetaData param : contextParams) {
if (param.getParamName().equals(CONFIG_FILES)) {
configFiles = param.getParamValue();
break;
}
}
}
}
}
if (configFiles != null) {
final String[] files = configFiles.split(",");
final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
if (deploymentRoot != null) {
for (final String file : files) {
if (!file.isEmpty()) {
final VirtualFile configFile = deploymentRoot.getRoot().getChild(file);
if (configFile.exists()) {
ret.add(configFile);
}
}
}
}
}
return ret;
}
use of org.jboss.as.web.common.WarMetaData in project wildfly by wildfly.
the class JSFMetadataProcessor method deploy.
@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 && 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());
}
// This can otherwise cause missing @PreDestroy events.
if (metaData.getMergedJBossWebMetaData().getDistributable() != null) {
String disabled = Boolean.toString(false);
if (!setContextParameterIfAbsent(metaData.getMergedJBossWebMetaData(), LAZY_BEAN_VALIDATION_PARAM, disabled).equals(disabled)) {
JSFLogger.ROOT_LOGGER.lazyBeanValidationEnabled();
}
}
}
use of org.jboss.as.web.common.WarMetaData in project wildfly by wildfly.
the class JSFVersionProcessor method deploy.
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final DeploymentUnit topLevelDeployment = deploymentUnit.getParent() == null ? deploymentUnit : deploymentUnit.getParent();
final WarMetaData metaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
if (!shouldJsfActivate(deploymentUnit, metaData)) {
JsfVersionMarker.setVersion(deploymentUnit, JsfVersionMarker.NONE);
return;
}
if (metaData == null) {
return;
}
List<ParamValueMetaData> contextParams = new ArrayList<ParamValueMetaData>();
if ((metaData.getWebMetaData() != null) && (metaData.getWebMetaData().getContextParams() != null)) {
contextParams.addAll(metaData.getWebMetaData().getContextParams());
}
if (metaData.getWebFragmentsMetaData() != null) {
for (WebFragmentMetaData fragmentMetaData : metaData.getWebFragmentsMetaData().values()) {
if (fragmentMetaData.getContextParams() != null) {
contextParams.addAll(fragmentMetaData.getContextParams());
}
}
}
// to manually sort out the dependencies
for (final ParamValueMetaData param : contextParams) {
if ((param.getParamName().equals(WAR_BUNDLES_JSF_IMPL_PARAM) && (param.getParamValue() != null) && (param.getParamValue().toLowerCase(Locale.ENGLISH).equals("true")))) {
JsfVersionMarker.setVersion(topLevelDeployment, JsfVersionMarker.WAR_BUNDLES_JSF_IMPL);
// WAR_BUNDLES_JSF_IMPL always wins
break;
}
if (param.getParamName().equals(JSF_CONFIG_NAME_PARAM)) {
JsfVersionMarker.setVersion(topLevelDeployment, param.getParamValue());
break;
}
}
}
Aggregations