Commit Graph

131 Commits

Author SHA1 Message Date
Lukasz Lenart 0a8b111e36 WW-5537 fix(core): resolve classloader/memory leaks during Tomcat hot deployment (#1631)
* WW-5537 fix(core): resolve classloader/memory leaks during Tomcat hot deployment

Introduce InternalDestroyable interface with container-based discovery to
clean up static caches, daemon threads, and shared references that pin the
webapp classloader after undeploy. This prevents OutOfMemoryError (Metaspace)
on repeated hot deployments.

Changes:
- Add InternalDestroyable/ContextAwareDestroyable interfaces for cleanup hooks
- Clear OGNL, Component, ScopeInterceptor, DefaultFileManager static caches
- Stop FinalizableReferenceQueue daemon thread and null its classloader
- Clear FreeMarker template/introspection caches from ServletContext
- Replace ContainerHolder ThreadLocal with volatile to prevent thread-pool leaks
- Clear static dispatcherListeners list on Dispatcher cleanup
- Add JSONCacheDestroyable for json plugin cache cleanup
- Register all destroyables via struts-beans.xml / struts-plugin.xml

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* WW-5537 chore(showcase): add log4j-web for proper Log4j2 lifecycle in Servlet container

Without log4j-web, Log4j2 SoftReferences delay classloader GC after undeploy.
The log4j-web module provides Log4jServletContextListener which ensures proper
Log4j2 shutdown during ServletContext destruction.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* WW-5537 fix(core): use ThreadLocal with generation counter in ContainerHolder

Replace the volatile shared reference with a ThreadLocal backed by a volatile
generation counter. Per-request clear() only affects the current thread (safe
for concurrent requests and tests). On undeploy, invalidateAll() advances the
generation counter so idle pool threads detect staleness on next access and
self-clear, preventing classloader leaks without breaking test isolation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-29 07:17:44 +02:00
Lukasz Lenart f644ea54e2 WW-5618 feat(json): add configurable limits to JSON plugin for DoS prevention (#1626)
Add configurable limits to the JSON plugin to prevent denial-of-service
attacks via malicious JSON payloads. Limits are enforced directly in the
existing JSONReader class without breaking backward compatibility (no
interface extraction or class renames).

New configurable constants (struts-plugin.xml defaults):
- struts.json.maxElements (10000) - per-container element count
- struts.json.maxDepth (64) - maximum nesting depth
- struts.json.maxLength (2097152) - maximum input length in chars
- struts.json.maxStringLength (262144) - maximum string value length
- struts.json.maxKeyLength (512) - maximum object key length

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 12:11:22 +01:00
Lukasz Lenart bfebc3e4a1 WW-4428 feat(json): add java.time serialization and deserialization support (#1616)
- Add serialization support for LocalDate, LocalDateTime, LocalTime,
  ZonedDateTime, OffsetDateTime, and Instant in DefaultJSONWriter
- Add deserialization support for the same types in JSONPopulator
- Support @JSON(format=...) custom formats for all temporal types
- Add Calendar deserialization support (was serialize-only)
- Add comprehensive tests including custom formats, null handling,
  malformed input, and round-trip serialization/deserialization

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 08:43:08 +01:00
Kusal Kithul-Godage ebedd7391f WW-3714 Marker interface migration follow-up 2024-10-22 13:55:46 +11:00
Kusal Kithul-Godage f9953938f7 WW-5440 Add missing annotations 2024-07-13 21:57:26 +10:00
Lukasz Lenart c99526ce1f WW-5296 Uses proper DTDs 2023-05-16 20:22:03 +02:00
Lukasz Lenart ea7fba2846 WW-5259 Extracts UrlHelper#parseQueryString into a dedicated bean 2022-11-07 12:13:43 +01:00
Lukasz Lenart 6135a71335 WW-4514 Extracts parameters string building into a dedicated class with a proper extension point 2022-11-04 08:49:57 +01:00
Lukasz Lenart 3774ffa7c3 WW-5234 Improves DTD definitions to use proper URL 2022-09-27 09:21:03 +02:00
Lukasz Lenart 980387e91c WW-5220 Moves JUnit related test into the JUnit plugin
Also moves all the plugin classes under junit package
2022-09-04 11:59:01 +02:00
Lukasz Lenart fbdcd2c4a7 WW-5063 Adds tests to cover new functionality 2020-12-24 16:39:29 +01:00
Lukasz Lenart f2540192bf WW-5063 Adds null check for ActionInvocation 2020-12-24 15:45:46 +01:00
yilinwang fb49bc4705 classMethods 2020-12-07 04:02:14 -06:00
yilinwang 40d529c439 sort getMethods 2020-12-07 02:44:51 -06:00
Lukasz Lenart b96509f077 Merge branch 'master' into action-context-boost 2020-05-03 12:08:29 +02:00
Lukasz Lenart 12539edf5a Merge pull request #406 from apache/WW-5070-root-action-model
[WW-5070] Adds more sophisticated logic to search for the Root
2020-05-03 12:01:29 +02:00
Lukasz Lenart d826efb9d0 WW-5070 Re-phrases JavaDoc for setRoot() method 2020-04-27 08:20:39 +02:00
Lukasz Lenart 48435c4209 WW-5070 Uses else if to avoid double operation on stack 2020-04-27 08:19:29 +02:00
Lukasz Lenart 333f781207 WW-5070 Generates a new serialVersionUID 2020-04-27 08:17:35 +02:00
Lukasz Lenart 592c942c76 WW-4043 Moves TestUtils into junit-plugin 2020-04-26 09:31:18 +02:00
Lukasz Lenart 19c71ff153 WW-5070 Adds more sophisticated logic to search for the Root 2020-04-25 09:24:36 +02:00
Lukasz Lenart 8e6815e115 WW-4789 WW-3788 Stops using get() 2020-04-08 08:22:00 +02:00
Lukasz Lenart 273776e13b WW-4789 WW-3788 Introduces helper methods to allow build fluent API 2020-04-07 07:59:11 +02:00
Lukasz Lenart dfda16d743 WW-4789 WW-3788 Introduces helper methods to allow build fluent API 2020-04-05 17:48:59 +02:00
Lukasz Lenart f4aa4ee09a WW-4789 WW-3788 ActionContext refactoring 2020-04-05 07:46:56 +02:00
Aleksandr Mashchenko be457f4241 WW-5009 EmptyStackException in JSON plugin due to concurrency 2019-02-03 21:41:08 +02:00
Lukasz Lenart 2a60c1eee6 [WW-4981] Adds support for JDK11 (#270)
* Upgrades test dependencies

* Drops unused lib

* Uses AssertJ instead of FestAssert

* Upgrades Surefire Maven Plugin to 2.22.1

* Downgrades to AssertJ 2.x to support JDK7

* decouple tests from java version

Refactor a java 9 conditional test to work always with any java version

See also WW-4845

* fix NullPointerException in NotURLClassLoader tests

Also includes a few improvements

See also WW-4845

* do not specify threadCount & forkMode which breaks tests in java 9

See also WW-4845

* pass all current tests with java 11

See also WW-4981

* fix an odd path problem in java 9

See also WW-4845

* gitignore test-output

See also WW-4981

* ask travis an oracle jdk 11 build

See also WW-4981

* ask travis to report coverage only in latest working jdk, jdk8

See also WW-4845
2018-11-19 10:35:01 +03:30
Jarek Lipski 459cb61ca4 Adds deque and queue support JSON plugin 2018-05-12 17:06:38 +02:00
Jarek Lipski 73cace0cbb Adds sorted and navigable set support JSON plugin
See WW-4937 for more details.
2018-05-12 16:59:17 +02:00
Lukasz Lenart 7f3c09c98e Merge pull request #208 from aleksandr-m/feature/lang_to_text
WW-4915 Replace deprecated commons-lang3 classes
2018-03-16 14:30:40 +01:00
Lukasz Lenart f1610537c8 Merge pull request #177 from aleksandr-m/feature/WW-4875
WW-4875 Add ability to use Java based configuration
2018-03-16 14:23:06 +01:00
Aleksandr Mashchenko 478945a0bd WW-4915 Replace deprecated commons-lang3 classes (add commons-text dependency, replace StringEscapeUtils) 2018-02-05 21:15:17 +02:00
Yasser Zamani 4738d1d802 WW-4873 Makes ActionInvocation not serializable 2017-12-13 19:34:54 +03:30
Aleksandr Mashchenko 7a9b5029a5 WW-4875 Add json constant configuration 2017-11-21 20:46:36 +02:00
Stefaan Dutry 0bde78cc36 changed Map iterations to use entrySet when both key and value are used 2017-11-13 21:13:27 +01:00
Yasser Zamani fb0a6120db WW-4846 Fixes unit tests for JDK8 2017-11-04 10:22:25 +03:30
Yasser Zamani 92502510df WW-4846 Adds unit tests 2017-11-04 09:37:12 +03:30
Lukasz Lenart 8b95838c58 Adds proper XML header 2017-10-22 12:29:13 +02:00
Lukasz Lenart a03373022d Adds missing header with license 2017-10-21 18:40:42 +02:00
Lukasz Lenart e7c65fb0b4 Adds missing header with license 2017-10-21 17:47:51 +02:00
Lukasz Lenart 73359c480b Adds missing header with license 2017-10-21 11:24:48 +02:00
Lukasz Lenart cb389d292d Fixes Maven site generation 2017-10-20 09:05:29 +02:00
Yasser Zamani ecdc0f8379 WW-4034 a few non-functional changes 2017-10-06 14:03:22 +03:30
Yasser Zamani 996e17927b WW-4034 Makes JSONWriter not static prototype to fix concurrent calls 2017-09-13 11:47:55 +04:30
Yasser Zamani 5bb472fa85 WW-4034 Allows to use custom JSONwriter 2017-09-11 18:40:34 +04:30
Yasser Zamani 39bdb99a11 WW-4034 Refactors and extracts interface from JSONWriter 2017-09-11 18:09:32 +04:30
Yasser Zamani 682d7a8888 WW-4846 Adds constant to control if include/traverse proxy info in JSONResult 2017-09-05 11:51:14 +04:30
Yasser Zamani fbe09949c7 WW-4846 Does not traverse/include proxy info in JSONResult 2017-08-30 17:55:41 +04:30
Lukasz Lenart 08e181a4fe WW-4728 Allows override request parameter names used to enable validation 2017-01-09 11:40:13 +01:00
Lukasz Lenart 7e4d1b45ea WW-4725 Allows handle all redirection by MessageStoreInterceptor 2016-12-19 18:51:04 +01:00