This is a Java implementation of the EXPath HTTP Client Module specification.
We provide a Java library that may be used as the basis for specific product implementations, and an RI (Reference Implementation) developed for Saxon which demonstrates how to use the library.
Requires:
- Java 1.8 or newer
- Maven 3 or newer
$ git clone https://github.com/expath/expath-http-client-java.git
$ cd expath-http-client-java
$ mvn clean package
NOTE: Where .sh
files are specified below, the equivalent .bat
files also exist for Microsoft Windows users.
Compatibility with Saxon Versions
http-client-saxon Version | Saxon Versions |
---|---|
1.5.0+ | 12.0+ |
1.4.0+ | 10.3+ |
1.3.0 | 9.9+ |
<= 1.2.4 | 9.7+ |
Additional Saxon specific examples can be found in http-client-saxon/README.md.
To use the RI for Saxon, you require several Jar files to be present on the classpath with Saxon:
http-client-saxon-VERSION.jar
, http-client-java-VERSION.jar
, and the dependencies of http-client-java
; to make this easier we provide an Uber Jar, whereby you can just place http-client-saxon-VERSION-uber.jar
onto Saxon's classpath.
If you have built from source these can be found in the respective folders: http-client-saxon/target/
,
and http-client-java/target/
, alternatively you may download the releases from
Maven Central.
Saxon also needs to have the EXPath HTTP Client Module's functions registered with it. Depending on how you are using Saxon, will depend on how this is done.
If you are using Saxon's classic API from Java, you can do something like:
import org.expath.httpclient.saxon.SendRequestFunction;
...
Configuration configuration = new Configuration();
configuration.registerExtensionFunction(new SendRequestFunction());
...
If you are using Saxon from the command line, you may specify a Saxon
configuration file, to which you
need to add an <extensionFunction>
to the <resources>
section, for example:
<configuration xmlns="http://saxon.sf.net/ns/configuration"
edition="EE"
licenseFileLocation="saxon-license.lic"
label="Some label">
...
<resources>
<extensionFunction>org.expath.httpclient.saxon.SendRequestFunction</extensionFunction>
...
More information if needed about extension functions for Saxon can be found here.