מאַכט אַז ClientResource פֿון Restlet זאָל ניצן דעם proxy connector וואָס איר האָט קאָנפֿיגורירט
פֿאַר דעם Apache HTTP client helper פֿון Restlet 2.4.4, שטעלט די connector context parameters פֿאַר דעם אָנהייב און פֿאַרבינדט עס מיט setNext.
אַ קאָנפֿיגורירטער Client האָט קיין ווירקונג אויף אַ ClientResource וואָס ניצט נאָך אַן אַנדער connector. פֿאַר דעם org.restlet.ext.httpclient helper פֿון Restlet 2.4.4, פֿאַרבינדט די 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 ניצט די דאָקומענטירטע שליסלען proxyHost און proxyPort פֿון דעם helper, ווען דער hostname איז באַזונדער פֿון זיין scheme און port. שטעלט זיי פֿאַר connector.start(). פֿאַר אַ פּובליקן HTTP endpoint נעמען די צוויי פֿעלדער אַן אַדרעס און port פֿון דער HTTP proxy list.
דאָס שטעלט פֿאָר אַז דער אינסטאַלירטער helper איז די דערמאָנטע Apache extension. ער קען אויך באַקומען דיפאָלטן פֿון JVM http.proxyHost און http.proxyPort; קלאָרע context ווערטן מאַכן דעם endpoint פֿון דעם connector זעבאַר.
דער ביישפּיל ניצט דעם text body, לאָזט אָפּ די resource און שטעלט אָפּ דעם connector. אַ streaming ניצונג מוז אויך ניצן אָדער אָפּלאָזן איר representation, כּדי pooled connections זאָלן קענען אָפּגעלאָזט ווערן.