Commit 400409f
committed
Add REST API v1 build-time control with runtime deprecation
Introduce build-time flag to exclude v1 REST API code and
dependencies, with optional runtime control for managing v1
deprecation when included.
Build-time Control:
- New --without-apiv1 flag in build.sh to exclude v1 code from build
- Default: v1 REST API included (backward compatible)
- When excluded: v1 source files not compiled, JAX-RS/RESTEasy
dependencies skipped, binary RPMs ~2-3MB smaller
- Maven property api.v1=true/false controls profile activation
- Profile api-v1-deps includes JAX-RS/RESTEasy/Jackson-JAX-RS dependencies
- Profile api-v1-dropped excludes v1 source files via maven-compiler-plugin
Runtime Control (when v1 built):
- Three runtime states: enabled, deprecated (default), disabled
- System property api.v1.status controls behavior at runtime
- Can be set per-instance via tomcat.conf or per-subsystem via CS.cfg
- ApiStatusHelper centralizes status checking across all subsystems
- Input validation: trims, lowercases, rejects invalid values
Runtime States:
1. enabled: v1 fully functional, no warnings
2. deprecated (default): v1 functional with startup warnings and
standard Deprecation headers (IETF draft-dalal-deprecation-header)
3. disabled: v1 returns HTTP 404 Not Found with clean JSON error response,
includes Deprecation
Implementation:
- base/pom.xml: api-v1-dropped profile for source exclusion
- base/common/pom.xml: api-v1-deps profile for conditional dependencies
- base/javadoc/CMakeLists.txt: Exclude v1 REST packages from javadoc
- pki.spec: Conditional BuildRequires/Requires, %post JAR cleanup
- build.sh: --without-apiv1 flag, passes to CMake and RPM
- ApiStatusHelper: Shared utility for status validation and handling
- ApiDisabledResource: JAX-RS catch-all returning HTTP 410 Gone
- ApiDeprecationFilter: JAX-RS response filter adding standard headers
- All Application classes updated to use ApiStatusHelper
HTTP Standards Compliance:
- Deprecation header for deprecated state
- Link header (RFC 8288) pointing to v2 API documentation
- Separate HTTP method handlers per JAX-RS specification
RPM Build:
- build.sh: ./build.sh --without-apiv1 rpm
- rpmbuild: rpmbuild --without apiv1 -ba pki.spec
- Spec validates bcond and sets build_api_v1 conditional
- Maven receives -Dapi.v1=true/false based on bcond
Migration Path:
- Default: v1 included at build, deprecated at runtime (warnings)
- Gradual: Configure runtime disabled to enforce v2 migration
- Final: Build with --without-apiv1 to remove v1 code permanently
Documentation: docs/changes/v11.10.0/Packaging-Changes.adoc and
Server-Changes.adoc
Assisted-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 40d9178 commit 400409f
27 files changed
Lines changed: 762 additions & 72 deletions
File tree
- .github/workflows
- base
- ca
- src/main/java/org/dogtagpki/server/ca/rest/v1
- common
- javadoc
- kra
- src/main/java/org/dogtagpki/server/kra/rest/v1
- ocsp
- src/main/java/org/dogtagpki/server/ocsp/rest/v1
- server-webapp
- src/main/java/org/dogtagpki/server/rest/v1
- server
- src/main/java/org/dogtagpki/server/rest/v1
- tks
- src/main/java/org/dogtagpki/server/tks/rest/v1
- tps
- src/main/java/org/dogtagpki/server/tps/rest/v1
- docs/changes/v11.10.0
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
430 | 452 | | |
431 | 453 | | |
432 | 454 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
81 | 87 | | |
82 | 88 | | |
| 89 | + | |
83 | 90 | | |
84 | 91 | | |
85 | 92 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| 9 | + | |
| 10 | + | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
| |||
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
| 25 | + | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
| |||
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
33 | 43 | | |
34 | 44 | | |
35 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
132 | | - | |
133 | 131 | | |
134 | 132 | | |
135 | 133 | | |
| |||
141 | 139 | | |
142 | 140 | | |
143 | 141 | | |
144 | | - | |
145 | | - | |
146 | 142 | | |
147 | 143 | | |
148 | 144 | | |
149 | 145 | | |
150 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
151 | 159 | | |
152 | 160 | | |
153 | 161 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | 97 | | |
104 | 98 | | |
105 | 99 | | |
| |||
124 | 118 | | |
125 | 119 | | |
126 | 120 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | 121 | | |
158 | 122 | | |
159 | 123 | | |
| |||
168 | 132 | | |
169 | 133 | | |
170 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
171 | 185 | | |
172 | 186 | | |
173 | 187 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
59 | 90 | | |
60 | 91 | | |
61 | 92 | | |
| |||
65 | 96 | | |
66 | 97 | | |
67 | 98 | | |
68 | | - | |
69 | 99 | | |
70 | | - | |
| 100 | + | |
71 | 101 | | |
| 102 | + | |
| 103 | + | |
72 | 104 | | |
73 | 105 | | |
74 | 106 | | |
75 | 107 | | |
76 | 108 | | |
77 | 109 | | |
78 | 110 | | |
79 | | - | |
| 111 | + | |
80 | 112 | | |
81 | 113 | | |
82 | 114 | | |
83 | 115 | | |
84 | 116 | | |
85 | | - | |
86 | 117 | | |
87 | 118 | | |
88 | 119 | | |
| |||
98 | 129 | | |
99 | 130 | | |
100 | 131 | | |
| 132 | + | |
101 | 133 | | |
102 | 134 | | |
103 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
73 | 80 | | |
74 | 81 | | |
| 82 | + | |
75 | 83 | | |
76 | 84 | | |
77 | 85 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| 23 | + | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
| |||
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
32 | 41 | | |
33 | 42 | | |
34 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
71 | 77 | | |
72 | 78 | | |
| 79 | + | |
73 | 80 | | |
74 | 81 | | |
75 | 82 | | |
| |||
0 commit comments