Updated code after review.
Now a managed failed bean is restarted if its container is restarted.
Added more test cases.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Removed usage of StringUtil.
Moved fields together at top of the class to avoid
class initialization ordering issues.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Previously beans were started if they were not running, which
included them being in a STOPPING state.
Now beans are only started if they are in STOPPED state.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Updated code to reflect reviews.
Now lookup of system properties and server attributes is done in
ContextHandler.doStart(), so that the getter always return the
actual value (and this is good for JMX too).
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
+ Construction of PathResource now tests if path belongs
to the Default FileSystem or not. This important info
for later actions against the PathResource that would
need to know the File object for the Path object.
Non-Default FileSystem == null
Default FileSystem == Path.toFile()
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
+ SPARSE hint only applies to real os file systems or
default file systems, not for all file systems.
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
+ Reverting toFile().getInputStream() on PathResource
+ Adding RangeWriter concept for managing open resource
across multiple range writes
+ RangeWriter implementation delegates to HttpContent behaviors
Lookup is :
- Direct Buffer
- Indirect Buffer
- ReadableByteChannel (as SeekableByteChannel)
- InputStream
+ Adding unit tests for all RangeWriter implementation to ensure
that they behave the same way everywhere.
+ Making ResourceService use new RangeWriter implementation
+ Existing DefaultServletRangeTest still works as-is
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Made TRUST_ALL_CERTS implement X509ExtendedTrustManager,
so that it does not get wrapped in sun.security.ssl.AbstractTrustManagerWrapper,
which performs additional trust checks.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
+ Allowing CachedHttpContent._contentLengthValue actually hold
the `long` resource size (for the 4G variant on test)
+ Allowing BufferUtil to not throw Exception if resource length
is a positive value, but exceeds Integer.MAX_VALUE, opting instead
to return a null to prevent excessive memory usage. (fixes the 10G
variant of test)
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Issue #3700 if a location is null then consider if there are inclusions and/or exclusions when matching a class.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Removing Legacy Method Separators
* Restyling branch `jetty-9.4.x`
* Applying changes highlighted by checkstyle
* Applying XML restyling
* Fixing XML codestyle for IntelliJ
* Fixing XML style mistakes
* Revert "Applying XML restyling"
* Updating checkstyle for XML codestyle
* Reformatting pom.xml files
* Fixed empty string from line wraps
* Update intellij style to not do expression relative formatting. Reformatted code based on that.
* Increasing line split on Eclipse IDE Formatter to 512
* Restoring setting on internal default value.
+ IntelliJ will not export settings on things that set to their
internal default values.
We want to keep those values as a hedge against future default
value changes in future releases of IntelliJ.
* Fixing intellij codestyle
* do not allow single line simple methods
* misc checkstyle fixes
* re-exported with correct name and all values
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Signed-off-by: Greg Wilkins <gregw@webtide.com>
+ Reverting commit against IncludeExcludeSet
+ TypeUtil.getLocationOfClass is now MethodHandle based
+ new ModuleLocation class provides Module behaviors for Java 9+
Runtimes, and is used by new MethodHandle based getLocationOfClass
+ Jetty 10 doesn't need reflect complexity of ModuleLocation class
and can be inlined as real code in TypeUtil
+ TypeUtil.getLocationOfClass is only guaranteed to return the
URI to the container holding the location of the class, or null.
- The JAR file - most common
- The Directory - 2nd most common - a classpath dir entry
- The jrt:// module reference - if a module reference
+ URLResource support for results of getLocationOfClass is deprecated
(nothing was using it anyway)
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
+ TypeUtil.getLocationOfClass() respects Class.getClassLoader() of null
which means a class belonging to Boot ClassLoader, a Primitive, Void,
or a dynamic in-memory class. Using system classloader is incorrect
and invalid in Java 9+
+ Fixing IncludeExcludeSet.test() to always return TRUE or FALSE
never null.
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
* Issue #3755 Annotation example cleanup
+ Created JettyDistribution class as common utility to locate a jetty distribution for examples.
+ Fixed ServerWithAnnotations to correctly use the test-spec-webapp
+ Added AttributeContainerMap as a better way to treat attribute values as beans. This avoids them appearing twice in a dump and always associates them with their key.
+ Added NamingDump and use it in EnvConfiguration and jetty-plus.xml so that a server dump will contain dumps of the server local tree and each contexts java:comp/env tree
+ Improved the dump format of NamingContext and WebAppContext
+ Improved the toString format of several associated classes
Signed-off-by: Greg Wilkins <gregw@webtide.com>
+ StringUtil.replace()
+ StringUtil.replaceFirst()
+ StringUtil.sanitizeFileSystemPath()
Change existing usages of String.replace() to either
use new StringUtil.replace() or other methods elsewhere
that better suit that specific need.
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
* upgrade log4j2 version and fix log4j2.xml provided sample, add disruptor if users wants to use async logging
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
+ Removed regex usage
+ More unit tests
+ Adding jmh test for improvements (see PR #3716 for published results
of old vs new implementation)
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Added warnings for invocation of deprecated constructors and methods.
Moved methods exclusively used by XmlConfiguration from TypeUtil.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
+ Deprecated B64Code
+ All code that isn't B64CodeTest is now using java.util.Base64
+ B64CodeTest is updated to confirm change to java.util.Base64
is possible without change in behavior. Just have to make
sure you use the appropriate Encoder / Decoder for the task
at hand (default vs mime vs url)
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Added support for the X-Forwarded-Port header.
Reimplemented header scanning using more efficient Trie and MethodHandles
Signed-off-by: Greg Wilkins <gregw@webtide.com>
previously if there were no idle threads, QueuedThreadPool.execute()
would just queue the job and not start a new thread to run it
Signed-off-by: lachan-roberts <lachlan@webtide.com>
previously if there were no idle threads, QueuedThreadPool.execute()
would just queue the job and not start a new thread to run it
Signed-off-by: lachan-roberts <lachlan@webtide.com>
+ Even though this was reported against Windows, the solution
implemented should be sane for all OS or FileSystem combinations.
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
+ Even though this was reported against Windows, the solution
implemented should be sane for all OS or FileSystem combinations.
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
+ If optional Security Provider is configured, then use it consistently
for all security objects that take a Provider argument.
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
- Fixes deflater/inflater pool validation
- Removes validation tests of Flators for pool
- Eroding pool usage; fixes cleanup of Deflaters
Signed-off-by: bkmz <ilya.cherkasov@gmail.com>
as the QueuedThreadPool was being stopped, jobs could be taken out of
the QueuedThreadPool job queue but then not run
also cleaned up QueuedThreadPool _runnable code to simplify it
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Introduced SslContextFactory subclasses Client and Server.
Replaced all usages of SslContextFactory with either Client or Server
as required.
Refactored configuration checking so that warnings are not emitted
when non necessary.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* add jdk12 build stage
* test last release of infinispan for jdk12 build
* fix upperBound dependency for jboss logging
* upgrade juniper to 5.4.0 and disable infinispan test if JRE.JAVA_12
* Fixed annotations to exclude any JDK > 11 for 3 tests.
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added a SslHandshakeListener to SslConnection that performs
the host name verification (only on the client) if the
HostnameVerifier has been configured in SslContextFactory.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Made default endpointIdentificationAlgorithm=HTTPS to avoid warnings
when SslContextFactory is used on a server.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
+ Do not rely on Object.toString() for representing self (aka:this)
in the dump output. Using Object.toString() can result in lots
of duplicated information in the dump (and super long lines)
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Fixes Issue #3103 - HttpClient buffer leak found by dump improvements
The leak problem was an additional, unnecessary, call retain() in ResponseNotifier.notifyContent() that was leaking `ByteBuffer`s.
* Issue #3049 Warn on common SslContext vulnerable configurations
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Adding documentation notes for weak cipher warnings
Signed-off-by: WalkerWatch <ctwalker@gmail.com>
* Issue #3049 - SslContextFactory warnings on known bad config
+ Changes warnings from being a boolean on SslContextFactory
to being a logger named
"org.eclipse.jetty.util.ssl.SslContextFactory.config"
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
* Issue #3049 - SslContextFactory warnings on known bad config
+ Cleanup based on review
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
* Issue #3049 - SslContextFactory warnings on known bad config
+ Cleanup based on review
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Fixed dump() in QueuedThreadPool.
When the dump was not detailed, it was printing jobs=0 even if there
were jobs in the queue.
Given that it was adding no information (actually misleading information)
and that the queue size is already reported by QueuedThreadPool.toString()
the jobs are not dumped if the dump is not detailed.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Cleanup the dump implementation
* improved the clarity of utility methods for dump and updated most dump methods
* fixed upgrade filter dump
* Improved dump after review
* Moved dumpObjects to Dumpable
* implemented dumpBeans with dumpObjects
* less verbose dump
* Dump streams
* fixed dump test
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Introduced --jpms option in jetty-start to run Jetty from the module-path.
Introduced [jpms] sections in *.mod files, to specify JPMS command line
options that needs to be added to the command line generated by jetty-start.
Bumped java.transaction-api to 1.3 because it has Automatic-Module-Name.
Fixed ASM version lookup using ManifestUtils.
Fixed WebInfConfiguration.findAndFilterContainerPaths() to properly
scan the module-path, which may contain both files and directories.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Turns out that Package.getImplementationVersion() and similar return
null when running from the module path, so the logic in StartArgs
broke and prevented Jetty to start.
Introduced ManifestUtils to retrieve the manifest file from JarFile,
so that attribute entries can be retrieved independently from the JDK
version or module-path vs class-path.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
+ Changes needed for new Junit 5
+ Migrating from Vintage junit API to Jupiter junit API
+ Relies on SNAPSHOT jetty-test-helper
- this will be a formal release once this issue has been
resolved satisfactory
+ Have jenkins always pull latest SNAPSHOT for each build
+ Adding jetty.snapshots repository
+ Using surefire 2.22.0 per advice from junit
+ Ensuring <reuseForks>true</reuseForks> to work around issue junit-team/junit5#801
+ Disabling <forkMode>always</forkMode> in maven-surefire-plugin
due to bug https://github.com/junit-team/junit5/issues/801
+ OSGi tests must remain at vintage due to PaxExam
+ Moving from vintage TestingDir to jupiter WorkDir
+ Fixing imports to use jupiter, not vintage
+ Migrating vintage ExpectedException to jupiter assertThrows
+ Migrating vintage TestName to jupiter TestInfo
+ Migrating @RunWith(Parameterized.class)
to @ParameterizedTest with Argument Sources
+ Migrating assertTrue(val.contains(needle))
to assertThat(val, containsString(needle))
+ Aligning junit versions per recommendations from @sormuras
+ Adjusting parameter order change for assertEquals()
+ Test LifeCycle Annotation Migration
junit 4 | junit 5 / jupiter
------------ | -----------
@Before | @BeforeEach
@After | @AfterEach
@BeforeClass | @BeforeAll
@AfterClass | @AfterAll
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
* Issue #2798 thread budget warning default to available cores
* Issue #2798 - Testcase example for ExecutorThreadPool
* Issue #2798 - Better TestCases for ThreadPoolBudget
* Simplified
* Issue #2798 - ThreadPoolBudget improvements.
* Removed unused imports.
* Made fields private.
* Removed field info.
* Changed the logic to print the info on leases only when warning or throwing.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Cleanup of Graceful shutdown, plus ensure Connection:close if connector is shutdown for #2749
* WIP close connection when shutting down
* WIP use HttpChannel.Listener
* cleanups
* support graceful stop of a context
* only close connections if the connector is shutdown
* minor cleanups
* fixed toString and test
* fixed imports
* Move close logic to HttpConnection
* fixed generator to not override persistent
* Issue #2749 - Close connections on graceful shutdown.
* Small fix after review.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
+ ensuring SLOTH fix still works with updated testcase
+ Dump detection of JreDisabled:java.security only checked
default SSLEngine.enabledCipherSuites
New implementation changes meaning to be more general
JVM:disabled (as in not selected by default), and
only reports it as disabled in the dump if not specifically
included from the SSLEngine.supportedCipherSuites via
the SslContextFactory.includedCipherSuites configuration
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Improved defaulting values for the truststore, avoiding to default
the password, which is often missing for a truststore.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Issue #2597 - Improving UnixSocketTest behavior.
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
jnr doesn't like filename/path with strange character so use a new property for jenkins build with docker
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
* Adding test case to verify existing PathResource behavior
* Skipping Resource class usage in OSGi entirely
* Only using the URL class, and removing of conversions to
other more correct forms (File and URI)
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Introduced ProcessorUtils.setAvailableProcessor(int) to allow
usage in embedded code without resorting to system properties.
Refactored the static initializer to be testable.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Now newly created threads set _lastShrink to avoid they are immediately
removed from the pool if they happen to meet the shrink conditions.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>