Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PAYARA-1765 Distributable web.xml handling broken for WEB-INF/lib archive #1692

Merged
merged 3 commits into from
Jun 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2014-2016] [Payara Foundation and/or its affiliates]
// Portions Copyright [2014-2017] [Payara Foundation and/or its affiliates]

package org.glassfish.web.deployment.archivist;

Expand Down Expand Up @@ -343,17 +343,18 @@ protected void postAnnotationProcess(WebBundleDescriptorImpl descriptor,
}
}

WebFragmentDescriptor mergedWebFragment = null;
WebFragmentDescriptor mergedWebFragment = new WebFragmentDescriptor();
mergedWebFragment.setExists(false);
for (WebFragmentDescriptor wf : wfList) {
if (mergedWebFragment == null) {
mergedWebFragment = wf;
} else {
mergedWebFragment.addWebBundleDescriptor(wf);
// we have the first fragment that's contains the web-fragment.xml file
if(!mergedWebFragment.isExists() && wf.isExists()) {
mergedWebFragment.setExists(true);
mergedWebFragment.setDistributable(wf.isDistributable());
}
mergedWebFragment.addWebBundleDescriptor(wf);
}

if (mergedWebFragment != null) {
mergedWebFragment.setExists(true);
if (!wfList.isEmpty()) {
descriptor.addWebBundleDescriptor(mergedWebFragment);

// if there any mapping stubs left, there is something invalid referenced from web.xml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2014-2016] [Payara Foundation and/or its affiliates]
// Portions Copyright [2014-2017] [Payara Foundation and/or its affiliates]

package org.glassfish.web.deployment.descriptor;

Expand Down Expand Up @@ -262,14 +262,13 @@ private void addCommonWebBundleDescriptor(WebBundleDescriptor wbd,
// combine login config with conflict resolution check
combineLoginConfiguration(webBundleDescriptor);

if (!defaultDescriptor) {
if (webBundleDescriptor.isExists()) {
boolean otherDistributable = webBundleDescriptor.isDistributable();
// the only way distributable is true is when
// all of it's web fragments are true
// The Servlet spec (section 8.2.3):
setDistributable(distributable && otherDistributable);
}
if (!defaultDescriptor && webBundleDescriptor.isExists()) {
// ignore non-fragment (plain archive) files
boolean otherDistributable = webBundleDescriptor.isDistributable();
// the only way distributable is true is when
// all of it's web fragments are true
// The Servlet spec (section 8.2.3):
setDistributable(distributable && otherDistributable);
}

combinePostConstructDescriptors(webBundleDescriptor);
Expand Down