jsonld-java/jsonld-java — pull request #105 by stain (2014-03-19 13:54:00+00:00)
Title: Allow loading remote @context from bundled JAR cache

This suggested patch provides a new mechanism for bundling JSON-LD context in an application's classpath (e.g. JAR) - bypassing the need for network access.

See https://github.com/stain/jsonld-java/blob/e6a6781bf1afbf0f08bf5f8c143c7cf6d3ba1d8f/README.md#controlling-network-traffic for further documentation.

Short version:

Add `contexts/example.jsonld` to classpath together with `jarcache.json` containing:

[
{
"Content-Location": "http://www.example.com/context",
"X-Classpath": "contexts/example.jsonld",
"Content-Type": "application/ld+json"
}
]

I also modified `DocumentLoader slightly with regards to static/instance methods for modifying the Apache HTTP client. It would make more sense to be able to manually override the http client in custom DocumentLoader uses (coupled with usage in JsonLdOptions) (say if you did not want cache, or need authentication). -- this is also explained in the updated README;

The DocumentLoader does however try to use a common default http client unless overridden - thus the existing memory cache is shared among any usage of JSONLD-Java.