Commit bdad48c
Add v1 REST API deprecation control with build-time flag
Introduce a new --v1-api-status flag to build.sh that provides granular
control over the v1 REST API lifecycle, enabling smooth migration from
v1 to v2 APIs.
Four status levels are supported:
1. enabled (default): v1 API fully functional, backward compatible
2. deprecated: v1 functional but logs migration warnings at startup
3. disabled: v1 compiled but returns HTTP 410 Gone at runtime
4. dropped: v1 code completely excluded from compilation
Build-time Integration:
- build.sh accepts --v1-api-status={enabled|deprecated|disabled|dropped}
- Passes value to CMake via -DV1_API_STATUS and to RPM via --define
- Default value embedded in build.properties resource file
- Maven filtering injects value into JAR at compile time
Status: dropped (most significant changes):
- Maven v1-api-dropped profile excludes v1 source files via pluginManagement
- Maven v1-api-deps profile deactivated via -P'!v1-api-deps'
- JAX-RS/RESTEasy BuildRequires and Requires skipped in pki.spec
- JAX-RS/RESTEasy JARs not installed or transformed
- CMake javadoc excludes v1 packages with --ignore-source-errors
- RPM %post script removes old JAX-RS JARs from existing instances
- Binary RPMs ~2-3MB smaller without v1 code and dependencies
Status: disabled (clean error handling):
- V1ApiDisabledResource catch-all JAX-RS resource created
- Returns HTTP 410 Gone with JSON error instead of stack trace
- All v1 Application classes register only V1ApiDisabledResource
- Clean user experience: {"error": "v1 REST API has been disabled", ...}
Status: deprecated (migration warning):
- All v1 Application classes log prominent warning on startup
- Full functionality maintained for transition period
- Warnings visible in systemd journal and tomcat logs
Runtime Behavior:
- Build-time status becomes default runtime behavior
- Administrators can override via -Dv1.api.status system property
- All v1 Application classes (PKI, CA, KRA, OCSP, TKS, TPS) updated
- Default behavior read from build.properties at runtime
Implementation Details:
- base/pom.xml: v1-api-deps and v1-api-dropped Maven profiles
- base/server/pom.xml: Resource filtering for build.properties
- base/server/src/main/resources/build.properties: New configuration file
- base/server/src/main/java/.../V1ApiDisabledResource.java: New error handler
- base/javadoc/CMakeLists.txt: Conditional package exclusion
- pki.spec: Conditional dependencies and %post JAR cleanup
- build.sh: Flag parsing and CMake/RPM integration
Migration Path:
1. Deploy with --v1-api-status=deprecated (warnings, full function)
2. Monitor logs, notify users, allow migration period
3. Deploy with --v1-api-status=disabled (enforce v2, allow rollback)
4. Deploy with --v1-api-status=dropped (remove v1 code permanently)
Testing:
- Verified compilation with all four status values
- Verified runtime behavior (enabled, deprecated, disabled)
- Verified v1 code exclusion and JAR removal (dropped)
- Verified HTTP 410 Gone responses (disabled)
- Verified javadoc generation without v1 packages (dropped)
Documentation: See docs/changes/v11.10.0/Packaging-Changes.adoc and Server-Changes.adoc
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 6782ba9 commit bdad48c
17 files changed
Lines changed: 594 additions & 53 deletions
File tree
- 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
- resources
- 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
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
33 | 39 | | |
34 | 40 | | |
35 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 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 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | 129 | | |
166 | 130 | | |
167 | 131 | | |
| |||
176 | 140 | | |
177 | 141 | | |
178 | 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 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
179 | 193 | | |
180 | 194 | | |
181 | 195 | | |
| |||
| 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 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
59 | 93 | | |
60 | 94 | | |
61 | 95 | | |
| |||
65 | 99 | | |
66 | 100 | | |
67 | 101 | | |
68 | | - | |
69 | 102 | | |
70 | | - | |
| 103 | + | |
71 | 104 | | |
| 105 | + | |
| 106 | + | |
72 | 107 | | |
73 | 108 | | |
74 | 109 | | |
75 | 110 | | |
76 | 111 | | |
77 | 112 | | |
78 | 113 | | |
79 | | - | |
| 114 | + | |
80 | 115 | | |
81 | 116 | | |
82 | 117 | | |
83 | 118 | | |
84 | 119 | | |
85 | | - | |
86 | 120 | | |
87 | 121 | | |
88 | 122 | | |
| |||
98 | 132 | | |
99 | 133 | | |
100 | 134 | | |
| 135 | + | |
101 | 136 | | |
102 | 137 | | |
103 | 138 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
32 | 38 | | |
33 | 39 | | |
34 | 40 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
32 | 38 | | |
33 | 39 | | |
34 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
17 | 22 | | |
18 | 23 | | |
19 | 24 | | |
| |||
32 | 37 | | |
33 | 38 | | |
34 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
35 | 80 | | |
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
38 | 45 | | |
39 | 46 | | |
40 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | 31 | | |
38 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
39 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
40 | 67 | | |
41 | 68 | | |
42 | 69 | | |
| |||
0 commit comments