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
on 2012/03/11 20:51
Change comment:
There is no comment for this version
To version 29.1
edited by Pascal Robert
on 2012/05/29 08:27
on 2012/05/29 08:27
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,13 +1,139 @@ 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 +** er.rest.jodaTime 50 +** ERXRest.transactionsEnabled (default 'false') ERXRestTransactionRequestAdaptor 51 +** ERXRest.maxEventsPerTransaction (default '50') ERXRestTransactionRequestAdaptor 52 +** ERXRest.accessControlAllowRequestHeaders (ERXRouteController) 53 +** ERXRest.accessControlAllowRequestMethods (ERXRouteController) 54 +** ERXRest.defaultFormat (ERXRouteController) 55 +*** (default "xml") Allow you to set the default format for all of your REST controllers 56 +** ERXRest.allowWindowNameCrossDomainTransport (ERXRouteController) 57 +** ERXRest.accessControlMaxAge (ERXRouteController) 58 +*** (default 1728000) This header indicates how long the results of a preflight request can be cached. For an example of a preflight request, see the above examples. 59 +** ERXRest.accessControlAllowOrigin (ERXRouteController) 60 +*** Set the value to '**' to enable all origins. See [[https://developer.mozilla.org/En/HTTP_access_control#Access-Control-Allow-Origin]]** 61 +* JSON Schema 62 +** {{code}} 63 +/something?schema=true 64 + 65 +public WOActionResults indexAction() { 66 +if (isSchemaRequest()) { 67 + return schemaResponse(showFilter()); 68 +} 69 +protected boolean isSchemaRequest() { 70 + return request().stringFormValueForKey("schema") != null; 71 +} 72 +{{/code}} 73 + 74 +Same Origin policy 75 +Transactions 76 +HTML vs other formats 77 +Response representation 78 +Missing route 79 +Missing object 80 +POJO objects 81 +Headers 82 +Caching 83 +Adding new format 84 +Security 85 +strictMode 86 +Workflow 87 +Query arguments and RXRestFetchSpecification 88 +ERXRestNameRegistry 89 +MapClassDescription / NSDictionaryClassDescription 90 + 91 +ERXRestUtils 92 +Properties 93 +er.rest.dateFormat 94 +er.rest.timestampFormat 95 +er.rest.rfcDateFormat 96 + 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 101 +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 103 +ERXRouteRequestHandler(WOActionRequestHandler).//handleRequest(WORequest) line: 259 104 +PagesController(ERXRouteController).performActionNamed(String) line: 1328 105 +PagesController(ERXRouteController).performActionNamed(String, boolean) line: 1385 106 +PagesController(ERXRouteController).performRouteActionNamed(String) line: 1510 107 +PagesController(ERXRouteController).performActionWithArguments(Method, Object...) line: 1559 12 12 ... 13 -PagesController.mainPageAction() line: 20 // 109 +PagesController.mainPageAction() line: 20// 110 + 111 +== ERXRouteRequestHandler == 112 + 113 +| **Properties** 114 +| ERXRest.missingControllerName | (default "ERXMissingRouteController") 115 +\\ 116 +| ERXRest.parseUnknownExtensions | ERXRest.parseUnknownExtensions 117 +\\ 118 +| ERXRest.pluralEntityNames | ERXRest.pluralEntityNames 119 +\\ 120 +| ERXRest.routeCase | ERXRest.routeCase 121 +\\ 122 +| ERXRest.lowercaseEntityNames | ERXRest.lowercaseEntityNames 123 + 124 +ERXMissingRouteController is the controller that is used when no route can be found. It's "missing" action is loaded. 125 + 126 +| **Properties** 127 +| ERXRest.strictMode | ERXRest.strictMode 128 +\\ | 129 +ERXRouteController 130 + 131 +Properties 132 + 133 +ERXRest.accessControlAllowRequestHeaders 134 +ERXRest.accessControlAllowRequestMethods 135 +ERXRest.defaultFormat 136 +ERXRest.strictMode 137 +ERXRest.allowWindowNameCrossDomainTransport 138 +ERXRest.accessControlMaxAge 139 +ERXRest.accessControlAllowOrigin