Headlands
REST Frontend For JCACHE / JSR-107
Install / Use
/learn @AdamBien/HeadlandsREADME
headlands
RESTified JCACHE / JSR-107
Installation
- Requirements: Java 8 and Java EE 7 server. Tested with WildFly 8 and GlassFish v4
- Download the headlands.war and drop it into the "autodeployment" directory.
Usage
Create Cache
curl -i -XPUT -H"Content-type: application/json" -d'{"storeByValue":true}' http://localhost:8080/headlands/resources/caches/workshops
Get cache names
curl http://localhost:8080/headlands/resources/caches/
Cache Configuration
curl -i -XOPTIONS http://localhost:8080/headlands/resources/caches/workshops
put('chief','duke') at the workshops cache
curl -i -XPUT -d'duke' http://localhost:8080/headlands/resources/caches/workshops/entries/chief
List entries for the cache "workshops"
curl -i http://localhost:8080/headlands/resources/caches/workshops/entries/
Delete the entry with the key: "chief" at the cache workshops
curl -i -XDELETE http://localhost:8080/headlands/resources/caches/workshops/entries/chief
Delete all entries of the workshops cache
curl -i -XDELETE http://localhost:8080/headlands/resources/caches/workshops/entries
Submit and execute a cache processor written in JavaScript (Nashorn) to the workshops cache. A cache processor has access to the entire cache with the specified name. The result is just a convenience Map which is going to be serialized and sent back to the client.
curl -i -H'Content-type:application/json' -XPOST --data 'function process(cache, result) {
for each (entry in cache) {
var key = entry.key;
var value = entry.value;
print(key, "=", value);
result.put(key, value+" result");
}
return result;
}' http://localhost:8080/headlands/resources/cache-processors/workshops
Output:
{"chief":"duke result"}
Submit and execute an entry processor which operates on the specified keys.
curl -i -H'Content-type:application/json' -XPOST --data '{
"script" : "function process(entry, args) {return \"The answer: \" + entry.getValue();}",
"keys" : [
"chief"
]
}' http://localhost:8080/headlands/resources/entry-processors/workshops
Output:
{"chief":"The answer: duke"}
Receiving WebSocket notifications
Cache-change events are delivered via the following URI
ws://localhost:8080/headlands/firehose/{cache-name}
The change events are delivered in the following JSON-format:
{"cacheName":"cache-1465959736089","eventType":"UPDATED","key":"status1465959736241","status1465959736241":
{"newValue":"java rocks 1465959736241-UPDATED",
"oldValue":"java rocks 1465959736241"
}
}
Related Skills
node-connect
340.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
340.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.1kCommit, push, and open a PR
