-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Issue #12990 - Introduce static-deploy
module
#12998
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 #12990 - Introduce static-deploy
module
#12998
Conversation
+ And distribution tests
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.
We've gone wrong somewhere with "foo.d" directories. These should never EVER be deployed by the deployer. They should be invisible to the scanner/deployer and are used to hold files for a app at "/foo/" or "/foo.war".
I think the issue here is that a "/foo/" directory should be deployed to deploy static resources if:
- The default env is an EEn env and then it is just a servlet application with no servlets and just a default servlet.
- If the default env is "core" then a resource handler should be created.
- If there is a foo.properties file that sets the env to core, then it should be deployed with a resource handler.
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/CoreContextHandler.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/CoreContextHandler.java
Outdated
Show resolved
Hide resolved
...est-distribution-common/src/test/java/org/eclipse/jetty/tests/distribution/DeployerTest.java
Show resolved
Hide resolved
static-deploy
module
...y-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/StaticContextHandler.java
Outdated
Show resolved
Hide resolved
...y-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/StaticContextHandler.java
Outdated
Show resolved
Hide resolved
...y-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/StaticContextHandler.java
Outdated
Show resolved
Hide resolved
...y-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/StaticContextHandler.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/CoreContextHandler.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/CoreContextHandler.java
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/config/modules/static-deploy.mod
Outdated
Show resolved
Hide resolved
* ContextHandler now handles the TEMP_DIR and CONTEXT_PATH attributes.
…redeploy-static-directory
…he same way as ee#
jetty-core/jetty-server/src/main/config/modules/static-deploy.mod
Outdated
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/CoreContextHandler.java
Outdated
Show resolved
Hide resolved
…hat logic at deployment is more sane
…before attempting to configure it
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/CoreContextHandler.java
Outdated
Show resolved
Hide resolved
...y-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/StaticContextHandler.java
Outdated
Show resolved
Hide resolved
...y-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/StaticContextHandler.java
Outdated
Show resolved
Hide resolved
...y-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/StaticContextHandler.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/IO.java
Outdated
Show resolved
Hide resolved
...-maven-plugin/src/main/java/org/eclipse/jetty/ee10/maven/plugin/WebAppPropertyConverter.java
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/CoreContextHandler.java
Outdated
Show resolved
Hide resolved
...y-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/StaticContextHandler.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java
Show resolved
Hide resolved
@gregw @joakime so current status is that environment
A static deployment would therefore always require a
Perhaps the right solution is to not have any environment setup by default -- they are only enabled if there is the correspondent module. Thoughts? |
The |
…redeploy-static-directory
@gregw a rereview on this one please. |
@@ -127,12 +130,40 @@ public class DeploymentScanner extends ContainerLifeCycle implements Scanner.Bul | |||
// old attributes prefix, now stripped. | |||
private static final String ATTRIBUTE_PREFIX = "jetty.deploy.attribute."; | |||
|
|||
private static final Pattern EE_ENVIRONMENT_NAME_PATTERN = Pattern.compile("ee(\\d+)"); |
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 know we use "ee", but just in case, perhaps this should be
private static final Pattern EE_ENVIRONMENT_NAME_PATTERN = Pattern.compile("ee(\\d+)"); | |
private static final Pattern EE_ENVIRONMENT_NAME_PATTERN = Pattern.compile("ee(\\d+)", Pattern.CASE_INSENSITIVE); |
* EE names are compared by EE number, otherwise simple name comparison is used. | ||
*/ | ||
protected static final Comparator<String> ENVIRONMENT_COMPARATOR = (e1, e2) -> | ||
{ |
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 comparator will generate a lot of matchers, so perhaps take the returns where you can:
{ | |
{ | |
if (Objects.equals(e1, e2)) | |
return 0; |
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.
Better yet, why not just create an Index that is case insensitive and maps all the known environment names to an integer.
Index<Integer> environmentOrdinals = new Index.Builder<Integer>()
.caseSensitive(false)
.with("static", 1)
.with("core", 2)
.with("ee9", 9)
.with("ee10", 10)
.with("ee11", 11)
.build();
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 a conversation with @sbordet and @lorban this will be fixed in a followup PR.
I have an approach that will push the weight of the tracked environments (the ones allowed to be deployed to) via a change to the DeploymentScanner.configureEnvironment(String name, int weight)
, putting the weights into the XMLs instead.
That way the weights are not hardcoded, and can be adjusted by any user, and even add new environments (with their own weights) without the need to modify code.
+ `baseResource` to `jetty.deploy.baseResource` + `jetty.static.dirAllowed` to `jetty.deploy.baseResource.dirAllowed`
…tory'. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
…ectory' into fix/12.1.x/coredeploy-static-directory
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.
don't forget to start the followup PR
Fixes #12990