Wiki source code of ERRest In Depth
Version 44.1 by Pascal Robert on 2012/05/02 21:09
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | * ERXRestContext | ||
2 | ** contains the editing context and an userInfo dictionnary | ||
3 | ** will be populated with er.rest.dateFormat, er.rest.timestampFormatter and er.rest.timestampFormat (read only for non-HTML responses) | ||
4 | *** want to change the time format for a specific controller? | ||
5 | |||
6 | {{code}} | ||
7 | |||
8 | protected ERXRestContext createRestContext() { | ||
9 | ERXRestContext restContext = new ERXRestContext(editingContext()); | ||
10 | restContext.setUserInfoForKey("yyyy-MM-dd", "er.rest.dateFormat"); | ||
11 | restContext.setUserInfoForKey("yyyy-MM-dd", "er.rest.timestampFormat"); | ||
12 | return restContext; | ||
13 | } | ||
14 | |||
15 | {{/code}} | ||
16 | |||
17 | * | ||
18 | ** you just need to override createRestContext() in your controller if you want to add other stuff to the context (a user, etc.) | ||
19 | * Properties | ||
20 | ** ERXRest.idKey (ERXRestFormatDelegate) | ||
21 | *** (default "id") Override this property if you want to use a different key for the 'id' attribute** ERXRest.typeKey** | ||
22 | ** ERXRest.nilKey (ERXRestFormatDelegate) | ||
23 | ** ERXRest.writeNilKey (ERXRestFormatDelegate) | ||
24 | ** ERXRest.pluralEntityNames (ERXRestFormatDelegate) | ||
25 | ** ERXRest.writeTypeKey (ERXRestFormatDelegate) | ||
26 | ** ERXRest.suppressTypeAttributesForSimpleTypes (ERXXmlRestWriter) | ||
27 | *** (default "false") If set to true, primitive types, like type = "datetime", won't be added to the output | ||
28 | ** ERXRest.strictMode | ||
29 | *** In ERXMissingRouteController: (default "true") If set to true, status code in the response will be 405 Not Allowed, if set to false, status code will be 404 Not Found | ||
30 | *** In ERXRouteController: (default "true") If set to true, status code in the response will be 405 Not Allowed, if set to false, status code will be 404 Not Found | ||
31 | *** ERXRouteResults: (default "true") If set to true, creating a ressource will return status code 201 Created, if set to false, will return 200 OK | ||
32 | ** ERXRest.pluralEntityNames (ERXRouteRequestHandler) | ||
33 | ** ERXRest.routeCase (ERXRouteRequestHandler) | ||
34 | ** ERXRest.lowercaseEntityNames (ERXRouteRequestHandler) | ||
35 | ** ERXRest.parseUnknownExtensions (ERXRouteRequestHandler) | ||
36 | *** (default "true") If set to "false", will return a 404 status code if the format doesn't exist | ||
37 | ** ERXRest.missingControllerName (ERXRouteRequestHandler) | ||
38 | *** (default "ERXMissingRouteController") Allow you to specify which controller to use when a route doesn't exist | ||
39 | ** er.rest.rfcDateFormat | ||
40 | ** er.rest.dateFormat | ||
41 | ** er.rest.dateFormat.primary | ||
42 | ** er.rest.dateFormat.secondary | ||
43 | ** er.rest.dateFormatter | ||
44 | ** er.rest.timestampFormat | ||
45 | ** er.rest.timestampFormat.primary | ||
46 | ** er.rest.timestampFormat.secondary | ||
47 | ** er.rest.timestampFormatter | ||
48 | ** er.rest.rfcDateFormat | ||
49 | ** ERXRest.transactionsEnabled | ||
50 | ** ERXRest.maxEventsPerTransaction | ||
51 | * JSON Schema | ||
52 | ** {{code}} | ||
53 | /something?schema=true | ||
54 | |||
55 | public WOActionResults indexAction() { | ||
56 | if (isSchemaRequest()) { | ||
57 | return schemaResponse(showFilter()); | ||
58 | } | ||
59 | protected boolean isSchemaRequest() { | ||
60 | return request().stringFormValueForKey("schema") != null; | ||
61 | } | ||
62 | {{/code}} | ||
63 | |||
64 | Same Origin policy | ||
65 | Transactions | ||
66 | HTML vs other formats | ||
67 | Response representation | ||
68 | Missing route | ||
69 | Missing object | ||
70 | POJO objects | ||
71 | Headers | ||
72 | Caching | ||
73 | Adding new format | ||
74 | Security | ||
75 | strictMode | ||
76 | Workflow | ||
77 | Query arguments and RXRestFetchSpecification | ||
78 | ERXRestNameRegistry | ||
79 | MapClassDescription / NSDictionaryClassDescription | ||
80 | |||
81 | ERXRestUtils | ||
82 | Properties | ||
83 | er.rest.dateFormat | ||
84 | er.rest.timestampFormat | ||
85 | er.rest.rfcDateFormat | ||
86 | |||
87 | request > route | ||
88 | |||
89 | Application(ERXApplication).dispatchRequest(WORequest) line: 2051 | ||
90 | ERXRouteRequestHandler(WOActionRequestHandler).//handleRequest(WORequest) line: 221 | ||
91 | ERXRouteRequestHandler.getRequestHandlerPathForRequest(WORequest) line: 782// | ||
92 | |||
93 | ERXRouteRequestHandler(WOActionRequestHandler).//handleRequest(WORequest) line: 259 | ||
94 | PagesController(ERXRouteController).performActionNamed(String) line: 1328 | ||
95 | PagesController(ERXRouteController).performActionNamed(String, boolean) line: 1385 | ||
96 | PagesController(ERXRouteController).performRouteActionNamed(String) line: 1510 | ||
97 | PagesController(ERXRouteController).performActionWithArguments(Method, Object...) line: 1559 | ||
98 | ... | ||
99 | PagesController.mainPageAction() line: 20// | ||
100 | |||
101 | == ERXRouteRequestHandler == | ||
102 | |||
103 | | **Properties** | ||
104 | | ERXRest.missingControllerName | (default "ERXMissingRouteController") | ||
105 | \\ | ||
106 | | ERXRest.parseUnknownExtensions | ERXRest.parseUnknownExtensions | ||
107 | \\ | ||
108 | | ERXRest.pluralEntityNames | ERXRest.pluralEntityNames | ||
109 | \\ | ||
110 | | ERXRest.routeCase | ERXRest.routeCase | ||
111 | \\ | ||
112 | | ERXRest.lowercaseEntityNames | ERXRest.lowercaseEntityNames | ||
113 | |||
114 | ERXMissingRouteController is the controller that is used when no route can be found. It's "missing" action is loaded. | ||
115 | |||
116 | | **Properties** | ||
117 | | ERXRest.strictMode | ERXRest.strictMode | ||
118 | \\ | | ||
119 | ERXRouteController | ||
120 | |||
121 | Properties | ||
122 | |||
123 | ERXRest.accessControlAllowRequestHeaders | ||
124 | ERXRest.accessControlAllowRequestMethods | ||
125 | ERXRest.defaultFormat | ||
126 | ERXRest.strictMode | ||
127 | ERXRest.allowWindowNameCrossDomainTransport | ||
128 | ERXRest.accessControlMaxAge | ||
129 | ERXRest.accessControlAllowOrigin |