-
Notifications
You must be signed in to change notification settings - Fork 39
Add standard Jackson JSON media type to admin API #192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add standard Jackson JSON media type to admin API #192
Conversation
Signed-off-by: Mitch Gaffigan <mitch.gaffigan@comcast.net>
Signed-off-by: Mitch Gaffigan <mitch.gaffigan@comcast.net>
5fcca68 to
39c9523
Compare
|
Here's a few examples of the implementation: Login: POST https://localhost:8443/api/users/_login HTTP/1.1
User-Agent: Fiddler
X-Requested-With: Foo
Host: localhost:8443
Content-Type: application/x-www-form-urlencoded
Accept: application/mirthapi+json
Content-Length: 29
username=admin&password=admin
HTTP/1.1 200 OK
Date: Sat, 18 Oct 2025 19:03:49 GMT
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: false
Access-Control-Allow-Methods: GET, POST, DELETE, PUT
Access-Control-Allow-Headers: Content-Type
Content-Security-Policy: frame-ancestors 'none'
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=31536000; includeSubDomains
Set-Cookie: JSESSIONID=node05y5j2mlzbr1hslxmsncseev91.node0; Path=/api; Secure
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: application/mirthapi+json
Content-Length: 33
{"status":"SUCCESS","message":""}Get Current User: GET https://localhost:8443/api/users/current HTTP/1.1
User-Agent: Fiddler
X-Requested-With: Foo
Host: localhost:8443
Accept: application/mirthapi+json
Cookie: JSESSIONID=node05y5j2mlzbr1hslxmsncseev91.node0
HTTP/1.1 200 OK
Date: Sat, 18 Oct 2025 19:05:02 GMT
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: false
Access-Control-Allow-Methods: GET, POST, DELETE, PUT
Access-Control-Allow-Headers: Content-Type
Content-Security-Policy: frame-ancestors 'none'
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=31536000; includeSubDomains
Content-Type: application/mirthapi+json
Content-Length: 107
{"id":1,"username":"admin","lastLogin":"2025-10-18T19:03:49.622+00:00","strikeCount":0,"userConsent":false}Add user: POST https://localhost:8443/api/users/ HTTP/1.1
User-Agent: Fiddler
X-Requested-With: Foo
Host: localhost:8443
Content-Type: application/mirthapi+json
Accept: application/mirthapi+json
Cookie: JSESSIONID=node05y5j2mlzbr1hslxmsncseev91.node0
Content-Length: 22
{"username":"example"}
HTTP/1.1 204 No Content
Date: Sat, 18 Oct 2025 19:06:07 GMT
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: false
Access-Control-Allow-Methods: GET, POST, DELETE, PUT
Access-Control-Allow-Headers: Content-Type
Content-Security-Policy: frame-ancestors 'none'
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=31536000; includeSubDomains
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a custom JSON media type (application/mirthapi+json) to the Mirth admin API to enable direct Jackson JSON serialization/deserialization, avoiding the historical XML round-trip. This aligns the API with the OpenAPI specification and supports auto-generated clients.
Key Changes:
- Introduces
ApiContentTypes.APPLICATION_MIRTHAPI_JSONconstant - Adds
JacksonJsonObjectMapperConfigprovider for Jackson configuration - Registers Jackson JSON providers in
MirthWebServer - Updates all servlet interface annotations to support the new media type
Reviewed changes
Copilot reviewed 31 out of 34 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| ApiContentTypes.java | Defines the new application/mirthapi+json media type constant |
| JacksonJsonObjectMapperConfig.java | Configures Jackson ObjectMapper with deserialization settings and date handling |
| MirthWebServer.java | Registers Jackson JSON providers for the API |
| ServerLogServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| GlobalMapServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| DirectoryResourceServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| DataPrunerServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| DashboardConnectorStatusServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| WebServiceConnectorServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| TcpConnectorServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| SmtpConnectorServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| JmsConnectorServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| DatabaseConnectorServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| HttpConnectorServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| FileConnectorServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| DocumentConnectorServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| UserServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| UsageServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| SystemServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| MessageServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| ExtensionServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| EventServletInterface.java | Adds new media type to @Consumes/@Produces/@ApiResponse/@produces annotations |
| EngineServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| DatabaseTaskServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| ConfigurationServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| CodeTemplateServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| ChannelStatusServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| ChannelStatisticsServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| ChannelServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| ChannelGroupServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| AlertServletInterface.java | Adds new media type to @Consumes/@Produces/@apiresponse annotations |
| jackson-module-jaxb-annotations-2.14.3.jar | Binary JAR dependency added |
| jackson-jaxrs-json-provider-2.14.3.jar | Binary JAR dependency added |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Adds application/mirthapi+json as a supported content-type for the admin API's that serialize or deserialize objects.
application/jsonkeeps the historical behavior - this functionality is opt-in.Closes #188