-
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
Fix Caching ContentFactories in Jetty-12 #8621
Fix Caching ContentFactories in Jetty-12 #8621
Conversation
Signed-off-by: Lachlan Roberts <[email protected]>
Signed-off-by: Lachlan Roberts <[email protected]>
…ressedFormats to DefaultServlet Signed-off-by: Lachlan Roberts <[email protected]>
Signed-off-by: Lachlan Roberts <[email protected]>
Signed-off-by: Lachlan Roberts <[email protected]>
…e HttpContent.ContentFactory for parent in CachingContentFactory Signed-off-by: Lachlan Roberts <[email protected]>
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.
Restore the writeHttpError usage.
Note that the removal of a header from the response has to be done through the Servlet API (in case of wrapping), so that raw ETAG removal also needs to be done at the Servlet level.
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ResourceService.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ResourceService.java
Outdated
Show resolved
Hide resolved
…se is 304 Signed-off-by: Lachlan Roberts <[email protected]>
Signed-off-by: Lachlan Roberts <[email protected]>
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.
Minor things, please fix them, but LGTM.
jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/CachingContentFactory.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
@Override | ||
public void release() | ||
{ | ||
_content.release(); | ||
_precompressedContent.release(); |
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.
Should it not release both _content
and _precompressedContent
?
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 don't know. The _content
will be accessible separately to the pre-compressed version and will have separate entry in the cache, so maybe this would result in a double release?
At the moment it looks there are no implementations of HttpContent.release()
which actually do anything, so this currently has no effect.
{ | ||
return !resource2.lastModified().isAfter(resource1.lastModified()); | ||
} | ||
|
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 found the original version more readable, but ok.
Rename to isNewerThanOrEqual()
.
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 original version was wrong and was causing many test failures.
Signed-off-by: Lachlan Roberts <[email protected]>
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.
HttpContent
should implement Retainable
otherwise we may leak resources or release them while they're in use. But that should be addressed in another PR IMHO.
This PR removes the old
CachedContentFactory
which was only used in tests, and brings over some of its functionality to theCachingContentFactory
.Fixes the
CachingContentFactory
to make it pass tests, and re-enable the tests.