Changes for page ERRest In Depth

Last modified by Pascal Robert on 2012/06/10 16:01

From version 26.1
edited by Pascal Robert
on 2012/03/11 20:51
Change comment: There is no comment for this version
To version 23.1
edited by Pascal Robert
on 2012/05/02 16:16
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,13 +1,125 @@
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
21 +** ERXRest.typeKey
22 +** ERXRest.nilKey
23 +** ERXRest.writeNilKey
24 +** ERXRest.pluralEntityNames
25 +** ERXRest.writeTypeKey
26 +** ERXRest.suppressTypeAttributesForSimpleTypes
27 +** ERXRest.strictMode
28 +** ERXRest.pluralEntityNames (ERXRouteRequestHandler)
29 +** ERXRest.routeCase (ERXRouteRequestHandler)
30 +** ERXRest.lowercaseEntityNames (ERXRouteRequestHandler)
31 +** ERXRest.parseUnknownExtensions (ERXRouteRequestHandler)
32 +*** (default "true") If set to "false", will return a 404 status code if the format doesn't exist
33 +** ERXRest.missingControllerName (ERXRouteRequestHandler)
34 +*** (default "ERXMissingRouteController") Allow you to specify which controller to use when a route doesn't exist
35 +** er.rest.rfcDateFormat
36 +** er.rest.dateFormat
37 +** er.rest.dateFormat.primary
38 +** er.rest.dateFormat.secondary
39 +** er.rest.dateFormatter
40 +** er.rest.timestampFormat
41 +** er.rest.timestampFormat.primary
42 +** er.rest.timestampFormat.secondary
43 +** er.rest.timestampFormatter
44 +** er.rest.rfcDateFormat
45 +** ERXRest.transactionsEnabled
46 +** ERXRest.maxEventsPerTransaction
47 +* JSON Schema
48 +** {{code}}
49 +/something?schema=true
50 +
51 +public WOActionResults indexAction() {
52 +if (isSchemaRequest()) {
53 + return schemaResponse(showFilter());
54 +}
55 +protected boolean isSchemaRequest() {
56 + return request().stringFormValueForKey("schema") != null;
57 +}
58 +{{/code}}
59 +
60 +Same Origin policy
61 +Transactions
62 +HTML vs other formats
63 +Response representation
64 +Missing route
65 +Missing object
66 +POJO objects
67 +Headers
68 +Caching
69 +Adding new format
70 +Security
71 +strictMode
72 +Workflow
73 +Query arguments and RXRestFetchSpecification
74 +ERXRestNameRegistry
75 +MapClassDescription / NSDictionaryClassDescription
76 +
77 +ERXRestUtils
78 +Properties
79 +er.rest.dateFormat
80 +er.rest.timestampFormat
81 +er.rest.rfcDateFormat
82 +
1 1  request > route
2 2  
3 3  Application(ERXApplication).dispatchRequest(WORequest) line: 2051
4 4  ERXRouteRequestHandler(WOActionRequestHandler).//handleRequest(WORequest) line: 221
5 -ERXRouteRequestHandler.getRequestHandlerPathForRequest(WORequest) line: 782 //
87 +ERXRouteRequestHandler.getRequestHandlerPathForRequest(WORequest) line: 782//
6 6  
7 -ERXRouteRequestHandler(WOActionRequestHandler).//handleRequest(WORequest) line: 259
8 -PagesController(ERXRouteController).performActionNamed(String) line: 1328
9 -PagesController(ERXRouteController).performActionNamed(String, boolean) line: 1385
10 -PagesController(ERXRouteController).performRouteActionNamed(String) line: 1510
11 -PagesController(ERXRouteController).performActionWithArguments(Method, Object...) line: 1559
89 +ERXRouteRequestHandler(WOActionRequestHandler).//handleRequest(WORequest) line: 259
90 +PagesController(ERXRouteController).performActionNamed(String) line: 1328
91 +PagesController(ERXRouteController).performActionNamed(String, boolean) line: 1385
92 +PagesController(ERXRouteController).performRouteActionNamed(String) line: 1510
93 +PagesController(ERXRouteController).performActionWithArguments(Method, Object...) line: 1559
12 12  ...
13 -PagesController.mainPageAction() line: 20 //
95 +PagesController.mainPageAction() line: 20//
96 +
97 +== ERXRouteRequestHandler ==
98 +
99 +| **Properties**
100 +| ERXRest.missingControllerName | (default "ERXMissingRouteController")
101 +\\          
102 +| ERXRest.parseUnknownExtensions | ERXRest.parseUnknownExtensions
103 +\\          
104 +| ERXRest.pluralEntityNames | ERXRest.pluralEntityNames
105 +\\          
106 +| ERXRest.routeCase | ERXRest.routeCase
107 +\\          
108 +| ERXRest.lowercaseEntityNames | ERXRest.lowercaseEntityNames
109 +
110 +ERXMissingRouteController is the controller that is used when no route can be found. It's "missing" action is loaded.
111 +
112 +| **Properties**
113 +| ERXRest.strictMode | ERXRest.strictMode
114 +\\          |
115 +ERXRouteController
116 +
117 +Properties
118 +
119 +ERXRest.accessControlAllowRequestHeaders
120 +ERXRest.accessControlAllowRequestMethods
121 +ERXRest.defaultFormat
122 +ERXRest.strictMode
123 +ERXRest.allowWindowNameCrossDomainTransport
124 +ERXRest.accessControlMaxAge
125 +ERXRest.accessControlAllowOrigin