Thread to further discuss the proposed solution for SHRINKWRAP-266, please see JIRA issue for previous discussions.
Maybe it would be sufficent to only add a couple of more web container specific methods to add the capability of adding resources etc into WEB-INF/classes/, WEB-INF/classes/META-INF, WEB-INF/classes/META-INF/services etc.
Recap on the discussions on the JIRA issue.
WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war")
... will give the following output:
The question is how to handle web archive WEB-INF/ and WEB-INF/classes. E.g. Service provider registrations appear in /META-INF/services/ rather than in /WEB-INF/classes/META-INF/services/. There are many frameworks that requires that WEB-INF/classes/META-INF exists, e.g. persistence spec, JSF and service providers. Therefore it should be possible to add content to the /WEB-INF/classes/META-INF and /WEB-INF/classes/META-INF/services.
My proposal after looking into this is:
war.addAsManifestResource() -> /META-INF/ (keep as is)
war.addAsWebManifestResource() -> /WEB-INF/classes/META-INF/
war.addAsServiceProvider() -> /WEB-INF/classes/META-INF/services/ (instead of /META-INF/services)
war.setManifest() -> /META-INF/MANIFEST.MF
It would also make sense to provide a method that puts a MANIFEST.MF in WEB-INF/classes/META-INF/ just as the setManifest method:
war.setWebManifest() --> /WEB-INF/classes/META-INF/
|Retrieving data ...|