Changes for page ERRest In Depth
Last modified by Pascal Robert on 2012/06/10 16:01
From version 36.1
edited by Pascal Robert
on 2012/03/11 21:01
on 2012/03/11 21:01
Change comment:
There is no comment for this version
To version 39.1
edited by Pascal Robert
on 2012/05/02 21:50
on 2012/05/02 21:50
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,98 @@ 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 (default 'false') ERXRestTransactionRequestAdaptor 50 +** ERXRest.maxEventsPerTransaction (default '50') ERXRestTransactionRequestAdaptor 51 +** ERXRest.accessControlAllowRequestHeaders (ERXRouteController) 52 +** ERXRest.accessControlAllowRequestMethods (ERXRouteController) 53 +** ERXRest.defaultFormat (ERXRouteController) 54 +*** (default "xml") Allow you to set the default format for all of your REST controllers 55 +** ERXRest.allowWindowNameCrossDomainTransport (ERXRouteController) 56 +** ERXRest.accessControlMaxAge (ERXRouteController) 57 +*** (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. 58 +** ERXRest.accessControlAllowOrigin (ERXRouteController) 59 +*** Set the value to '**' to enable all origins. See https:~/~/developer.mozilla.org/En/HTTP_access_control#Access-Control-Allow-Origin** 60 +* JSON Schema 61 +** {{code}} 62 +/something?schema=true 63 + 64 +public WOActionResults indexAction() { 65 +if (isSchemaRequest()) { 66 + return schemaResponse(showFilter()); 67 +} 68 +protected boolean isSchemaRequest() { 69 + return request().stringFormValueForKey("schema") != null; 70 +} 71 +{{/code}} 72 + 73 +Same Origin policy 74 +Transactions 75 +HTML vs other formats 76 +Response representation 77 +Missing route 78 +Missing object 79 +POJO objects 80 +Headers 81 +Caching 82 +Adding new format 83 +Security 84 +strictMode 85 +Workflow 86 +Query arguments and RXRestFetchSpecification 87 +ERXRestNameRegistry 88 +MapClassDescription / NSDictionaryClassDescription 89 + 90 +ERXRestUtils 91 +Properties 92 +er.rest.dateFormat 93 +er.rest.timestampFormat 94 +er.rest.rfcDateFormat 95 + 1 1 request > route 2 2 3 3 Application(ERXApplication).dispatchRequest(WORequest) line: 2051