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
}
@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")
public void createSecurity() {
// START SNIPPET: security

View File

@ -10,46 +10,66 @@
<body>
<section name="Configuring the HTTP Client">
<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>
as a provider. The Apache HTTP Client is very powerful and extremely flexible,
but can be confusing at first to configure, because of the low-level approach that
the library uses.
as a provider. The Apache HTTP Client is very powerful and extremely
flexible,
but can be confusing at first to configure, because of the low-level
approach that
the library uses.
</p>
<p>
In many cases, the default configuration should suffice. However, if you require anything
more sophisticated (username/password, HTTP proxy settings, etc.) you will need
to configure the underlying client.
In many cases, the default configuration should suffice. However,
if you require anything
more sophisticated (username/password, HTTP
proxy settings, etc.) you will need
to configure the underlying
client.
</p>
<p>
The underlying client configuration is provided by accessing the
<a href="./apidocs/ca/uhn/fhir/rest/client/IRestfulClientFactory.html">IRestfulClientFactory</a>
class from the FhirContext.
</p>
<p>
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>
<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">
<p>
The following example shows how to configure the use of an HTTP
proxy in the client.
</p>
<macro name="snippet">
<param name="id" value="proxy" />
<param name="file" value="examples/src/main/java/example/ClientExamples.java" />
<param name="id" value="proxy"/>
<param name="file"
value="examples/src/main/java/example/ClientExamples.java"/>
</macro>
</subsection>
</section>
</body>