You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "cdw8j (via GitHub)" <gi...@apache.org> on 2025/09/11 19:04:00 UTC

[PR] Feature/hc5 serverbootstrap convenience methods [httpcomponents-core]

cdw8j opened a new pull request, #555:
URL: https://github.com/apache/httpcomponents-core/pull/555

   I have added two convenience methods to the ServerBootstrap that allow simple customization of the RequestRouter in the HttpServer (custom server info string and switching LOCAL_AUTHORITY_RESOLVER scheme). While it is possible to create an HttpServer with such a custom RequestRouter within the application, this results in really messy and complicated code, which can easily be spared with these very simple convenience methods.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: [PR] Feature/hc5 serverbootstrap convenience methods [httpcomponents-core]

Posted by "cdw8j (via GitHub)" <gi...@apache.org>.
cdw8j closed pull request #555: Feature/hc5 serverbootstrap convenience methods
URL: https://github.com/apache/httpcomponents-core/pull/555


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: [PR] Feature/hc5 serverbootstrap convenience methods [httpcomponents-core]

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on code in PR #555:
URL: https://github.com/apache/httpcomponents-core/pull/555#discussion_r2342463520


##########
httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/ServerBootstrap.java:
##########
@@ -182,6 +185,17 @@ public final ServerBootstrap setResponseFactory(final HttpResponseFactory<Classi
         return this;
     }
 
+
+    public final ServerBootstrap setServerInfo(final String serverInfo) {
+        this.serverInfo = serverInfo;
+        return this;
+    }
+
+    public final ServerBootstrap setLocalAuthResolver() {

Review Comment:
   This one is really not worth the API clutter IMO.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: [PR] Feature/hc5 serverbootstrap convenience methods [httpcomponents-core]

Posted by "cdw8j (via GitHub)" <gi...@apache.org>.
cdw8j commented on code in PR #555:
URL: https://github.com/apache/httpcomponents-core/pull/555#discussion_r2344814148


##########
httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/ServerBootstrap.java:
##########
@@ -182,6 +185,17 @@ public final ServerBootstrap setResponseFactory(final HttpResponseFactory<Classi
         return this;
     }
 
+
+    public final ServerBootstrap setServerInfo(final String serverInfo) {
+        this.serverInfo = serverInfo;
+        return this;
+    }
+
+    public final ServerBootstrap setLocalAuthResolver() {

Review Comment:
   Removed the `setServerInfo()` from pull request



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: [PR] Feature/hc5 serverbootstrap convenience methods [httpcomponents-core]

Posted by "ok2c (via GitHub)" <gi...@apache.org>.
ok2c commented on PR #555:
URL: https://github.com/apache/httpcomponents-core/pull/555#issuecomment-3286095218

   > Hello @ok2c , so I changed my request as you suggested and removed the `setServerInfo()`, I am unsure though concerning the `@since` annotation, as I was requesting to merge into the 5.3.x branch I guess it should be `@since 5.3.6`, not `@since 5.4`? Or should I request merge into a different branch? Thanks
   
   @cdw8j Sorry I missed that. No, there will be no API changes in the stable branch. No way. Please change the target branch to master if you want your changes accepted.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: [PR] Feature/hc5 serverbootstrap convenience methods [httpcomponents-core]

Posted by "ok2c (via GitHub)" <gi...@apache.org>.
ok2c commented on PR #555:
URL: https://github.com/apache/httpcomponents-core/pull/555#issuecomment-3284217955

   @cdw8j 
   
   1. You need to make symmetric changes to `AsyncServerBootstrap` as well
   2. Please add `@since 5.4` for all new public methods
   3. Please give the method a better name. `#setLocalAuthResolver` is actually not a setter and `Auth` abbreviation is more customary for authentication rather than aurhority


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: [PR] Feature/hc5 serverbootstrap convenience methods [httpcomponents-core]

Posted by "cdw8j (via GitHub)" <gi...@apache.org>.
cdw8j commented on code in PR #555:
URL: https://github.com/apache/httpcomponents-core/pull/555#discussion_r2343042056


##########
httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/ServerBootstrap.java:
##########
@@ -182,6 +185,17 @@ public final ServerBootstrap setResponseFactory(final HttpResponseFactory<Classi
         return this;
     }
 
+
+    public final ServerBootstrap setServerInfo(final String serverInfo) {
+        this.serverInfo = serverInfo;
+        return this;
+    }
+
+    public final ServerBootstrap setLocalAuthResolver() {

Review Comment:
   I agree the setServerInfo() is arguable, but the setLocalAuthResolver() really makes life easier on application side, because it avoids the clutter related to creating a custom RequestRouter. Should I create a pull request only for the setLocalAuthResolver()?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: [PR] Feature/hc5 serverbootstrap convenience methods [httpcomponents-core]

Posted by "cdw8j (via GitHub)" <gi...@apache.org>.
cdw8j commented on PR #555:
URL: https://github.com/apache/httpcomponents-core/pull/555#issuecomment-3285929685

   Hello @ok2c , so I changed my request as you suggested, I am unsure though concerning the `@since` annotation, as I was requesting to merge into the 5.3.x branch I guess it should be `@since 5.3.6`, not `@since 5.4`? Or should I request merge into a different branch? Thanks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: [PR] Feature/hc5 serverbootstrap convenience methods [httpcomponents-core]

Posted by "ok2c (via GitHub)" <gi...@apache.org>.
ok2c commented on code in PR #555:
URL: https://github.com/apache/httpcomponents-core/pull/555#discussion_r2344927358


##########
httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/ServerBootstrap.java:
##########
@@ -346,6 +348,16 @@ public final ServerBootstrap addFilterLast(final String name, final HttpFilterHa
         return this;
     }
 
+    /**
+     * Create {@link RequestRouter} with LOCAL_AUTHORITY_RESOLVER (default: IGNORE_PORT_AUTHORITY_RESOLVER).
+     *
+     * @since 5.3.6
+     */
+    public final ServerBootstrap enableLocalAuthorityResolver() {

Review Comment:
   @cdw8j `#useLocalAuthorityResolver` maybe?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: [PR] Feature/hc5 serverbootstrap convenience methods [httpcomponents-core]

Posted by "cdw8j (via GitHub)" <gi...@apache.org>.
cdw8j commented on PR #555:
URL: https://github.com/apache/httpcomponents-core/pull/555#issuecomment-3286270110

   My git rebase completely messed things up .. sorry I will close this request and create a new one.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org