Restlet ର ClientResource କୁ ଆପଣ କନଫିଗର କରିଥିବା proxy connector ବ୍ୟବହାର କରାନ୍ତୁ
Restlet 2.4.4 ର Apache HTTP client helper ପାଇଁ, ଆରମ୍ଭ କରିବା ପୂର୍ବରୁ connector context parameters ସେଟ କରନ୍ତୁ ଏବଂ setNext ସହିତ ସଂଯୋଗ କରନ୍ତୁ।
କନଫିଗର ହୋଇଥିବା 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 ର documented proxyHost ଏବଂ proxyPort key ବ୍ୟବହାର କରେ, ଏବଂ hostname ଏହାର scheme ଓ port ଠାରୁ ଅଲଗା। ସେଗୁଡ଼ିକୁ connector.start() ପୂର୍ବରୁ ସେଟ କରନ୍ତୁ। ସାର୍ବଜନୀନ HTTP endpoint ପାଇଁ, ଏହି ଦୁଇଟି field 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 ଛାଡ଼ାଯାଇପାରିବ।