Skip to content

Commit

Permalink
contracts/resources param can now be Path again after #5329 done
Browse files Browse the repository at this point in the history
  • Loading branch information
BalusC committed Oct 14, 2023
1 parent 596906d commit e87d7d3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public WebappResourceHelper() {
WebConfiguration webconfig = WebConfiguration.getInstance();
FacesContext context = FacesContext.getCurrentInstance();
cacheTimestamp = webconfig.isOptionEnabled(CacheResourceModificationTimestamp);
BASE_RESOURCE_PATH = ensureLeadingSlash(ContextParam.WEBAPP_RESOURCES_DIRECTORY.getValue(context));
BASE_CONTRACTS_PATH = ensureLeadingSlash(ContextParam.WEBAPP_CONTRACTS_DIRECTORY.getValue(context));
BASE_RESOURCE_PATH = ensureLeadingSlash(ContextParam.WEBAPP_RESOURCES_DIRECTORY.getValue(context).toString());
BASE_CONTRACTS_PATH = ensureLeadingSlash(ContextParam.WEBAPP_CONTRACTS_DIRECTORY.getValue(context).toString());

}

Expand Down
12 changes: 7 additions & 5 deletions impl/src/main/java/jakarta/faces/annotation/FacesConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -376,14 +376,14 @@ public static enum ContextParam {
VIEWROOT_PHASE_LISTENER_QUEUES_EXCEPTIONS(UIViewRoot.VIEWROOT_PHASE_LISTENER_QUEUES_EXCEPTIONS_PARAM_NAME, Boolean.class, false),

/**
* Returns {@value ResourceHandler#WEBAPP_CONTRACTS_DIRECTORY_PARAM_NAME} as {@link String} with default of {@value ResourceHandler#WEBAPP_CONTRACTS_DIRECTORY_DEFAULT_VALUE}.
* Returns {@value ResourceHandler#WEBAPP_CONTRACTS_DIRECTORY_PARAM_NAME} as {@link Path} with default of {@value ResourceHandler#WEBAPP_CONTRACTS_DIRECTORY_DEFAULT_VALUE}.
*/
WEBAPP_CONTRACTS_DIRECTORY(ResourceHandler.WEBAPP_CONTRACTS_DIRECTORY_PARAM_NAME, String.class, ResourceHandler.WEBAPP_CONTRACTS_DIRECTORY_DEFAULT_VALUE),
WEBAPP_CONTRACTS_DIRECTORY(ResourceHandler.WEBAPP_CONTRACTS_DIRECTORY_PARAM_NAME, Path.class, Paths.get("/", ResourceHandler.WEBAPP_CONTRACTS_DIRECTORY_DEFAULT_VALUE)),

/**
* Returns {@value ResourceHandler#WEBAPP_RESOURCES_DIRECTORY_PARAM_NAME} as {@link String} with default of {@value ResourceHandler#WEBAPP_RESOURCES_DIRECTORY_DEFAULT_VALUE}.
* Returns {@value ResourceHandler#WEBAPP_RESOURCES_DIRECTORY_PARAM_NAME} as {@link Path} with default of {@value ResourceHandler#WEBAPP_RESOURCES_DIRECTORY_DEFAULT_VALUE}.
*/
WEBAPP_RESOURCES_DIRECTORY(ResourceHandler.WEBAPP_RESOURCES_DIRECTORY_PARAM_NAME, String.class, ResourceHandler.WEBAPP_RESOURCES_DIRECTORY_DEFAULT_VALUE),
WEBAPP_RESOURCES_DIRECTORY(ResourceHandler.WEBAPP_RESOURCES_DIRECTORY_PARAM_NAME, Path.class, Paths.get("/", ResourceHandler.WEBAPP_RESOURCES_DIRECTORY_DEFAULT_VALUE)),

/**
* Returns {@value PushContext#WEBSOCKET_ENDPOINT_PORT_PARAM_NAME} as {@link Integer} with default of {@code 0} (default 0 means the code will take the port from the request).
Expand Down Expand Up @@ -543,7 +543,9 @@ else if (type == Integer.class) {
}
}
else if (type == Path.class) {
return (T) Paths.get(value);
if (!value.startsWith("/")) {
return (T) Paths.get("/", value);
}
}
else if (type.isEnum()) {
for (Object constant : type.getEnumConstants()) {
Expand Down

0 comments on commit e87d7d3

Please sign in to comment.