Skip to content

[WFLY-17451] Register a requirement for the filter capability in the …#1

Open
bstansberry wants to merge 1 commit into
baranowb:WFLY-17451from
bstansberry:pullRequest17134
Open

[WFLY-17451] Register a requirement for the filter capability in the …#1
bstansberry wants to merge 1 commit into
baranowb:WFLY-17451from
bstansberry:pullRequest17134

Conversation

@bstansberry

Copy link
Copy Markdown

…Stage.MODEL handling for adding a filter-ref.

Unfortunately, Galleon feature spec generation won't let us record it via FilterResourceRegistration.

Also, statically parameterize FilterRefDefinition and FilterRefAdd instances so they know if they are for direct children of 'host' or for children of 'location'

…Stage.MODEL handling for adding a filter-ref.

Unfortunately, Galleon feature spec generation won't let us record it via FilterResourceRegistration.

Also, statically parameterize FilterRefDefinition and FilterRefAdd instances so they know if they are for direct children of 'host' or for children of 'location'
.addCapabilities(capability.getDefinition())
// TODO resolve problem generating a feature spec when this is used
//.addRequirement(capability.getName(), capability.getDynamicNameMapper(),
// FilterCapabilities.FILTER_CAPABILITY.getName(), FilterCapabilities.FILTER_CAPABILITY.getDynamicNameMapper())

@bstansberry bstansberry Jun 5, 2025

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^^ would be the ideal way to record that a filter-ref has a requirement for a filter because it results in the info being stored in the ManagementResourceRegistration, where users / tools can learn about the relationship without even adding the undertow subsystem; they just need to add the extension.

If the information was recorded at this point, the kernel code would use it in Stage.MODEL when handling an 'add' op for a filter-ref in order to perform a model consistency check.

But building the Galleon feature pack fails when this is used. So we need to go for next best by overriding FilterRefAdd.recordCapabilitiesAndRequirements below.

FilterCapabilities.FILTER_CAPABILITY.getDynamicNameMapper(),
FilterCapabilities.FILTER_CAPABILITY.getName());
filterRefRecorder.addCapabilityRequirements(context, resource, null);
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method executes in OperationContext.Stage.MODEL, when the 'add' operation for the filter-ref is being executed. This means it records the requirement for the filter before the model consistency checks are performed, so those checks can detect any errors and fail if the config is wrong.

In particular, if the server is running in --admin-only mode, those checks are still run and will report failures, versus the current code that just does service wiring in the performRuntime method. The performRuntime method does not execute in an --admin-only server, so if a user made a mistake adding a filter-ref in an --admin-only server it would not be detected until they later try and boot the server.

baranowb pushed a commit that referenced this pull request Jun 9, 2026
[WFLY-21866] For testsuite/layers do no use a feature-pack that provi…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant