JBOSH HttpSender is not currently customisable

As per the below code

jbosh/BOSHClient.java at master · igniterealtime/jbosh · GitHub

The line 235 … private final HTTPSender httpSender = ServiceLib.loadService(HTTPSender.class); … which is indirectly refers a “.properties” file

My Suggestion is

Similar to our smack packet extension providers, this should be a developer/user customisable … so that either Apache HttpClient 4.x or UrlConnection or any other can be chosen appropriately

jBOSH uses SPI, so it’s configurable. After all, that’s the main task of the Service Provider Interface (SPI). See also Introduction to the Service Provider Interfaces (The Java™ Tutorials > Sound)

That means … to change the HttpSender, I need to open the JAR file and modify “org.igniterealtime.jbosh.HTTPSender” file which is currently contains “org.igniterealtime.jbosh.ApacheHTTPSender” and modify it and make my own JAR file?

jbosh/org.igniterealtime.jbosh.HTTPSender at master · igniterealtime/jbosh · GitHub

You don’t need to modify the Jar in order to provide the resource that configures the implementation of the service interface. You could simply set the related system property.

I went through the entire “ServiceLib.java”

I think you are talking about “loadServicesImplementations” function implementation inside jbosh/ServiceLib.java at master · igniterealtime/jbosh · GitHub

String override = System.getProperty(ofClass.getName());


so… there will be 2 class in the arraylist… and… if the first class is loadable then the second class will be ignored?

therefore If I simply put System.setProperty(HTTPSender.class.getName(), “”)… it will work?


But, unfortunately “HTTPSender” is not public… which leads the developer to use the same package name

Thanks for pointing this out. Logged as IJBOSH-3