]
Rostislav Svoboda commented on WFCORE-3999:
-------------------------------------------
[~kabirkhan] we will need EAP7 jira clone for this
Allow registering a custom HTTP handler for management interface
----------------------------------------------------------------
Key: WFCORE-3999
URL:
https://issues.jboss.org/browse/WFCORE-3999
Project: WildFly Core
Issue Type: Feature Request
Components: Management
Reporter: Jeff Mesnil
Assignee: Jeff Mesnil
With WFCORE-1742, it is possible to add "resources" to the HTTP management
interface through the ExtensibleHttpManagement interface.
However this requires to provide a io.undertow.server.handlers.resource.ResourceManager
object that represents the resource. This interface is meant to represent static resources
(such as file) and does not map well to exposing a "REST" kind of API.
It does not allow to distinguish between HTTP verbs (GET, POST, DELETE) or inspect HTTP
header.
It requires to provide cache metadata (etag, cache) that may not be relevant for a HTTP
API.
It also automatically enables redirection (e.g. / to /index.html) without possibility to
disable it.
For some HTTP API such as the one required by MicroProfile Health Check (a GET on
/management/health), it would be better to be able to pass a
io.undertow.server.HttpHandler instead of a
io.undertow.server.handlers.resource.ResourceManager to have more flexibility/simplicity
to provide management HTTP API.
One of the concern when WFCORE-1742 was created was that this API exposes Undertow API.
This is already the case with ResourceManager and this RFE would add another such
exposition to io.undertow.server.HttpHandler.
Proposed API:
in org.jboss.as.server.mgmt.domain.ExtensibleHttpManagement
{code}
/**
* Add a context for a HTTP management handler.
* @param contextName the name of the context. Cannot be {@code null} or empty
* @param managementHandler HTTP management handler. Cannot be {@code null}
*
* @throws IllegalArgumentException if either parameter is invalid
* @throws IllegalStateException if there is already a context present named the same
as {@code contextName}, either
* added via this interface or otherwise
*/
void addManagementHandler(String contextName, HttpHandler managementHandler);
{code}
(this is in addition to the existing addStaticContext(String contextName, ResourceManager
resourceManager)).
There is no need to add a corresponding remove method as the existing one
removeContext(String contextName) can be used.