-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Issue #10437 - Refactor Local Deployment Scanning #12583
base: jetty-12.1.x
Are you sure you want to change the base?
Conversation
...-core/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ScanningAppProvider.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ContextProvider.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ContextProvider.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ContextProvider.java
Outdated
Show resolved
Hide resolved
...loy/src/test/java/org/eclipse/jetty/deploy/providers/ContextProviderDeferredStartupTest.java
Outdated
Show resolved
Hide resolved
...ploy/src/test/java/org/eclipse/jetty/deploy/providers/ContextProviderRuntimeUpdatesTest.java
Outdated
Show resolved
Hide resolved
...etty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ContextProviderStartupTest.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/Deployable.java
Outdated
Show resolved
Hide resolved
jetty-ee10/jetty-ee10-webapp/src/main/java/org/eclipse/jetty/ee10/webapp/WebAppContext.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ContextProvider.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ContextProvider.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ContextProvider.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-deploy/src/main/config/etc/jetty-deployment-manager.xml
Outdated
Show resolved
Hide resolved
jetty-core/jetty-deploy/src/main/config/modules/deployment-manager.mod
Outdated
Show resolved
Hide resolved
I'd like to see:
|
jetty-core/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ContextProvider.java
Outdated
Show resolved
Hide resolved
This is ready to review again. |
@olamy @lachlan-roberts @lorban I've added you as reviewers, as even though this PR is receiving a lot of review (too much?) it is really important and we need at least everybody to be passingly aware of it and to at least have a little look. |
return h; | ||
// Create a ContextHandler suitable to deploy in OSGi | ||
ContextHandler contextHandler = _contextFactory.createContextHandler(this, metadata); | ||
Util.setBundle(contextHandler, metadata.getBundle()); |
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.
The setting of the BUNDLE attribute should be done by the context factory, not separated out here. It doesn't need a Util
method to do it either. Util.getBundle(contextHandler)
is confusing - seems like you want to get the bundle in which the class of the contexthandler is defined.
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.
In the code revision you just reviewed, this is what's going on there ...
The Util.setBundle(ContextHandler)
exists so that the Bundle
can be tracked through the ContextHandler
itself.
The other side, Util.getBundle(ContextHandler)
will use this information (stored in the ContextHandler
attributes btw), for ...
- OSGiDeployer - for events
- OSGiUndeployer - for events
- getBundleSymbolicName
- getBundleVersionAsString
- Util.registerAsOSGiService
I should be able to collapse the getBundleSymbolicName and getBundleVersionAsString into Util.registerAsOSGiService.
But the other cases are not that obvious to change.
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'll rework this to be in a better place, but with this change, instead of being in 1 place and doing it right, now we have at least 8 places to set it, and 3 places to get it.
jetty-ee10/jetty-ee10-webapp/src/main/java/org/eclipse/jetty/ee10/webapp/WebAppContext.java
Show resolved
Hide resolved
...ot-jsp/src/main/java/org/eclipse/jetty/ee11/osgi/boot/jsp/TLDServerClasspathContributor.java
Show resolved
Hide resolved
jetty-ee11/jetty-ee11-webapp/src/main/java/org/eclipse/jetty/ee11/webapp/WebAppContext.java
Show resolved
Hide resolved
} | ||
} | ||
} | ||
_defaultContextPath = true; |
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.
Shouldn't be deleted
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.
This is no longer the role of WebAppContext.initializeDefaults()
.
That is better handled via the other places that already exist.
Leaving this here will actually fail most tests.
Keep in mind that initializeDefaults()
can be called multiple times depending on the arrangement of deployable files, and if environment XML are also used.
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'm adding test cases for these (as they are not present), not sure if ee8 can support default-context-path (yet).
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.
See new DeploymentDefaultContextPathTest
test case.
This removed line doesn't need to be there.
It was only a hack to work around behavior of the old Deployment Scanner.
Where the old deployment scanner would do the following steps...
- create the context via reflection from default context classname configuration.
- call
.setDisplayName()
and.setContextPath(basename)
on context. - call
.initializeDefaults()
on that context. - run the XML to configure that context.
- eventually that context starts and
StandardDescriptorProcessor
would read the<default-context-path>
and only set the actual context-path if that flag was true.
In the new deployment scanner the steps are ...
- create the context via the XML.
- call
.setDisplayName()
and.setAttribute(DEFAULT_CONTEXT_PATH, basename)
on context. - call
.initializeDefaults()
on that context. - eventually that context starts and
StandardDescriptorProcessor
would read the<default-context-path>
and only set the actual context-path if that flag was still true.
The difference is that in the new code, that initial context class creation is skipped if the XML exists.
This allows the use cases (which we have test cases for since Jetty 9) of a custom WebAppContext to be used in the XML to create a webapp.
The scanner determined default context path should have remained a default, not a hardcoded one.
So the new code just uses the Attributes instead to pass on the scanner determined default.
Allowing the optional XML to override this default if set.
A single scanner for all Environments.
Environment attributes are how the environment specific deployment configuration is controlled.
Existing properties behaviors maintained.
Moved optional Environment XML resolution from
${jetty.base}/webapps/<env>.xml
to${jetty.base}/environments/<env>.xml
to avoid name collision with deployable XML contexts.