Skip to content
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 #8296 and #8259 - AllowedResourceAliasChecker improvements #8315

Merged
merged 6 commits into from
Aug 8, 2022

Conversation

lachlan-roberts
Copy link
Contributor

@lachlan-roberts lachlan-roberts commented Jul 18, 2022

Issue #8296 and #8259

  • change AllowedResourceAliasChecker and SymlinkAllowedResourceAliasChecker to allow custom resource base directory, so we can more easily support use case of multiple default servlets with different resource bases from Symlinks cause 404 with DefaultServlet when its "resourceBase" is different from ContextHandler's #8259
  • allow AllowedResourceAliasChecker to be used when ContextHandler is still starting, by always extracting resource base when needed before lifeCycleStarted is called.
  • resolve symlinks in the baseResource during ContextHandler.doStart() so that not every path from it is also an alias.

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
…Handler.doStart()

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
@lachlan-roberts lachlan-roberts marked this pull request as ready for review July 22, 2022 00:00
Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few niggles

Comment on lines 862 to 867
{
// We may have symlink to baseResource, try to resolve symlink if possible.
File file = getBaseResource().getFile();
if (file != null)
_baseResource = Resource.newResource(file.toPath().toRealPath());

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure the WebAppProvider in the deployer does something similar. Perhaps wrap up in a utlility static method on Resource

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a static method on Resource called resolveAlias.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah but it needs javadoc!

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
gregw
gregw previously approved these changes Jul 27, 2022
Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved... but add some javadoc to the new method before merging.

Comment on lines 862 to 867
{
// We may have symlink to baseResource, try to resolve symlink if possible.
File file = getBaseResource().getFile();
if (file != null)
_baseResource = Resource.newResource(file.toPath().toRealPath());

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah but it needs javadoc!

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants