From jira-events at lists.jboss.org Sat Jan 8 02:41:18 2011 Content-Type: multipart/mixed; boundary="===============4728702951906901507==" MIME-Version: 1.0 From: Andrew Rubinger (JIRA) To: shrinkwrap-issues at lists.jboss.org Subject: [shrinkwrap-issues] [JBoss JIRA] Commented: (SHRINKWRAP-241) remap targets for WebArchive add* methods Date: Sat, 08 Jan 2011 02:41:17 -0500 Message-ID: <204834298.49097.1294472477958.JavaMail.tomcat@jira02.app.mwc.hst.phx2.redhat.com> In-Reply-To: 622899779.14504.1289257681357.JavaMail.tomcat@jira02.app.mwc.hst.phx2.redhat.com --===============4728702951906901507== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable [ https://issues.jboss.org/browse/SHRINKWRAP-241?page=3Dcom.atlassian.j= ira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D125742= 31#comment-12574231 ] = Andrew Rubinger commented on SHRINKWRAP-241: -------------------------------------------- Started up: https://github.com/ALRubinger/shrinkwrap/tree/SHRINKWRAP-241 > remap targets for WebArchive add* methods > ----------------------------------------- > > Key: SHRINKWRAP-241 > URL: https://issues.jboss.org/browse/SHRINKWRAP-241 > Project: ShrinkWrap > Issue Type: Feature Request > Components: api > Affects Versions: 1.0.0-alpha-11 > Reporter: Dan Allen > Assignee: Andrew Rubinger > Priority: Blocker > Fix For: 1.0.0-alpha-12 > > > The Servlet specification specifically defines static and dynamic served = from the web application as "web resources". Hence, the use of "addWebResou= rce" to refer to WEB-INF is a mistake, and reopens the discussion of how ea= ch add* method should be mapped. > Currently, the targets for the WebArchive add methods are: > add() maps to / > addResource() maps to / > addWebResource() maps to /WEB-INF > addManifestResource() maps to /WEB-INF/classes/META-INF > (I know these are being refactor to "addAs". I'm just sticking with the t= erminology that's currently in place for the purpose of this discussion). > To start, I think we should explicitly refer to WEB-INF by name, as in: > addWebInfResource() maps to /WEB-INF > Next, we should honor the "web resource" definition from the Servlet spec= ification > addWebResource() maps to / > Now, because WebArchive is inheriting addResource() from ResourceArchive,= we should honor the function of the target location, so: > addResource() maps to /WEB-INF/classes > Finally, we have to address add() inherited from Archive. In this case, I= 'm okay with sticking with add() as meaning the root of whatever archive we= have: > add() maps to / > So, here's what an example might look like: > WebArchive war =3D ShrinkWrap.create(WebArchive.class, "app.war") > .addWebInfResource(EmptyAsset.INSTANCE, "beans.xml") > .addWebResource(new StringAsset("Hello World!"), "index.html") > .addResource(new StringAsset("foo=3Dbar"), "messages.properties); > System.out.println(war.toString(true)); > prints: > app.war > /index.html > /WEB-INF/beans.xml > /WEB-INF/classes/messages.properties > To me, this makes so much more sense. Hopefully you share the same opinio= n. -- = This message is automatically generated by JIRA. - For more information on JIRA, see: http://www.atlassian.com/software/jira =20 --===============4728702951906901507==--