Developing client providers
The com.yahoo.jdisc.service.ClientProvider
(javadoc)
interface defines a component that is capable of acting as a client to an external
server. This document explains how to implement and deploy a custom client provider.
The client providers of a JDisc application manage all outgoing requests made to
remote services. Upon receiving a com.yahoo.jdisc.Request
, it initiates
a corresponding connection to the appropriate remote server. Once the remote server
responds, the client provider instantiates and dispatches a corresponding
com.yahoo.jdisc.Response
.
To implement a client provider, either implement the
ClientProvider
interface directly, or subclass the more convenient
AbstractClientProvider
.
Please note the following:
- The code necessary to handle a request and its content is the same as for handling a request in a request handler.
- The code necessary to dispatch a response and write its content into the
returned
ContentChannel
is the same as for dispatching a response from a request handler.
<container id="default" version="1.0"> <client id="my.package.MyClientProvider" bundle="MyBundleSymbolicName"> <binding>http://*/*</binding> </client> <nodes> <node hostalias="node1" /> </nodes> </container>Notice that the
binding
element declared within a client
element implies a client-binding. To configure a server-binding for a client, use
the serverBinding
element instead.