Skip to content

Client side proxy

Christian Appl edited this page Mar 10, 2023 · 13 revisions

To route your requests through a client side proxy, you can set a "ProxyConfiguration" at your SessionContext by providing the proxy server´s hostname and port.

The usage is identical for REST and SOAP - hence only a REST usage example shall be provided:

// Select the proxy server via hostname and port
ProxyConfiguration proxy = new ProxyConfiguration("127.0.0.1", 8888);

// The SessionContext allows to set advanced options via chainable setters.
SessionContext sessionContext = new SessionContext(WebServiceProtocol.REST, new URL("http://localhost:8080/webPDF/"))
   .setProxy(proxy);

// Next create the Session via the "SessionFactory".
// Also be aware: If no "AuthProvider" is selected in the "createInstance" Method, this will default to
// the "AnonymousAuthProvider".
try (RestSession<RestDocument> session = SessionFactory.createInstance(sessionContext)) {
   // Do something.
} catch (ResultException ex) {
   // Handle exceptions as you see fit.
}

Clone this wiki locally