-
Notifications
You must be signed in to change notification settings - Fork 918
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
Make Tomcat allow a .JAR file that contains a webapp #146
Conversation
300b45c
to
49b9991
Compare
for (Enumeration<JarEntry> i = jar.entries(); i.hasMoreElements();) { | ||
final JarEntry e = i.nextElement(); | ||
if (!e.isDirectory()) { | ||
numEntries++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I asked you for check intend. It's for check all entry is fine?
I think we also possible return true
this line , if this method just checks jar is not empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I wanted to check if all entries are OK, but I guess it's not the responsibility of this method. Let me update it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
LGTM! |
Motivation: 1) Tomcat does not allow us to use a JAR file whose extention is not '.war' as a web application: - https://github.com/apache/tomcat/blob/4166a2b96f482f8bf7b0024836dab53d3594710e/java/org/apache/catalina/webresources/StandardRoot.java#L722 2) When TomcatService is created via forClassPath(Class, String), the service construction fails if the specified class is packaged in a .JAR file. forClassPath(Class, String) currently requires the specified class to exist in a directory, which is not always true. Modifications: - Replace Tomcat's StandardRoot with ArmeriaWebResourceRoot to accept any JAR files - Add JarSubsetResourceSet which allows a user to specify non-root web application path in a JAR file - Note that the upstream JarResourceSet is used unless specified explicitly. - Add TomcatConfig.jarRoot() - Add TomcatUtil.isZip() to determine if the specified path is really a ZIP-based archive file - Add the tests for the issue (2) in the Motivations section Result: A user can use TomcatService.forClassPath(Class, String) even when the specified class is packaged in a JAR file.
49b9991
to
10d8046
Compare
👍 |
Motivation:
'.war' as a web application:
service construction fails if the specified class is packaged in a .JAR
file. forClassPath(Class, String) currently requires the specified class
to exist in a directory, which is not always true.
Modifications:
any JAR files
application path in a JAR file
explicitly.
JAR-compatible archive file
Result:
A user can use TomcatService.forClassPath(Class, String) even when the
specified class is packaged in a JAR file.