Updated Writing the handlers (markdown)

This commit is contained in:
colin-adams
2013-08-07 09:58:42 -07:00
parent 10caa4c1df
commit 7e4f51a7ce

View File

@@ -60,33 +60,34 @@ You need to implement this. If you do not have information about when a resource
This routine when a PUT request is made to a resource that does not exist. See [PUT](http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6) in the HTTP/1.1 specification for why you might want to return zero. This routine when a PUT request is made to a resource that does not exist. See [PUT](http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6) in the HTTP/1.1 specification for why you might want to return zero.
## allow_post_to_missing_resource ### allow_post_to_missing_resource
POST requests are normally made to an existing entity. However it is possible to create new resources using a POST, if the server allows it. This is where you make that decision. POST requests are normally made to an existing entity. However it is possible to create new resources using a POST, if the server allows it. This is where you make that decision.
If you return True, and the resource is created, a 201 Created response will be returned. If you return True, and the resource is created, a 201 Created response will be returned.
## content_length ### content_length
If you are not streaming the result, the the HTTP protocol requires that the length of the entity is known. You need to implement this routine to provide that information. If you are not streaming the result, the the HTTP protocol requires that the length of the entity is known. You need to implement this routine to provide that information.
## finished ### finished
If you are streaming the response, then you need to tell the framework when the last chunk has been sent. If you are streaming the response, then you need to tell the framework when the last chunk has been sent.
To implement this routine, you will probably need to call req.set_execution_variable (some-name, True) in ensure_content_avaiable and generate_next_chunk, and call attached {BOOLEAN} req.execution_variable (some-name) in this routine. To implement this routine, you will probably need to call req.set_execution_variable (some-name, True) in ensure_content_avaiable and generate_next_chunk, and call attached {BOOLEAN} req.execution_variable (some-name) in this routine.
## description ### description
This is for the automatically generated documentation that the framework will generate in response to a request that you have not mapped into an handler. This is for the automatically generated documentation that the framework will generate in response to a request that you have not mapped into an handler.
## delete ### delete
This routine is for carrying out a DELETE request to a resource. If it is valid to delete the named resource, then you should either go ahead and do it, or queue a deletion request somewhere (if you do that then you will probably need to call req.set_execution_variable (some-name-or-other, True). Otherwise you should call req.error_handler.add_custom_error to explain why the DELETE could not proceed (you should also do this if the attempt to delete the resource fails). This routine is for carrying out a DELETE request to a resource. If it is valid to delete the named resource, then you should either go ahead and do it, or queue a deletion request somewhere (if you do that then you will probably need to call req.set_execution_variable (some-name-or-other, True). Otherwise you should call req.error_handler.add_custom_error to explain why the DELETE could not proceed (you should also do this if the attempt to delete the resource fails).
Of course, if you have not mapped any DELETE requests to the URI space of this handler, then you can just do nothing. Of course, if you have not mapped any DELETE requests to the URI space of this handler, then you can just do nothing.
## delete_queued ### delete_queued
If in the delete routine, you elected to queue the request, then you need to return True here. You will probably need to check the execution variable you set in the delete routine. If in the delete routine, you elected to queue the request, then you need to return True here. You will probably need to check the execution variable you set in the delete routine.
## Implementing the policies ## Implementing the policies
* [WSF_OPTIONS_POLICY](./WSF_OPTIONS_POLICY) * [WSF_OPTIONS_POLICY](./WSF_OPTIONS_POLICY)