Commit Graph

142 Commits

Author SHA1 Message Date
Joakim Erdfelt 2badb454b3
Fixed war file unpacking 2022-10-17 15:22:32 -05:00
Joakim Erdfelt 62db79b791
Improved addClassPath and addJars behavior
+ Less code
+ Corrected javadoc
2022-10-17 15:22:16 -05:00
Joakim Erdfelt bb887c9c81
Don't add bad URIs, and log if they don't point to anything 2022-10-17 15:22:00 -05:00
Joakim Erdfelt b1c00223aa
Protect on bad container resources 2022-10-17 15:21:33 -05:00
Joakim Erdfelt 02142c2e30
Improved warning on bad descriptor 2022-10-17 15:21:19 -05:00
Joakim Erdfelt feadf3f56e
Improved setup of TestMetaData 2022-10-17 15:18:02 -05:00
Joakim Erdfelt d84de5d847
Improved reliability of test 2022-10-17 15:17:27 -05:00
Joakim Erdfelt 6b2425a23f
Improved ClassMatcher/Location behavior.
+ Reduces need for Resource / ResourceFactory.
+ Corrected path equals logic
2022-10-17 15:16:50 -05:00
Joakim Erdfelt f27e4e7273
Improved ClassMatcher/Location behavior.
+ Reduces need for Resource / ResourceFactory.
+ Corrected path equals logic
2022-10-17 15:16:39 -05:00
Jan Bartel d47c25d7c5 Reenable ee10 WebAppDefaultServletTest 2022-10-17 14:05:22 +11:00
Joakim Erdfelt 45e706cb67
Move Resource.combine() methods to ResourceFactory 2022-10-13 14:08:21 -05:00
Joakim Erdfelt 28d448aef6
Fixing directory location name for additional classpath elements 2022-10-13 09:59:07 -05:00
Simone Bordet c785f08b17
[Jetty 12] Made WebSocket over HTTP/2 work. (#8685)
* Made WebSocket over HTTP/2 work.

Re-enabled tests, and restored HTTP2StreamEndPoint,
as well as implemented getTunnelSupport() for HTTP/2.

Removed from HttpStream methods for upgrade that are
not necessary anymore.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-10-07 12:50:42 +02: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
Joakim Erdfelt 97eedaf9a6
Jetty 12 - Delay Resource Alias calculation until it's requested/needed (#8573)
* Delay Resource alias calculation until it's requested.
* Rename .getAlias() to .getTargetURI()
* PathResource resolveTargetAliasPath to resolveTargetPath
2022-09-27 13:03:47 -05:00
Joakim Erdfelt 3eca6901cc
Jetty 12 : ResourceFactory.of(WebAppContext) to WebAppContext.getResourceFactory() (#8610)
* ResourceFactory.of(WebAppContext) to WebAppContext.getResourceFactory()
2022-09-23 05:38:21 -05:00
Joakim Erdfelt 95bf791b71
Jetty 12 - Improve FileID and use where appropriate (#8589)
* Use FileID where appropriate
* Adding FileID.matchesExtension
* Fixing demo modules start test
2022-09-20 09:35:50 -05:00
Joakim Erdfelt 9668d614d9
Issue #8474 - Jetty 12 - `Resource.list()` API change + `Resource.getFileName()` addition (#8582)
* Issue #8474 - Resource.list and Resource.getFileName work
* Correcting signature of Resource.list and use it
* Introduce Resource.getFileName and use it
* Adding URIUtil.addPath() test to show file+str behavior

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2022-09-14 15:48:01 -05:00
Joakim Erdfelt 84c6f30dfd
Merge remote-tracking branch 'origin/jetty-12.0.x' into fix/jetty-12-pathresource-alias-detection-in-jarfile 2022-09-07 05:52:41 -05:00
Joakim Erdfelt 1cd0ac4959
Changes from review 2022-09-06 15:12:32 -05:00
Joakim Erdfelt 7f88878df9
Change signature of Resource.lastModified()
+ Now returns Instant
2022-09-06 13:21:25 -05:00
Joakim Erdfelt 180d68f585
Updating WebAppDefaultServletTest 2022-08-16 19:25:27 -05:00
Greg Wilkins 6cc10d611d Added tests for ServletContext resources from collections 2022-08-15 19:58:01 +10:00
Greg Wilkins edba0c36c7 Work around for #8462 ee10 handling of %2F
This is a provisional workaround for #8462 that fixes the bugs in URIUtil that were preventing encoded %2F being seen as an alias.

However, the better ultimate fix would be to see an encoded request as a request for a path segment that includes %2F.
2022-08-15 13:58:29 +10:00
Greg Wilkins db359ff8a5 Reenable ee10 protected target exceptions 2022-08-15 13:05:44 +10:00
Greg Wilkins af5fecd18d
Jetty 12 : Rename resourceBase to baseResource (#8310)
* rename to baseResource
2022-08-15 12:24:13 +10:00
Ludovic Orban 01cdfb19d4
restore mount leak detection (#8457)
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2022-08-13 08:25:39 +10:00
Greg Wilkins 7d2f9fa3c0 Fixed build 2022-08-12 08:48:11 +10:00
Jan Bartel 4475537339 Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-8447-remove-ELContextCleaner-ee10 2022-08-12 07:09:34 +10:00
Jan Bartel d35892c0c2 Issue #8447 Remove ELContextCleaner for ee10 2022-08-11 17:55:37 +10:00
Greg Wilkins 20bab8a471 Fix build 2022-08-11 16:34:10 +10:00
Greg Wilkins a0d6f42e73 Fix #8442 server propagation
Test setServer propagation
protect from inadvertent null setting
2022-08-11 09:05:12 +10:00
Joakim Erdfelt 842af3ed22
Avoid recreating `Resource` during container/jar pattern filtering in `MetaInfConfiguration`
* Delete PatternMatcher.java
2022-08-10 16:12:15 -05:00
Joakim Erdfelt 9312359b13
Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x 2022-08-10 12:59:37 -05:00
Joakim Erdfelt 0023281e3f
Adding in-code comments about WebAppContext.getWebInf behavior 2022-08-10 12:59:29 -05:00
Jan Bartel 42f72268cf
Jetty 12 : #8408 Support new `<cookie-config>` concepts in Servlet 6 (#8420)
* Issue #8408 Implement new session cookie attributes
2022-08-10 16:33:08 +10:00
Greg Wilkins 408de26ec2 Created core-demo and updated demo root
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2022-08-10 12:04:39 +10:00
Joakim Erdfelt 199a9cd2ad
Jetty 12 : XML namespace cleanup (#8406)
* Adding Servlet 6 XML Entities
* Fixing bad xsi:schemaLocation entries
* Update all jetty-ee10 web XMLs to JakartaEE version 6.0 based
* Using XML Catalog
* Introducing catalogs for:
   - default XML xsd/dtd (catalog-org.w3.xml)
   - Configure dtd (catalog-configure.xml)
   - EE10 Servlet 6 xsd/dtd (catalog-ee10.xml)
   - EE9 Servlet 5 xsd/dtd (catalog-ee9.xml)
   - EE8 Servlet 4 xsd/dtd (catalog-ee8.xml)
* New XmlParser.addCatalog(URI catalogXml, Class<?> classBase)
   to allow the loading of a catalog which has it's resources
   referenced via the classBase.getResource(name)
* WebDescriptor uses Environment to load appropriate catalog.
* Remove XmlParser.redirectEntity(String, String)
2022-08-09 06:34:29 -05:00
Joakim Erdfelt fe21198499
Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-rework-resource-factory 2022-08-05 11:11:39 -05:00
Joakim Erdfelt a864a9313b
Remove System.err output 2022-08-05 10:40:14 -05:00
Joakim Erdfelt 21a40f60a7
Inline ResourceFactory 2022-08-05 10:31:26 -05:00
Joakim Erdfelt 8877f52dd7
Add WebAppContext.getResourceFactory() 2022-08-04 17:22:26 -05:00
Joakim Erdfelt 532933be0b
jetty-ee#-webapp mount fixes 2022-08-04 13:35:30 -05:00
Joakim Erdfelt 6f6c327d8e
Improve reliability of TempDirTest 2022-08-04 12:38:23 -05:00
Simone Bordet c077bbecaa
Jetty 12.0.x MultiPart (#8201)
Moved multipart test files to jetty-http.

Introduced jetty-http `MultiPart` class and made `MultiPart.Parser` non-blocking and lenient on newlines.
Made `MultiPartCaptureTest` to pass.

Moved o.e.j.server.MultiPartParserTest tests to o.e.j.http.MultiPartTest.

Renamed MultiPartFormInputStreamTest to MultiPartsTest.

Introduced class o.e.j.server.MultiParts, a CompletableFuture of Parts
that can be used asynchronously in Handlers and in general in core Jetty.

Implemented multi-part handling in ee10.

Implemented DelayedHandler.UntilMultiPart.

Introduced MultiPart.ContentSource as the multipart "generator".

Replaced ByteBuffer/boolean pair with Chunk and implement Chunk slicing & improve retainability for MultiPart parser.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
Co-authored-by: Ludovic Orban <lorban@bitronix.be>
2022-08-04 17:03:40 +02:00
Ludovic Orban d50aa39549 fix mount leaks
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2022-08-03 20:44:17 +02:00
Ludovic Orban dd72e844a3 fix tests
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2022-08-03 18:04:01 +02:00
Ludovic Orban 50c19d317b Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-rework-resource-factory 2022-08-03 17:00:24 +02:00
Ludovic Orban 5ca51c97ad hide ResourceFactory internals and cleanup Mount leftovers
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2022-08-03 16:59:02 +02:00
Joakim Erdfelt 6ce295ce7a
Remove static Resources.isContainedIn API 2022-08-03 06:59:17 -05:00
Ludovic Orban cb348c8d15 rename of() -> combine()
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2022-08-03 13:06:32 +02:00
Ludovic Orban fb0290c88a replace ROOT references with root()
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2022-08-03 12:51:57 +02:00
Ludovic Orban b3dbfad97d move newSystemResource to ResourceFactory
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2022-08-03 12:43:08 +02:00
Ludovic Orban f943d095f4 rework ResourceFactory and Resource according to redux3 prototype
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2022-08-03 11:32:21 +02:00
Joakim Erdfelt 4e4d516952
Fixing compilation 2022-08-02 16:07:39 -05:00
Joakim Erdfelt e848dd0852
Fixing missing XML entities
+ Adding missing core XML entities
  to jetty-xml project
  * datatypes.dtd
  * xml.xsd
  * XMLSchema.dtd
+ registering core XML entities
  in XmlParser itself
+ adding new tests
+ Descriptor now catches SAXException
+ WebDescriptor doesn't worry about
  core XML entities
2022-08-01 21:48:09 -05:00
Joakim Erdfelt 84f6dc7f4c
Review of Resource throwables 2022-08-01 21:48:08 -05:00
Joakim Erdfelt e1ebef2ca6
Changing contract of Resource.resolve(String)
No longer throws IOException
2022-08-01 21:48:07 -05:00
Joakim Erdfelt 98fa52ef30
Updating FileID.isTld(Path) 2022-08-01 21:48:07 -05:00
Joakim Erdfelt dd7dda2c53
Move FileID from deploy to util
+ Move static methods from other
  places to FileID or URIUtil
  - MultiReleaseJarFile
  - Resource
  - MetaInfConfiguration
+ Improve testing of URIUtil and FileID
2022-08-01 21:48:00 -05:00
Joakim Erdfelt caff1b036b
Jetty 12 - Cleanup MultiReleaseJarFile to use newFileSystem behaviors built into JVM (#8328)
* Cleanup MultiReleaseJarFile to use newFileSystem behaviors built into JVM
* Adding more testing to MultiReleaseJarFile
* Updating AnnotationParser and MetaInfConfiguration
* Created URIUtil.streamOf(URLClassLoader) to aid
  in proper conversion of URLClassLoader.toURLs to URIs
* Introduce URIUtil.fixBadJavaIoFileUrl
  Addresses bad java.io.File.toURL().toURI() issues
  file:/path to file:///path
* Better URI pool/key behaviors in FileSystemPool
* no arg AnnotationParser uses ASM_VERSION
2022-07-29 10:08:32 -05:00
Joakim Erdfelt c6c0eb0313
Jetty-12 : Immutable ResourceCollection and Context based mount management (#8337)
* Immutable ResourceCollection with mount management.

* Internal List<Resource> is now immutable so that .getResources() cannot be modified.
* Improved Resource.toJarFileUri implementation that keeps the deep archive references
* Introducing Resource.mountCollection() methods
  + ResourceCollection is now a private class
  + Resource.mountCollection() returns a Mount
  + Places that use this technique are now putting the Mount in the context's beans for the context to close those mounts.
* Cleanup names/comments in FileSystemResourceTest
* Adding missing test of attempting to create a Resource from a URI `jar:file:foo.jar!/` while not mounted.
* Reworked ResourceCollection behaviors based on feedback.
  + Eliminated all Resource.mountCollection() methods except the Collection<URI> one.
* Eliminated Resource.mountIfNeeded(Resource)
* Eliminated Resource.fromList implementations
* Introduced @gregw Resource.of() implementations
* Introduced Resource.split() to honor old split logic from Jetty 9/10/11, with glob support, but now it only converts to List<URI>
* Remove IOException from Mount.root() method
* ResourceCollection now flattens and uniques any nested ResourceCollection entries it encounters
* Expanded ResourceCollectionTest to cover more code paths
* Add ResourceTest for new split() method
* Fixing testcase to use a directory that exists on setExtraClasspath
* Increase reliability of WebAppContextTests
* Updates for working with webapp.extraClasspath
* Introduced Resource.unwrapContainer to help in servlet cases where the raw JAR path should be represented in a ServletContext attribute.
* Made FileSystemPool.containerUri just use new Resource.unwrapContainer
* webapp MetaData updated to use URIs references to Libs (not File objects)
* jetty-ee#-maven-plugin use URIs for its classpath tracking to aid in mounting issues later
* webapp extraClasspath supports raw JAR references as well as glob now, supported by Resource.split(String)
2022-07-28 08:59:17 -05:00
Ludovic Orban b1d5f908a6 fix mounting/unmounting lifecycle of TLD resources
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2022-07-28 10:16:02 +02:00
Ludovic Orban 905352816d make sure TLD file actually is a file
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2022-07-28 10:16:02 +02:00
Ludovic Orban a84a86d820 handle review comments
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2022-07-28 10:16:02 +02:00
Ludovic Orban 9f0463b545 remove old Resource defaultUseCache mechanism
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2022-07-28 10:16:02 +02:00
Ludovic Orban 0c0c333970 get rid of EmptyResource
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2022-07-27 16:04:22 +02:00
Ludovic Orban 4856a7d065 keep, un-deprecate and rename Resource.getReadableByteChannel() and Resource.getInputStream()
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2022-07-27 16:04:22 +02:00
Greg Wilkins 2275e1c2c6
Refactored MultiException into ExceptionUtil (#8340) 2022-07-27 18:07:57 +10:00
Greg Wilkins 9b1cb302b6
Cleanup Resource.Mount (#8284)
* Introduced the `mountIfNeeded` method to cleanup mount code and reduce checks for "jar:"
 * Fixed Quickstart mounting close.
 * Improved error message
 * Fixed tests for mount cleanup
 * More forgiving newResource(URI) implementation
 * Even more forgiving newResource(URI) implementation
2022-07-13 09:25:14 +10:00
Ludovic Orban 23a0203547 rework Resource API (#8106)
* remove Resource.getFile() and replace its usages with Resource.getPath()
* remove all public PathResource ctors + add non-leaky FS mounting mechanism + interpret string as Path when not a schemed URI
* rename Resource.getResource to Resource.resolve, specifying that the subpath is URI-path-interpreted
* remove useless API methods + deprecate all path-related API
* make subpaths beginning with / resolved as relative to the given uri
* introduce filesystem pooling and generalize resource resolving code
* remove URLResource
* remove unneeded factory method
* both file: and jrt: should not be pooled
* move deprecated impls from PathResource down to Resource + fix some tests
* handle Resource's pointing to non-existent jar files
* Force Resource URIs to end with "/" when the resource is a directory
* Produce warning if attempting to release a mounted filesystem uri that doesn't exist in the pool.

Co-authored-by: Greg Wilkins <gregw@webtide.com>
Co-authored-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Co-authored-by: Ludovic Orban <lorban@bitronix.be>
2022-07-12 10:10:30 +10:00
Jan Bartel 8f853f7fb6 Fix pattern to scan for container jars to match servlet api 2022-07-05 11:03:51 +10:00
Greg Wilkins 8ecb4b8669 Fixed merge 2022-07-04 12:34:53 +10:00
Greg Wilkins e8f09cb3e0 restored ee10 test
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2022-07-04 11:43:02 +10:00
Greg Wilkins fd5ae09449 move ee10 test back to ee9
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2022-07-04 11:38:22 +10:00
Greg Wilkins fe83ea87dc Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x 2022-07-04 11:32:33 +10:00
Greg Wilkins ea5bedf072
Jetty 12.0.x deployment (#8208)
Deploy webapps for different environments from the same webapps directory.
The maximal environment known to the AppProviders is used as the default environment.
An explicit environment can be set in a properties file for an application, which is also used for property substitution in any context xml file.
2022-06-30 09:51:19 +10:00
Jan Bartel 5c267ce7ed
Jetty 12.0.x eex jettymavenplugin (#8200)
* Fix ee9/10 jetty maven plugin and refactor it tests
2022-06-29 17:18:18 +10:00
Jan Bartel bfaf0facb5 Reenable ee10 MetaInfConfigurationTest. 2022-06-28 14:09:49 +10:00
Jan Bartel f8ae3837c4 Fix resourceBase in MetaInfConfiguration; fix typo in ee10-demo-jetty.xml 2022-06-06 11:32:36 +10:00
Jan Bartel 3b99c8c4e7 WebAppContext and ServletContextHandler must share ServletApiContext instance. 2022-06-01 16:26:36 +10:00
Jan Bartel d69202f3d8 Fix ee10 jsp module 2022-05-31 11:20:24 +10:00
Jan Bartel 43c662a3ac Fix more ee10 modules. 2022-05-30 18:50:23 +10:00
Jan Bartel eea3a11dd7 WIP deploy ee10 and ee9 webapps. 2022-05-25 17:35:52 +10:00
Greg Wilkins 8677f5fac5 Jetty-12 Deploy
Cleanup dump and environment invocation
2022-05-21 09:56:01 +10:00
Greg Wilkins 315600184d Jetty-12 Deploy
hacky fix to dumping attributes
2022-05-20 17:25:21 +10:00
Greg Wilkins 22c1a2e901 Fixed webdefault-eeX.xml references 2022-05-13 10:16:06 +02:00
Simone Bordet bfcd7845eb
Fixed references to webdefault.xml that now are webdefault-ee9.xml and webdefault-ee10.xml.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-05-12 17:01:42 +02:00
Greg Wilkins f90e73ddb5 WIP deploying webapps 2022-05-10 00:02:06 +02:00
Greg Wilkins 85af234ed6 WIP for deployer 2022-05-04 19:41:38 +02:00
Greg Wilkins 428a9d568f Reverted to use Resource as BaseResource 2022-05-03 19:28:53 +02:00
Greg Wilkins 0a32147e89 Jetty-12 Restructure
Copied ee10 from hackathon branch

Co-authored-by: Greg Wilkins <gregw@webtide.com>
Co-authored-by: Jan Bartel <janb@webtide.com>
Co-authored-by: Joakim Erdfelt <joakim@webtide.com>
Co-authored-by: Lachlan Roberts <lachlan@webtide.com>
Co-authored-by: Ludovic Orban <lorban@webtide.com>
Co-authored-by: Olivier Lamy <olamy@webtide.com>
Co-authored-by: Simone Bordet <sbordet@webtide.com>
2022-05-03 15:52:44 +02:00