[ARQ-818] Expand WebArchiveClassLoader implementation to redirect all re... #7

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
@ALRubinger
Member

ALRubinger commented Mar 16, 2012

...source requests to the web root.

@mkouba

This comment has been minimized.

Show comment
Hide comment
@mkouba

mkouba Mar 16, 2012

Contributor

I'd prefer to have some kind of fallback implemented as well - classloader should also try to find original resource name if the lookup of adjusted name fails.

Contributor

mkouba commented Mar 16, 2012

I'd prefer to have some kind of fallback implemented as well - classloader should also try to find original resource name if the lookup of adjusted name fails.

@ALRubinger

This comment has been minimized.

Show comment
Hide comment
@ALRubinger

ALRubinger Mar 16, 2012

Member

Why? By spec the root in a web archive is adjusted to WEB-INF/classes.

On Fri, Mar 16, 2012 at 3:09 AM, Martin Kouba
reply@reply.github.com
wrote:

I'd prefer to have some kind of fallback implemented as well - classloader should also try to find original resource name if the lookup of adjusted name fails.


Reply to this email directly or view it on GitHub:
#7 (comment)

Member

ALRubinger commented Mar 16, 2012

Why? By spec the root in a web archive is adjusted to WEB-INF/classes.

On Fri, Mar 16, 2012 at 3:09 AM, Martin Kouba
reply@reply.github.com
wrote:

I'd prefer to have some kind of fallback implemented as well - classloader should also try to find original resource name if the lookup of adjusted name fails.


Reply to this email directly or view it on GitHub:
#7 (comment)

@mkouba

This comment has been minimized.

Show comment
Hide comment
@mkouba

mkouba Mar 16, 2012

Contributor

Are you sure? What root do you have in mind? I don't see anything like this in servlet 3.0 and Java EE 6 spec.

By the way how about WEB-INF/lib lookup?
10.7.2 Web Application Class Loader: "The class loader that a container uses to load a servlet in a WAR must allow the developer to load any resources contained in library JARs within the WAR following normal Java SE semantics using getResource."

Contributor

mkouba commented Mar 16, 2012

Are you sure? What root do you have in mind? I don't see anything like this in servlet 3.0 and Java EE 6 spec.

By the way how about WEB-INF/lib lookup?
10.7.2 Web Application Class Loader: "The class loader that a container uses to load a servlet in a WAR must allow the developer to load any resources contained in library JARs within the WAR following normal Java SE semantics using getResource."

@ALRubinger

This comment has been minimized.

Show comment
Hide comment
@ALRubinger

ALRubinger Mar 16, 2012

Member

Servlet Spec 3.0 Section 10.5 is the one to which I'm referring:

"* The /WEB-INF/classes/ directory for servlet and utility classes.
The classes in
this directory must be available to the application class loader."

Martin is correct in noting, however, something I'd missed:
"* The /WEB-INF/lib/*.jar area for Java ARchive files. These files
contain servlets,
beans, static resources and JSPs packaged in a JAR file and other
utility classes
useful to the Web application. The Web application class loader must be able to
load classes from any of these archive files."

And there's another bit which we haven't addressed either. Webapp
ClassLoaders use child-first delegation, and we've put nothing in
place to account for that.

Section 10.5:

"The Web application class loader must load classes from the WEB-INF/classes
directory first, and then from library JARs in the WEB-INF/lib directory."

AND 10.7.2:

"It is recommended also that the application class loader be implemented so
that classes and resources packaged within the WAR are loaded in preference to
classes and resources residing in container-wide library JARs."

On Fri, Mar 16, 2012 at 4:41 AM, Martin Kouba
reply@reply.github.com
wrote:

Are you sure? What root do you have in mind? I don't see anything like this in servlet 3.0 and Java EE 6 spec.

By the way how about WEB-INF/lib lookup?
10.7.2 Web Application Class Loader: "The class loader that a container uses to load a servlet in a WAR must allow the developer to load any resources contained in library JARs within the WAR following normal Java SE semantics using getResource."


Reply to this email directly or view it on GitHub:
#7 (comment)

Member

ALRubinger commented Mar 16, 2012

Servlet Spec 3.0 Section 10.5 is the one to which I'm referring:

"* The /WEB-INF/classes/ directory for servlet and utility classes.
The classes in
this directory must be available to the application class loader."

Martin is correct in noting, however, something I'd missed:
"* The /WEB-INF/lib/*.jar area for Java ARchive files. These files
contain servlets,
beans, static resources and JSPs packaged in a JAR file and other
utility classes
useful to the Web application. The Web application class loader must be able to
load classes from any of these archive files."

And there's another bit which we haven't addressed either. Webapp
ClassLoaders use child-first delegation, and we've put nothing in
place to account for that.

Section 10.5:

"The Web application class loader must load classes from the WEB-INF/classes
directory first, and then from library JARs in the WEB-INF/lib directory."

AND 10.7.2:

"It is recommended also that the application class loader be implemented so
that classes and resources packaged within the WAR are loaded in preference to
classes and resources residing in container-wide library JARs."

On Fri, Mar 16, 2012 at 4:41 AM, Martin Kouba
reply@reply.github.com
wrote:

Are you sure? What root do you have in mind? I don't see anything like this in servlet 3.0 and Java EE 6 spec.

By the way how about WEB-INF/lib lookup?
10.7.2 Web Application Class Loader: "The class loader that a container uses to load a servlet in a WAR must allow the developer to load any resources contained in library JARs within the WAR following normal Java SE semantics using getResource."


Reply to this email directly or view it on GitHub:
#7 (comment)

@ALRubinger

This comment has been minimized.

Show comment
Hide comment
@ALRubinger

ALRubinger Mar 16, 2012

Member

To get at your primary question regarding the 'fallback":

Let's invert this and ask another way: When should CL.getResource() requests relative to the root, and not "WEB-INF/classes", ever be allowed? We should be as strict as the spec allows.

Member

ALRubinger commented Mar 16, 2012

To get at your primary question regarding the 'fallback":

Let's invert this and ask another way: When should CL.getResource() requests relative to the root, and not "WEB-INF/classes", ever be allowed? We should be as strict as the spec allows.

@aslakknutsen

This comment has been minimized.

Show comment
Hide comment
@aslakknutsen

aslakknutsen Jun 13, 2012

Member

pushed upstream, 278e7d4

Member

aslakknutsen commented Jun 13, 2012

pushed upstream, 278e7d4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment