├── restfulcf
├── test
│ ├── Application.cfc
│ ├── tests
│ │ ├── util
│ │ │ ├── ArrayMergeFixture.cfc
│ │ │ ├── XMLTest.cfc
│ │ │ ├── InflectorTest.cfc
│ │ │ └── ArraysTest.cfc
│ │ └── core
│ │ │ ├── ControllerTest.cfc
│ │ │ ├── cache
│ │ │ ├── EmptyCacheTest.cfc
│ │ │ ├── ApplicationCacheTest.cfc
│ │ │ └── AbstractCacheTest.cfc
│ │ │ ├── ErrorCollectionTest.cfc
│ │ │ ├── AuthenticatorTest.cfc
│ │ │ ├── ResourceFixture.cfc
│ │ │ ├── ResourceCountTest.cfc
│ │ │ ├── RouteCollectionTest.cfc
│ │ │ ├── RouteTest.cfc
│ │ │ ├── ResponseTest.cfc
│ │ │ ├── ResourceCollectionTest.cfc
│ │ │ └── ResourceTest.cfc
│ └── index.cfm
├── sample
│ └── helloworld
│ │ ├── public
│ │ ├── .htaccess
│ │ ├── rest.cfm
│ │ └── Application.cfc
│ │ ├── rest
│ │ ├── Dispatcher.cfc
│ │ ├── resources
│ │ │ └── World.cfc
│ │ └── controllers
│ │ │ └── Worlds.cfc
│ │ └── README.markdown
└── framework
│ ├── core
│ ├── cache
│ │ ├── EmptyCache.cfc
│ │ ├── ApplicationCache.cfc
│ │ └── AbstractCache.cfc
│ ├── Authenticator.cfc
│ ├── ErrorCollection.cfc
│ ├── RouteCollection.cfc
│ ├── ResourceCount.cfc
│ ├── Controller.cfc
│ ├── Route.cfc
│ ├── ResourceCollection.cfc
│ ├── Response.cfc
│ ├── Request.cfc
│ ├── Resource.cfc
│ └── Dispatcher.cfc
│ ├── util
│ ├── XML.cfc
│ ├── Arrays.cfc
│ └── Inflector.cfc
│ └── tags
│ └── endpoint.cfm
├── LICENSE
└── TODO.markdown
/restfulcf/test/Application.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/restfulcf/sample/helloworld/public/.htaccess:
--------------------------------------------------------------------------------
1 | ##
2 | # This Apache rewrite file is to remove the need for everything to explicitly
3 | # run through rest.cfm for much cleaner URLs. Instead of:
4 | #
5 | # http://localhost/rest.cfm/resource.xml
6 | #
7 | # this rewrite allows us to drop the "rest.cfm" part as follows:
8 | #
9 | # http://localhost/resource.xml
10 | #
11 |
12 | RewriteEngine on
13 | RewriteCond %{REQUEST_FILENAME} !-f
14 | RewriteRule ([a-z]{1}.*)?$ rest.cfm/$1 [QSA,L]
15 |
--------------------------------------------------------------------------------
/restfulcf/sample/helloworld/public/rest.cfm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I am the entry point for all REST calls
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
18 |
--------------------------------------------------------------------------------
/restfulcf/test/tests/util/ArrayMergeFixture.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I am a fixture component that allows testing of merging arrays containing component instances
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/restfulcf/framework/core/cache/EmptyCache.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I am a concrete implementation of an abstract cache which doesn't actually cache anything.
5 | This is the default cache instance for the framework.
6 |
7 |
8 | --->
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/restfulcf/test/tests/core/ControllerTest.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I test the base controller
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2009 Tim Blair
2 |
3 | Permission is hereby granted, free of charge, to any person
4 | obtaining a copy of this software and associated documentation
5 | files (the "Software"), to deal in the Software without
6 | restriction, including without limitation the rights to use,
7 | copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the
9 | Software is furnished to do so, subject to the following
10 | conditions:
11 |
12 | The above copyright notice and this permission notice shall be
13 | included in all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 | OTHER DEALINGS IN THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/restfulcf/sample/helloworld/public/Application.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I define the application settings for RESTfulCF example applicatino
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/restfulcf/test/index.cfm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I am the test scripts runner
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | #dir#
18 |
19 |
20 |
21 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | #results.getResultsOutput(URL.output)#
36 |
37 |
--------------------------------------------------------------------------------
/TODO.markdown:
--------------------------------------------------------------------------------
1 | # RESTfulCF To-Do List
2 |
3 | In no particular order...
4 |
5 | ## Framework Features
6 |
7 | * Regex or similar support for route parameters, e.g. /resources/[0-9]+
8 | * Use of Accept: header for defining the response type, in addition to file extension
9 | * Error handling
10 | * Handling of CF errors
11 | * Needs to be extracted from existing WLD implementation and refined
12 | * Unit tests required
13 | * Error capturing examples
14 | * Remove dependancy on `CGI['PATH_INFO']` and SES enabling via `web.xml`
15 | * Support for deserialising JSON-encoded body content on `POST`/`PUT`
16 | * Route aliases, e.g. `/x/1/y/2 => /y/2?x=1`
17 |
18 | ## Bugs and Known Issues
19 |
20 | * Controllers don't know the location of the API to output `Location` headers on successful `POST`
21 |
22 | ## Supporting Material
23 |
24 | * Tests
25 | * Unit tests required for Dispatcher and Request
26 | * More complex sample application, including:
27 | * Nested resources
28 | * Resource collections
29 | * Documentation
30 | * Much more detail required than just the README
31 | * "How to use RESTfulCF"
32 | * "How RESTfulCF works"
33 | * Packaged within app, or using Github wiki/pages?
34 | * Should tie in with project website
35 | * Project website including basic details, package downloads, update blog, docs etc
36 | * Build script to package up for download
37 |
--------------------------------------------------------------------------------
/restfulcf/framework/core/Authenticator.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I am the base component that any authenticator should extend
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/restfulcf/sample/helloworld/rest/Dispatcher.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I am a concrete representation of a ReSTful Dispatcher for the 'Hello World' sample app
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/restfulcf/test/tests/core/cache/EmptyCacheTest.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I test the empty ("does nothing") cache
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/restfulcf/sample/helloworld/rest/resources/World.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I am an example resource descriptor for a world for the "Hello World" sample app
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | #variables.instance.name# world
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/restfulcf/test/tests/core/cache/ApplicationCacheTest.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I test the application-scope cache
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/restfulcf/test/tests/core/ErrorCollectionTest.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I test the error collection component
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/restfulcf/test/tests/core/AuthenticatorTest.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I test the base authenticator
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/restfulcf/test/tests/core/ResourceFixture.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I am a test resource
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/restfulcf/framework/core/ErrorCollection.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I am a collection of routes
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | " & xmlformat(error) & "">
33 |
34 | ' & xml & ''>
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | " & htmleditformat(error) & "">
46 |
47 | ' & html & ''>
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/restfulcf/framework/core/RouteCollection.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I am a collection of routes
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/restfulcf/framework/core/ResourceCount.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I am a resource that represents a simple count
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | #variables.instance.count##variables.instance.type#>">
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/restfulcf/framework/core/cache/ApplicationCache.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I am a concrete implementation of an abstract cache that uses the application scope.
5 |
6 | NOTE: You probably don't want to use this: there's no reaper, so it could end up being
7 | quite a memory hog, plus it's not the most efficient. Just use it as an example of
8 | what you need to do to create your own concrete cache (using memcached or something
9 | similar, maybe...)
10 |
11 |
12 | --->
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/restfulcf/framework/util/XML.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Conversion of XML to useable structure/array.
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/restfulcf/framework/core/Controller.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I am the base of all controllers which hold domain over the various resources
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/restfulcf/test/tests/core/ResourceCountTest.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I test the resource count component
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/restfulcf/test/tests/core/RouteCollectionTest.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I test the route collection component
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/restfulcf/test/tests/core/RouteTest.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I test the route component
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/restfulcf/test/tests/core/ResponseTest.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I test the response object
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/restfulcf/framework/tags/endpoint.cfm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | I am the custom tag that pulls all REST requests together
6 |
7 |
8 | --->
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 | #chr(10)#' & variables.response.getResponseBody())>
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 | #variables.response.getResponseBody()#
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/restfulcf/test/tests/util/XMLTest.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I test the XML component functions to make sure they work
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/restfulcf/framework/core/Route.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I am a simple component representing a route
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
93 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/restfulcf/test/tests/core/cache/AbstractCacheTest.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I test the abstract (base) cache component
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 | ", response.response.getResponseBody())>
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
--------------------------------------------------------------------------------
/restfulcf/framework/core/ResourceCollection.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I am a resource that contains other resources (effectively an array of resources)
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 | ' & arraytolist(xml, chr(10)) & '#variables.instance.type#>'>
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 | ")>
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
--------------------------------------------------------------------------------
/restfulcf/framework/util/Arrays.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I am a collection of functions which provide generic CF array manipulation methods.
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/restfulcf/test/tests/core/ResourceCollectionTest.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I test the resource collection component
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | ")>
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
--------------------------------------------------------------------------------
/restfulcf/framework/core/cache/AbstractCache.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I am the base of all response caches
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
--------------------------------------------------------------------------------
/restfulcf/framework/core/Response.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I am a response object that gets passed to and updated by controller methods
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
--------------------------------------------------------------------------------
/restfulcf/sample/helloworld/rest/controllers/Worlds.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I am the controller for World resources for the "Hello World" sample app
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
20 |
21 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
--------------------------------------------------------------------------------
/restfulcf/sample/helloworld/README.markdown:
--------------------------------------------------------------------------------
1 | # RESTfulCF Sample App: Hello World
2 |
3 | The staple introductory or sample application for any language or framework, we present: RESTfulCF Hello World.
4 |
5 | ## Setup and Requirements
6 |
7 | The assumed setup is:
8 |
9 | * ColdFusion 8;
10 | * Apache with `mod_rewrite` enabled and allowed for per-directory settings (e.g. using `.htaccess`);
11 | * That the `restfulcf` directory is in your local web root.
12 |
13 | The sample application uses an `application`-scoped "database" for storing `World` instances, so no database is required.
14 |
15 | To make non-`GET` requests to a RESTfulCF implementation (i.e. for creating, updating or deleting resources), you'll need something other than your browser. `cURL` is good enough for you command-line people, or if you're a Firefox fan try the [Poster](https://addons.mozilla.org/en-US/firefox/addon/2691) plugin.
16 |
17 | > **Note**: if you are not using Apache with `mod_rewrite` enabled within an `.htaccess` file, you'll need to add `rest.cfm` to each of the URLs listed below, for example: `...public/worlds` should become `...public/rest.cfm/worlds`.
18 |
19 | ## Files
20 |
21 | This sample application is structured as follows (all within `restfulcf/sample/helloworld`):
22 |
23 | README.markdown – this file
24 | public – the "webroot" of this application
25 | .htaccess – Apache rewrite (to remove /rest.cfm/ from URLs)
26 | rest.cfm – public interface to the REST implementation
27 | Application.cfc – basic setup of application vars etc
28 | rest – the location of the controllers, resource descriptors etc
29 | Dispatcher.cfc – Dispatcher definition (extends restfulcf.framework.core.Dispatcher)
30 | controllers – all the controllers for the sample app
31 | Worlds.cfc – controller (extends restfulcf.framework.core.Controller)
32 | resources – all resources for the sample app
33 | World.cfc – resource definition (extends restfulcf.framework.core.Resource)
34 |
35 | The controller file name should be pluralised and CamelCased (although this can be overridden); the resource file name can anything, but should be singular and CamelCased for consistency.
36 |
37 | ## Controller Actions
38 |
39 | The sample controller (`rest/controllers/Worlds.cfc`) gives an example of the six default actions. The actions available, including an example of the HTTP request required to call that action, are as follows:
40 |
41 | * `index` -- list/index of all worlds (`GET /worlds`)
42 | * `create`: -- create a new world (`POST /worlds`)
43 | * `read`: -- read a single world (`GET /worlds/:id`)
44 | * `update`: -- update a single world (`PUT /worlds/:id`)
45 | * `delete`: -- delete a single world (`DELETE /worlds/:id`)
46 | * `count`: -- simple count, instead of listing all and counting (`GET /worlds/count`)
47 |
48 | ### `index`, `read` and `count` (via the HTTP `GET` method)
49 |
50 | The simplest calls that can be made are `GET` requests, as these can be made directly through your browser. Assuming the setup as described above, you can retrieve a list of all pre-defined `World`s (also known as a "collection" or resources) by simply putting the following into your browser:
51 |
52 | http://localhost/restfulcf/sample/helloworld/public/worlds
53 |
54 | This should return you an XML packet similar to the following:
55 |
56 |
57 |
58 |
59 | {ts '2009-07-13 08:31:45'}
60 | 2
61 | Goodbye
62 | {ts '2009-07-13 08:31:45'}
63 |
64 |
65 | {ts '1978-09-22 12:34:56'}
66 | 1
67 | Hello
68 | {ts '2009-07-13 08:31:45'}
69 |
70 |
71 |
72 | By default, the worlds are returned in alphabetical order by name; to change this, try the following:
73 |
74 | http://localhost/restfulcf/sample/helloworld/public/worlds?order=id
75 |
76 | The `index` function in `restfulcf/sample/helloworld/rest/controllers/Worlds.cfc` is setup to use the `sort` function of the `ResourceCollection` that's returned, based on the order given, which means you can sort based on any of the fields.
77 |
78 | To read just a single `World` resource, you just add the ID of the world to the end of the `index` URL as follows:
79 |
80 | http://localhost/restfulcf/sample/helloworld/public/worlds/1
81 |
82 | You'll then just get the single resource back:
83 |
84 |
85 | {ts '1978-09-22 12:34:56'}
86 | 1
87 | Hello
88 | {ts '2009-07-13 08:31:45'}
89 |
90 |
91 | The default representation of each resource is XML, but you can change this by simple adding the appropriate type of the end of the URL, as follows:
92 |
93 | http://localhost/restfulcf/sample/helloworld/public/worlds/1.txt
94 | http://localhost/restfulcf/sample/helloworld/public/worlds/1.html
95 | http://localhost/restfulcf/sample/helloworld/public/worlds/1.pdf
96 |
97 | If you request a representation that's not supported by the given resource, the HTTP response status will be `415 Unsupported Media Type`.
98 |
99 | If you simply wish to get a count of how many `World`s there are, you can append `/count` to the collection URI:
100 |
101 | http://localhost/restfulcf/sample/helloworld/public/worlds/count
102 |
103 | An XML representation of a count will look like the following:
104 |
105 |
106 | 2
107 |
108 |
109 | This method is not a standard RESTful, but has been added though the need to perform counts on resources, but not wanting to retrieve thousands of resources via the `index` method, simply to count how many there are.
110 |
111 | ### `create` (via the HTTP `POST` method)
112 |
113 | Creating a new resource is slightly more complicated, in that it requires an HTTP `POST` method. The example here is using `cURL` to create a new `World` resource:
114 |
115 | curl -d 'name=Another' http://localhost/restfulcf/sample/helloworld/public/worlds
116 |
117 | You can provide the properties for new resources either as `GET` or `POST` arguments (using the ColdFusion `URL` or `FORM` scopes), or by sending an XML representation of the resource as the `POST` body.
118 |
119 | Assuming that the new `World` was created successfully, the HTTP response status will be `201 Created`; the `Location` headed will include the unique URI to the newly created `World` resource, and the body will be the representation of the resource as if you had `read` it.
120 |
121 | If there is a validation error and the resource cannot be created, the response status will be `422 Unprocessable Entity`, and the body will be an array of error messages such as the following (if we provided an empty `name` property when trying to create a new `World`):
122 |
123 |
124 | Name must not be empty
125 |
126 |
127 | ### `update` (via the HTTP `PUT` method)
128 |
129 | Updating an existing resource is very similar to creating a new one: the properties for the resource are provided in the same way, and on a successful request the appropriate representation of the updated resource is returned as the response body.
130 |
131 | An `update` request differs from a `create` in that you must use the HTTP `PUT` method, and use the full URI to the resource, for example:
132 |
133 | curl -X PUT -d 'name=A Different' http://localhost/restfulcf/sample/helloworld/public/worlds/1
134 |
135 | If a resource cannot be found, the response status will be `404 Not Found`; on a successful update, the response will be `200 OK`. Validation errors are handled in the same way as for a `create` request.
136 |
137 | ### `delete` (via the HTTP `DELETE` method)
138 |
139 | The final request type is a `delete`; this is simply an HTTP `DELETE` request to a resource URI:
140 |
141 | curl -X DELETE http://localhost/restfulcf/sample/helloworld/public/worlds/1
142 |
143 | The response statuses are the same as for an `update` request (`200 OK` or `404 Not Found` as appropriate).
144 |
--------------------------------------------------------------------------------
/restfulcf/test/tests/util/InflectorTest.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I test the inflector to make sure it inflects things correctly
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
--------------------------------------------------------------------------------
/restfulcf/framework/util/Inflector.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I am a CF version of portions of the Ruby on Rails Inflector class, specifically the
5 | functions which provide the ability to generate singulars/plurals of given words,
6 | plus some translation functions.
7 |
8 |
9 | --->
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | // singular -> plural rules (most generic first)
22 | plural('$', 's');
23 | plural('s$', 's');
24 | plural('(ax|test)is$', '\1es');
25 | plural('(octop|vir)us$', '\1i');
26 | plural('(octop|vir)i$', '\1i');
27 | plural('(alias|status)$', '\1es');
28 | plural('(bu)s$', '\1ses');
29 | plural('(buffal|tomat)o$', '\1oes');
30 | plural('([ti])um$', '\1a');
31 | plural('([ti])a$', '\1a');
32 | plural('s[ei]s$', 'ses');
33 | plural('(?:([^f])fe|([lr])f)$', '\1\2ves');
34 | plural('(hive)$', '\1s');
35 | plural('([^aeiouy]|qu)y$', '\1ies');
36 | plural('(x|ch|ss|sh)$', '\1es');
37 | plural('(matr|vert|ind)(?:ix|ex)$', '\1ices');
38 | plural('([m|l])ouse$', '\1ice');
39 | plural('([m|l])ice$', '\1ice');
40 | plural('^(ox)(en)?$', '\1en');
41 | plural('(quiz)$', '\1zes');
42 | plural('(r|m|wom)en$', '\1en');
43 | plural('(people)$', '\1');
44 | // plural -> singular rules (most generic first)
45 | singular('s$', '');
46 | singular('(n)ews$', '\1ews');
47 | singular('([ti])a$', '\1um');
48 | singular('((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)s[ei]s$', '\1\2sis');
49 | singular('(^analy)s[ei]s$', '\1sis');
50 | singular('([^f])ves$', '\1fe');
51 | singular('([ht]ive)s$', '\1');
52 | singular('([lr])ves$', '\1f');
53 | singular('([^aeiouy]|qu)ies$', '\1y');
54 | singular('(s)eries$', '\1eries');
55 | singular('(m)ovies$', '\1ovie');
56 | singular('(x|ch|ss|sh)es$', '\1');
57 | singular('([m|l])ice$', '\1ouse');
58 | singular('(bus)(es)?$', '\1');
59 | singular('(o)es$', '\1');
60 | singular('(shoe)s$', '\1');
61 | singular('(cris|ax|test)[ei]s$', '\1is');
62 | singular('(octop|vir)(i|us)$', '\1us');
63 | singular('(alias|status)(es)?$', '\1');
64 | singular('^(ox)en', '\1');
65 | singular('(vert|ind)ices$', '\1ex');
66 | singular('(matr)ices$', '\1ix');
67 | singular('(quiz)zes$', '\1');
68 | singular('(database)s$', '\1');
69 | singular('(ess)$', '\1');
70 | // irregulars (singular, plural)
71 | irregular('person', 'people');
72 | irregular('man', 'men');
73 | irregular('child', 'children');
74 | irregular('sex', 'sexes');
75 | irregular('move', 'moves');
76 | irregular('zombie', 'zombies');
77 | // uncountables (words that don't change)
78 | uncountable('equipment');
79 | uncountable('information');
80 | uncountable('rice');
81 | uncountable('money');
82 | uncountable('species');
83 | uncountable('series');
84 | uncountable('fish');
85 | uncountable('sheep');
86 | uncountable('jeans');
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
--------------------------------------------------------------------------------
/restfulcf/framework/core/Request.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I represent an individual request for a resource
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
--------------------------------------------------------------------------------
/restfulcf/framework/core/Resource.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I am the base class for resources
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | " & xmlformat(value.toString()) & "#lcase(key)#>")>
76 |
77 |
78 |
79 | ")>
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 | " & xmlformat(value) & "#lcase(key)#>")>
106 |
107 |
108 | " & arraytolist(xml, chr(10)) & "#variables.type#>">
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 | #htmleditformat(lcase(key))#" & val.toHTML() & "")>
123 |
124 | #htmleditformat(lcase(key))#" & val.toString() & "")>
125 |
126 |
127 | #htmleditformat(lcase(key))#" & htmleditformat(val) & "")>
128 |
129 |
130 | " & arraytolist(html, chr(10)) & "">
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
--------------------------------------------------------------------------------
/restfulcf/test/tests/util/ArraysTest.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I test the array helper functions
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
--------------------------------------------------------------------------------
/restfulcf/framework/core/Dispatcher.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I am the core dispatcher / engine for the RESTful application
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
--------------------------------------------------------------------------------
/restfulcf/test/tests/core/ResourceTest.cfc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I test the resource component
5 |
6 |
7 | --->
8 |
9 |
10 |
11 |
12 |
13 |
14 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
--------------------------------------------------------------------------------