Documentation updates only

This commit is contained in:
James Agnew 2015-04-24 12:40:13 -04:00
parent 7db7097e25
commit ffd0e52006
2 changed files with 54 additions and 18 deletions

View File

@ -33,6 +33,22 @@ public class ClientExamples {
// END SNIPPET: proxy // END SNIPPET: proxy
} }
@SuppressWarnings("unused")
public void createTimeouts() {
// START SNIPPET: timeouts
FhirContext ctx = new FhirContext();
// Set how long to try and establish the initial TCP connection (in ms)
ctx.getRestfulClientFactory().setConnectTimeout(20 * 1000);
// Set how long to block for individual read/write operations (in ms)
ctx.getRestfulClientFactory().setSocketTimeout(20 * 1000);
// Create the client
IGenericClient genericClient = ctx.newRestfulGenericClient("http://localhost:9999/fhir");
// END SNIPPET: timeouts
}
@SuppressWarnings("unused") @SuppressWarnings("unused")
public void createSecurity() { public void createSecurity() {
// START SNIPPET: security // START SNIPPET: security

View File

@ -10,46 +10,66 @@
<body> <body>
<section name="Configuring the HTTP Client"> <section name="Configuring the HTTP Client">
<p> <p>
RESTful clients (both Generic and Annotation-Driven) use RESTful clients (both Generic and Annotation-Driven) use
<a href="http://hc.apache.org/httpcomponents-client-ga/">Apache HTTP Client</a> <a href="http://hc.apache.org/httpcomponents-client-ga/">Apache HTTP Client</a>
as a provider. The Apache HTTP Client is very powerful and extremely flexible, as a provider. The Apache HTTP Client is very powerful and extremely
but can be confusing at first to configure, because of the low-level approach that flexible,
the library uses. but can be confusing at first to configure, because of the low-level
approach that
the library uses.
</p> </p>
<p> <p>
In many cases, the default configuration should suffice. However, if you require anything In many cases, the default configuration should suffice. However,
more sophisticated (username/password, HTTP proxy settings, etc.) you will need if you require anything
to configure the underlying client. more sophisticated (username/password, HTTP
proxy settings, etc.) you will need
to configure the underlying
client.
</p> </p>
<p> <p>
The underlying client configuration is provided by accessing the The underlying client configuration is provided by accessing the
<a href="./apidocs/ca/uhn/fhir/rest/client/IRestfulClientFactory.html">IRestfulClientFactory</a> <a href="./apidocs/ca/uhn/fhir/rest/client/IRestfulClientFactory.html">IRestfulClientFactory</a>
class from the FhirContext. class from the FhirContext.
</p> </p>
<p> <p>
Note that individual requests and responses Note that individual requests and responses
can be tweaked using <a href="./doc_rest_client_interceptor.html">Client Interceptors</a>. can be tweaked using
<a href="./doc_rest_client_interceptor.html">Client Interceptors</a>
.
</p> </p>
<subsection name="Setting Socket Timeouts">
<p>
The following example shows how to configure low level
socket timeouts for client operations.
</p>
<macro name="snippet">
<param name="id" value="timeouts"/>
<param name="file"
value="examples/src/main/java/example/ClientExamples.java"/>
</macro>
</subsection>
<subsection name="Configuring an HTTP Proxy"> <subsection name="Configuring an HTTP Proxy">
<p> <p>
The following example shows how to configure the use of an HTTP The following example shows how to configure the use of an HTTP
proxy in the client. proxy in the client.
</p> </p>
<macro name="snippet"> <macro name="snippet">
<param name="id" value="proxy" /> <param name="id" value="proxy"/>
<param name="file" value="examples/src/main/java/example/ClientExamples.java" /> <param name="file"
value="examples/src/main/java/example/ClientExamples.java"/>
</macro> </macro>
</subsection> </subsection>
</section> </section>
</body> </body>