වින්‍යාස කළ Client එකක් තවත් connector එකක් භාවිත කරන ClientResource එකකට බලපෑමක් නොකරයි. Restlet 2.4.4 හි org.restlet.ext.httpclient helper සඳහා, ආරම්භ කිරීමට පෙර resource එක එම client එකට සම්බන්ධ කරන්න:

Client connector = new Client(new Context(), Protocol.HTTPS);
connector.getContext().getParameters().set("proxyHost", "proxy.example");
connector.getContext().getParameters().set("proxyPort", "8080");

ClientResource resource = new ClientResource(
    "https://service.example/status");
resource.setNext(connector);
connector.start();
try {
    String body = resource.get().getText();
} finally {
    resource.release();
    connector.stop();
}

setNext(connector) යනු සම්බන්ධ කිරීමේ ලක්ෂ්‍යයයි. context එක helper හි ලේඛනගත proxyHost සහ proxyPort යතුරු භාවිත කරන අතර hostname එහි scheme සහ port වෙන් වේ. ඒවා connector.start() ට පෙර සකසන්න. පොදු HTTP endpoint එකක් සඳහා මෙම ක්ෂේත්‍ර දෙක HTTP proxy list එකෙන් ලිපිනයක් සහ port එකක් ගනී.

මෙය උපකල්පනය කරන්නේ deploy කළ helper එක පවසන ලද Apache extension එක බවයි. එයට JVM http.proxyHost සහ http.proxyPort වලින් default ලබා ගැනීමට ද හැකිය; පැහැදිලි context අගයන් මෙම connector හි endpoint එක දෘශ්‍යමාන කරයි.

උදාහරණය text body එක පරිභෝජනය කර, resource එක මුදා හැර connector එක නවතී. streaming භාවිතය ද එහි representation එක පරිභෝජනය කළ යුතුය හෝ මුදා හැරිය යුතුය, එවිට pooled connections මුදා හැරිය හැක.

අදාළ ලිපි