Changes for page ERRest In Depth
Last modified by Pascal Robert on 2012/06/10 16:01
From version 28.1
edited by Pascal Robert
on 2012/03/11 20:59
on 2012/03/11 20:59
Change comment:
There is no comment for this version
To version 30.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,3 +1,99 @@ 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 ... ... @@ -28,36 +28,16 @@ 28 28 ERXMissingRouteController is the controller that is used when no route can be found. It's "missing" action is loaded. 29 29 30 30 | **Properties** 31 -| ERXRest.strictMode | ERXRest.strictMode 32 -\\ 127 +| ERXRest.strictMode | ERXRest.strictMode 128 +\\ | 33 33 ERXRouteController 34 34 35 35 Properties 36 36 37 37 ERXRest.accessControlAllowRequestHeaders 38 -ERXRest.accessControlAllowRequestHeaders 39 - 40 - 41 41 ERXRest.accessControlAllowRequestMethods 42 -ERXRest.accessControlAllowRequestMethods 43 - 44 - 45 45 ERXRest.defaultFormat 46 -ERXRest.defaultFormat 47 - 48 - 49 49 ERXRest.strictMode 50 -ERXRest.strictMode 51 - 52 - 53 53 ERXRest.allowWindowNameCrossDomainTransport 54 -ERXRest.allowWindowNameCrossDomainTransport 55 - 56 - 57 57 ERXRest.accessControlMaxAge 58 -ERXRest.accessControlMaxAge 59 - 60 - 61 61 ERXRest.accessControlAllowOrigin 62 -ERXRest.accessControlAllowOrigin 63 -