Web::MREST::Entity(3) Methods for dealing with request, response entities

SYNOPSIS

Methods for dealing with request, response entities

METHODS

get_acceptable_content_type_handler

The method to use to process the request entity (i.e, the ``acceptable content type handler'') is set in content_types_accepted. Web::Machine only calls the method on PUT requests and those POST requests for which post_is_create is true. On POST requests where post_is_create is false, we have to call it ourselves, and for that we need a way to get to it.

content_types_provided

Web::Machine calls this routine to determine how to generate the response body GET requests. (It is not called for PUT, POST, or DELETE requests.)

The return value has the following format:

    [
        { 'text/html' => 'method_for_html' },
        { 'application/json' => 'method_for_json' },
        { 'other/mime' => 'method_for_other_mime' },
    ]

As you can see, this is a list of tuples. The key is a media type and the value is the name of a method. The first tuple is taken as the default.

mrest_generate_response_html

Normally, clients will communicate with the server via '_render_response_json', but humans need HTML. This method takes the server's JSON response and wraps it up in a nice package. The return value from this method becomes the response entity.

content_types_accepted

Web::Machine calls this routine to determine how to handle the request body (e.g. in PUT requests).

mrest_process_request_json

PUT and POST requests may contain a request body. This is the ``handler function'' where we process those requests.

We associate this function with 'application/json' via "content_types_accepted".

mrest_process_request

Used to call the request handler manually in cases when Web::Machine does not call it for us.

mrest_generate_response_json

First, run pass 2 of the resource handler, which is expected to return an App::CELL::Status object. Second, push that object onto the context. Third, convert that object into JSON and push the JSON onto the context, too. Return the JSON representation of the App::CELL::Status object - this becomes the HTTP response entity.

mrest_generate_response

This should somehow get the response handler and run it.