<% caching.duration = 30000; %><%& '/header/' %>

Manual Resources

The following examples are of manual resources written in all supported languages. The resource state is stored in the application globals, so the source code, purposely verbose, is a good example of how to optimize shared state access for high concurrency.

We'll be using JavaScript (in your browser) to communicate with Prudence resources, using jQuery. Thus, this is also a useful example of "AJAX" essentials: JSON representations are consumed as native JavaScript data structures in the browser.

The representations are all in JSON. Press an action button to try it out.

POST ("update") only changes JSON keys that you specify in the resource, while leaving the others intact. PUT ("create/replace") replaces the entire resource.

Resource

JavaScript
<% if (executable.languageManager.getAdapterByTag('jython')) { %> Python
<% } %> <% if (executable.languageManager.getAdapterByTag('ruby')) { %> Ruby
<% } %> <% if (executable.languageManager.getAdapterByTag('quercus')) { %> PHP
<% } %> <% if (executable.languageManager.getAdapterByTag('lua')) { %> Lua
<% } %> <% if (executable.languageManager.getAdapterByTag('groovy')) { %> Groovy
<% } %> <% if (executable.languageManager.getAdapterByTag('clojure')) { %> Clojure
<% } %>

MIME type to prefer

(Used in GET, POST and PUT only)

application/json
text/plain

JSON to send

(Used in POST and PUT only)

Actions





Result of last action

n/a

<%& '/footer/' %>