Skip to content

Commit

Permalink
Item2321: use Douglas Crockford's latest json2 lib to encode
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/RestPlugin@10583 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
SvenDowideit authored and SvenDowideit committed Jan 20, 2011
1 parent ecf6446 commit 3f2ad05
Show file tree
Hide file tree
Showing 4 changed files with 492 additions and 4 deletions.
9 changes: 6 additions & 3 deletions data/Sandbox/TestRestPlugin.txt
Expand Up @@ -6,6 +6,7 @@ This topic contains an example of a %SYSTEMWEB%.RestPlugin =GET= and =PATCH= of
Note that _every_ query request response will contain a new validation nonce that can then be used to POST/PATCH/DELETE/PUT

%JQREQUIRE{"Form"}%
%ADDTOZONE{"script" text="<script type='text/javascript' href='%PUBURL%/%SYSTEMWEB%/RestPlugin/json2.js'></script>" id="json2.js"}%

<script>
// prepare the form when the DOM is ready
Expand Down Expand Up @@ -48,7 +49,7 @@ $(document).ready(function() {

var newtext = $('#query_output').val();

//console.log('newtext: '+newtext);
console.log('newtext: '+newtext);

//clear the textarea
$('#query_output').text('SUBMITTING');
Expand All @@ -60,8 +61,10 @@ $(document).ready(function() {

jQuery.ajax({
contentType: 'text/json',
data: '{"_text": "'+newtext+'"}',
processData: false,
data: JSON.stringify({_text: newtext}),
//data: {_text: newtext, tickle: 'one more time'},
//data: '{"_text": "'+newtext+'"}',
//processData: false,
type: 'PATCH',
url: 'http://x61/f/bin/query/'+query+'/'+element+'.'+encoding,
success: showResponse, // post-submit callback
Expand Down
3 changes: 2 additions & 1 deletion data/System/RestPlugin.txt
Expand Up @@ -17,7 +17,8 @@ This plugin begins the task of creating a CRUD style REST URI engine for Foswiki
It uses a Foswiki:Development.TopicObjectModel addressing scheme based on the System.IfStatements and System.QuerySearch syntax,
and then enable both the retriving and setting / creation of topics and parts of topics.

Initially supporting JSON encoding, it can be extended to anything - so long as symetrical serialisation/deserialisation are implemented using the (post foswiki 1.1) =Foswiki::Serialise= class.
Initially supporting JSON encoding, it can be extended to anything - so long as symetrical
serialisation/deserialisation are implemented using the (post foswiki 1.1) =Foswiki::Serialise= class.

---+++ Authentication
At this point 2 Login managers have been tested, Apache auth based, and !TemplateLogin.
Expand Down
1 change: 1 addition & 0 deletions lib/Foswiki/Plugins/RestPlugin/MANIFEST
Expand Up @@ -12,6 +12,7 @@ pub/System/RestPlugin/Edit-chalk-10g.png
pub/System/RestPlugin/formfield_example.png
pub/System/RestPlugin/Image-Edit-chalk-10bo.png
pub/System/RestPlugin/Wiki-text-icon.png
pub/System/RestPlugin/json2.js

#demo topic
data/Sandbox/TestRestPlugin.txt
Expand Down

0 comments on commit 3f2ad05

Please sign in to comment.