diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2013-09-16 10:56:21 +0300 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2013-09-16 11:00:38 +0300 |
commit | c8d12ce26e1847745077a187cccabf417f118732 (patch) | |
tree | e157155ca36b93e29e18025e1202ba2751765a24 | |
parent | 39585e03087158d37af2166aa47d06307c668d68 (diff) | |
download | aconf-c8d12ce26e1847745077a187cccabf417f118732.tar.bz2 aconf-c8d12ce26e1847745077a187cccabf417f118732.tar.xz |
protocol: change URL for transaction operations to /transaction
-rwxr-xr-x | dev-shell | 4 | ||||
-rw-r--r-- | protocol.txt | 6 | ||||
-rw-r--r-- | server.lua | 5 | ||||
-rw-r--r-- | web/client.js | 8 |
4 files changed, 13 insertions, 10 deletions
@@ -80,7 +80,7 @@ EOF PS1="$ACF_USER@acf2-dev-shell${ACF_TXN_ID:+($ACF_TXN_ID)}> " function start { - _acf_start_req / Transaction-ID TXN_ID -X POST + _acf_start_req /transaction Transaction-ID TXN_ID -X POST } function meta { @@ -115,7 +115,7 @@ EOF function commit { if [ "$ACF_TXN_ID" ]; then - if _acf_req / -X PUT; then + if _acf_req /transaction -X PUT; then echo Committed >&2 exit 1 fi diff --git a/protocol.txt b/protocol.txt index 523b474..bf00116 100644 --- a/protocol.txt +++ b/protocol.txt @@ -15,7 +15,7 @@ req: DELETE /login X-ACF-Auth-Token: <token> Start transaction: -req: POST / +req: POST /transaction resp: txn ID (in header as X-ACF-Transaction-ID) - use X-ACF-Transaction-ID in the header of any subsequent request to process it in the transaction's context @@ -23,11 +23,11 @@ resp: txn ID (in header as X-ACF-Transaction-ID) start transaction request Commit transaction: -req: PUT / +req: PUT /transaction X-ACF-Transaction-ID: <txn_id> Abort transaction: -req: DELETE / +req: DELETE /transaction X-ACF-Transaction-ID: <txn_id> Get object: @@ -39,7 +39,8 @@ return function(env) ) end - if path == '/' and method == 'GET' then + if path == '/' then + if method ~= 'GET' then return wrap(405) end return wrap(301, {['Location']='/browser/'}) end @@ -219,7 +220,7 @@ return function(env) return res == nil and 205 or 200, nil, res end - if path == '/' then + if path == '/transaction' then if ({DELETE=true, PUT=true})[method] then if not txn_id then return 405 end if method == 'PUT' then parent_txn:commit() end diff --git a/web/client.js b/web/client.js index d0114ca..c856788 100644 --- a/web/client.js +++ b/web/client.js @@ -84,7 +84,7 @@ $(function() { } function abort() { - var def = request("/", {type: "DELETE"}); + var def = request("/transaction", {type: "DELETE"}); reset(); return def; } @@ -299,7 +299,7 @@ $(function() { if (txn) def.resolve(); - else request("/", {type: "POST"}) + else request("/transaction", {type: "POST"}) .done(function(data, status, xhr) { txn = xhr.getResponseHeader( "X-ACF-Transaction-ID" @@ -313,7 +313,9 @@ $(function() { commit: function() { var def = $.Deferred(); - request("/", {type: "PUT"}).done(function() { + request( + "/transaction", {type: "PUT"} + ).done(function() { reset(); def.resolve(); }).fail(function(xhr) { def.reject(xhr); }); |