Jakarta RESTful Web Services 4.0

Last reviewed Sep 20, 2026

Export as PDF

Prompt Details

Prompt Composition

3prompts
  1. Java 21124 lines · 3.9K tokens
  2. Jakarta EE 1183 lines · 4.1K tokens
  3. Jakarta RESTful Web Services 4.069 lines · 4.2K tokens
Total276 lines · 12.1K tokens

CWE Coverage

  • 20
  • 22
  • 59
  • 73
  • 78
  • 79
  • 88
  • 89
  • 90
  • 95
  • 117
  • 190
  • 197
  • 201
  • 208
  • 209
  • 295
  • 297
  • 306
  • 307
  • 319
  • 323
  • 327
  • 338
  • 347
  • 352
  • 362
  • 367
  • 378
  • 384
  • 427
  • 434
  • 459
  • 470
  • 471
  • 488
  • 489
  • 494
  • 502
  • 525
  • 532
  • 552
  • 601
  • 611
  • 613
  • 614
  • 639
  • 653
  • 732
  • 759
  • 770
  • 772
  • 776
  • 789
  • 807
  • 862
  • 863
  • 915
  • 916
  • 917
  • 918
  • 922
  • 942
  • 1004
  • 1021
  • 1275
  • 1333

Prompt Preview

Apply the Jakarta EE 11 prompt first, including its Java 21 baseline. Jakarta REST 4.0 / API 4.0.0 requires Java SE 17 or later; these rules target Java 21. In standalone deployments, provide and verify the authentication, validation, and managed-execution integrations that an EE container would otherwise supply.

Registration and resource lifecycle

  • Define an explicit resource and provider set with Application.getClasses() and review any instances returned by getSingletons(). In Servlet deployments, leaving both collections empty enables discovery throughout the WAR; it does not expose an empty application. Inspect the deployed set, including administrative and documentation resources.
  • Audit service-loaded Feature and DynamicFeature implementations as well as @Provider scanning. Service loading is enabled by default even when classes are enumerated. To disable it, return "jakarta.ws.rs.loadServices" -> Boolean.FALSE from Application.getProperties() and explicitly replace any required integrations; verify deployment properties do not override the setting.
  • Keep filters, interceptors, converters, and other providers free of mutable per-request state: providers normally serve concurrent requests through one instance. Use parameter injection on resource methods for shared resource instances; @PathParam, @QueryParam, and similar field/property injection is supported only for the default per-request lifecycle. Initialize application-created subresources through ResourceContext.initResource when they require REST injection.
  • Set