Skip to content

NIFI-15629 Add ConnectorRequestContext#10924

Open
kevdoran wants to merge 2 commits intoapache:NIFI-15258from
kevdoran:NIFI-15629-connector-request-context
Open

NIFI-15629 Add ConnectorRequestContext#10924
kevdoran wants to merge 2 commits intoapache:NIFI-15258from
kevdoran:NIFI-15629-connector-request-context

Conversation

@kevdoran
Copy link
Contributor

  • Add ConnectorRequestContext to forward web context details to ConnectorConfigurationProvider implementations

Summary

NIFI-15629

Add ConnectorRequestContext to forward web context details to ConnectorConfigurationProvider implementations

- Add ConnectorRequestContext to forward web context details to ConnectorConfigurationProvider implementations
@pvillard31 pvillard31 added the NIP-11 NIP-11 adds support for Connectors label Feb 21, 2026
Copy link
Contributor

@exceptionfactory exceptionfactory left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together @kevdoran. I made some minor comments regarding the interface method names, the general approach looks good on initial review.

* @param headerName the header name to look up
* @return the first header value, or {@code null} if not present
*/
String getFirstHeaderValue(String headerName);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is convenient, but with getFirst() on a List, do you think it is needed?

Copy link
Contributor Author

@kevdoran kevdoran Feb 24, 2026

Choose a reason for hiding this comment

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

I don't feel strongly, but given that in theory HTTP headers can be repeated, but in practice applications often expect / want one, I think it is is a useful convenience method to have an accessor method that has "first or null|Optional" semantics. I could use getHeaderValues(String).getFirst() but that throws a NoSuchElementException for an empty list.

I don't feel strongly though, open to idea on naming, signature, or removing altogether.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the reply, on further consideration, this method, returning a nullable String, looks good.

*
* @return the authenticated NiFi user, or {@code null} if not available
*/
NiFiUser getNiFiUser();
Copy link
Contributor

Choose a reason for hiding this comment

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

Recommend changing this to getApplicationUser() or getAuthenticatedUser()

* @param headerName the header name to check
* @return {@code true} if the header is present, {@code false} otherwise
*/
boolean hasHeader(String headerName);
Copy link
Contributor

Choose a reason for hiding this comment

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

Recommend including Request to align with getReaderHeaders()

Suggested change
boolean hasHeader(String headerName);
boolean hasRequestHeader(String headerName);

* @param headerName the header name to look up
* @return an unmodifiable list of header values, or an empty list if not present
*/
List<String> getHeaderValues(String headerName);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
List<String> getHeaderValues(String headerName);
List<String> getRequestHeaderValues(String headerName);

@kevdoran
Copy link
Contributor Author

Thanks for the review @exceptionfactory! I pushed an update that addressed most/all of the comments, but let's discuss if there is anything more needed on this PR to get it merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NIP-11 NIP-11 adds support for Connectors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants