Commit Graph

85 Commits

Author SHA1 Message Date
Lachlan 0e95953be3
Merge pull request #9043 from eclipse/jetty-12.0.x-httpcontentFactoryCleanup
Create StaticHttpContentFactory and other cleanups
2022-12-23 22:54:38 +11:00
Greg Wilkins c18e790858
Jetty 12 handler as boolean processor (#9035)
Alternative Handler architecture.

All Handlers are Processors, which now return a boolean to indicate the request has been accepted.
The request/response/callback are no longer modal, so there is no race with the boolean return.

Optimized PathMappings.
Avoid iterations if only ServletPathSpec instances
Avoid tests for empty mappings.
Better reset implementation
Improve suffix matching
Improve exact matching

Renamed HttpStream.getNanoTimeStamp() to getNanoTime().

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2022-12-19 16:02:26 +01:00
Lachlan Roberts 06f9e5ec18 Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-httpcontentFactoryCleanup 2022-12-19 21:46:05 +11:00
Lachlan Roberts 0f1420fbd7 changes from review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-12-16 17:17:12 +11:00
Lachlan Roberts 9270e62f78 rename of StaticHttpContentFactory
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-12-13 10:44:35 +11:00
Lachlan Roberts abc40afd89 cleanups for HttpContent Factories
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-12-13 09:55:55 +11:00
Olivier Lamy 139d3f2a41
response#getWriter should throw UnsupportedEncodingException in case of bad character encoding used (#9037)
* response#getWriter should throw UnsupportedEncodingException in case of bad character encoding used

Signed-off-by: Olivier Lamy <olamy@apache.org>
2022-12-13 08:47:52 +10:00
Simone Bordet da67879cf1
Fixed inconsistencies in naming for styleSheet.
Some classes had the second S capitalized, some did not, so now stylesheel -> styleSheet.

CSS has 2 "S" for "S"tyle"S"heet.
Also, the DOM API and the Swing API have "StyleSheet".

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-11-16 12:18:23 +01:00
Lachlan d72e39757d
Merge pull request #8767 from eclipse/jetty-12.0.x-HttpContent-Caching-Refactor
Refactor and improvements to HttpContent Factories
2022-11-16 12:42:32 +11:00
Lachlan Roberts eff404cf7d Re-enable and fix StatisticsServletTest for ee9
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-11-14 09:37:26 +11:00
Lachlan Roberts a4e773a7ab changes from review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-11-09 14:10:49 +11:00
Lachlan Roberts c0bb0272f7 fix release in CachingHttpContentFactory and always use ByteBufferPool
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-11-03 17:38:22 +11:00
Lachlan Roberts e28a528165 changes from review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-11-02 17:21:44 +11:00
Lachlan Roberts 7752720861 Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-HttpContent-Caching-Refactor 2022-10-25 16:44:53 +11:00
Lachlan Roberts 02e0a3993c cannot add ContentFactory to servletContext attribute as there may be multiple factories in a single context
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-25 16:39:42 +11:00
Greg Wilkins ac6abb307d
ResourceHandler set base resource as string (#8735)
* ResourceHandler set base resource as string

* ResourceCollection should not have a path

fixed tests
2022-10-21 09:32:54 +11:00
Lachlan Roberts 0e1bae4059 use RetainableByteBuffer for getBuffer in HttpContent
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-20 21:29:55 +11:00
Lachlan Roberts 8768725de9 separate evicting logic from CachingHttpContentFactory
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-20 10:37:38 +11:00
Lachlan Roberts 86da43a54a improve configuration options for HttpContent.Factory
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-20 10:00:04 +11:00
Joakim Erdfelt 259deea2f7
Jetty 12 - Resource `resolve()` and `newResource()` return null on resources that do not exist (#8702)
* Resource `resolve()` and `newResource()` return null on resources that do not exist
* Introduce `Resources` utility methods and use them
* Updating javadoc
2022-10-19 15:50:37 -05:00
Joakim Erdfelt 9061348ec4
Jetty 12 - Simplification of aliases in `PathResource` (Take 2) (#8734)
* simplify the PathResource.resolveTargetPath code
* changes to how PathResource handles aliases
* fix usages of Resource.getTargetUri()
* fixes for FileSystemResourceTest
* update javadoc for Resource.getTargetURI()
* rename getTargetURI to getCanonicalURI
* let resolveCanonicalPath return null if resource does not exist
* add test in PathResourceTest for broken symlinks
* some changes from review + optimization for exists()
* restore name to getTargetUri in Resource
* fix some tests related to PathResource changes
* revert changes to PathResource equals and hashcode
* also compare URI in PathResource
* checkAlias to resolveAlias
* PathResource cleanup
+ Adding comments about class fields.
+ Removing normalization from
  input/output/comparison flows.
+ Collapsing `resolveTargetPath`
  into `resolveAlias` to react
  accordingly to the exceptions
  that can flow out of Path.toRealPath().
+ Failure on Path.toRealPath() is never
  an alias, as the resource cannot ever
  be served anyway.
+ More comments in `resolveAlias()`
+ Failed / Bad / Nonexistent / Inaccessible
  resources are not aliases to anything.
* Renames of targetPath/targetUri
  `targetPath` to `realPath`
  `targetURI` to `realURI`
* Cleanup alias/aliasResolved booleans
* More testcase cleanup around not-exist
* Don't resolve alias on Error during toRealPath
* Add test to check how Alias check behaves if non-existent resource exists later

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Co-authored-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-19 11:17:23 -05:00
Lachlan Roberts ad7ae3cfc9 Rename all HttpContent factories
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-19 17:10:15 +11:00
Joakim Erdfelt ad406ac44c
Cleaning up test cases with eye on work/temp file management 2022-10-18 07:50:44 -05:00
Lachlan Roberts cccc16c03e Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-HttpContent-Caching-Refactor 2022-10-18 22:28:13 +11:00
Jan Bartel a3bf740f42 Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x 2022-10-17 11:36:40 +11:00
Simone Bordet a6f5e1fe8f
Merge pull request #8705 from eclipse/jetty-12.0.x-reenable-customrequestlog
Jetty 12 - Re-enabled RequestLog tests.
2022-10-14 10:30:12 +02:00
Lachlan Roberts 57f71ce77e extract the generation of getCompressedContentFormats to separate contentFactory
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-13 18:08:50 +11:00
Olivier Lamy 573f27fd88
cherry-pick of #7803 (#8708)
Signed-off-by: Olivier Lamy <olamy@apache.org>
2022-10-13 15:53:38 +10:00
Simone Bordet 557696653d
Re-enable RequestLog tests.
Re-implemented features that were commented out.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-10-12 17:46:49 +02:00
Lachlan Roberts 6771db40bf replace use of CachedContentFactory with CachingContentFactory
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-12 19:20:35 +11:00
Lachlan Roberts affa747b21 use jetty-core ResourceContentFactory in ee9
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-12 18:52:01 +11:00
Lachlan Roberts 6db4bf8aa0 remove getPrecompressedContents from HttpContent and ee9 impl
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-12 18:44:00 +11:00
Joakim Erdfelt bada439bac
Missed ee9 changes 2022-10-07 05:26:06 -05:00
Greg Wilkins 351fe53c9a
Fix #7891 regex pathInfo (#7892)
Fix 7891 regex pathInfo

+ Use the pathSpec methods to set servletPath and pathInfo when possible

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2022-10-06 15:44:01 -05:00
Greg Wilkins 024a053455
Issue #7748 - allow override of path mapping behavior in ServletContextHandler (#7614)
Added protected method to ServletHandler to allow other servlet mappings (eg regex) in embedded/extended usage

Signed-off-by: Greg Wilkins <gregw@webtide.com>
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2022-10-06 15:42:12 -05:00
markslater 1f844e8d57
#7863 Include value of first accept-encoding header where multiple accept-encoding headers are given. (#7864)
Signed-off-by: markslater <mark.slater@mail.com>
2022-10-06 13:10:25 -05:00
Lachlan 05a4b96632
Merge pull request #8621 from eclipse/jetty-12.0.x-CachedContentFactory
Fix Caching ContentFactories in Jetty-12
2022-10-04 18:57:29 +11:00
Joakim Erdfelt 597a6af31d
Jetty 12 : `Descriptor` cleanup (#8611)
+ Sanity check Resource being provided
+ Descriptor toString changed to include full URI to descriptor
  so that it can be used consistently in Logging and Exception messages.
+ New Descriptor.toURI() for use in Servlet Source and other logging messages
+ Servlet Source value is now the URI of the Descriptor
+ More cleanup around `Source` location/name
   .getResource() must be a Resource
   as it's used in the AnnotationIntrospector
   all others use new .getName()
   Not all location/name usages can be loaded as
   a Resource.
2022-09-28 09:09:16 -05:00
Lachlan Roberts bed034c22d more fixes for test cases in DefaultServletTest
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-09-27 11:01:56 +10:00
Simone Bordet 910bb41702 Removed duplicate client transport tests already present in core.
Properly implemented request and response trailers for all the transports, both client and server.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-09-21 20:03:49 +02:00
Joakim Erdfelt 54cc1a3ff9
Merge remote-tracking branch 'origin/jetty-12.0.x' into fix/jetty-12-pathresource-alias-detection-in-jarfile 2022-09-06 19:36:53 -05:00
Simone Bordet 8953873e67
Merged branch 'jetty-11.0.x' into 'jetty-12.0.x'.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-09-06 12:31:54 +02:00
Olivier Lamy 0acd7df84b
jetty 12.0.x error unwrap servlet exception (#8491)
* unwrap servlet exception per default as expected by TCK

Signed-off-by: Olivier Lamy <oliver.lamy@gmail.com>
2022-09-03 13:54:53 +10:00
Joakim Erdfelt 6191377504
Proper "?" vs "%3F" handling 2022-08-16 16:31:42 -05:00
Joakim Erdfelt d16b1cd595
Merge remote-tracking branch 'origin/jetty-12.0.x' into fix/jetty-12-pathresource-alias-detection-in-jarfile 2022-08-15 18:39:21 -05:00
Lachlan Roberts f19577c197 Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-8426-aliaschecker-review 2022-08-15 17:05:58 +10:00
Lachlan Roberts 2c42c0de83 Issue #8456 - serve jetty-dir.css as resource in ee10 ResourceService
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-08-15 15:33:28 +10:00
Lachlan Roberts ffc14a80b9 Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-8426-aliaschecker-review 2022-08-15 13:16:51 +10:00
Greg Wilkins af5fecd18d
Jetty 12 : Rename resourceBase to baseResource (#8310)
* rename to baseResource
2022-08-15 12:24:13 +10:00
Lachlan Roberts 8e172f311e Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-8426-aliaschecker-review 2022-08-15 10:40:59 +10:00